Browse Source

Optimize superbuild executable

master
C. J. Howard 2 years ago
parent
commit
1a76999c83
6 changed files with 49 additions and 9 deletions
  1. +31
    -7
      CMakeLists.txt
  2. +1
    -1
      modules/antkeeper-data
  3. +1
    -1
      modules/antkeeper-source
  4. +2
    -0
      modules/dr_wav/dr_wav.c
  5. +11
    -0
      modules/stb/stb_image.c
  6. +3
    -0
      modules/stb/stb_image_write.c

+ 31
- 7
CMakeLists.txt View File

@ -49,9 +49,9 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
elseif(MSVC)
set(CMAKE_CXX_FLAGS "/W3 /MP /MT")
set(CMAKE_CXX_FLAGS "/MP /W3 /MT /GR- /GS- /D_WIN32_WINNT=0x0501 /DWINVER=0x0501")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /Ox")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /O2")
endif()
# Set C compiler flags
@ -59,6 +59,12 @@ set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
# Set executable linker flags
if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nologo")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /INCREMENTAL:NO")
endif()
# Setup module directories
set(MODULE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/modules")
set(MODULE_BUILD_DIR "${PROJECT_BINARY_DIR}/modules/build")
@ -75,10 +81,14 @@ ExternalProject_Add(SDL2
CMAKE_ARGS
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
"-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
"-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
"-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
"-DSDL_SHARED=OFF"
"-DSDL_STATIC=ON"
"-DSDL_LIBC=ON"
"-DSDL_FORCE_STATIC_VCRT=ON"
"-DSDL_ASSERTIONS=disabled"
"-DSDL_ATOMIC=OFF"
"-DSDL_AUDIO=OFF"
"-DSDL_VIDEO=ON"
@ -89,7 +99,7 @@ ExternalProject_Add(SDL2
"-DSDL_HIDAPI=ON"
"-DSDL_POWER=OFF"
"-DSDL_THREADS=OFF"
"-DSDL_TIMERS=ON"
"-DSDL_TIMERS=OFF"
"-DSDL_FILE=OFF"
"-DSDL_LOADSO=ON"
"-DSDL_CPUINFO=OFF"
@ -97,7 +107,10 @@ ExternalProject_Add(SDL2
"-DSDL_SENSOR=OFF"
"-DSDL_LOCALE=OFF"
"-DSDL_MISC=OFF"
BUILD_ALWAYS 0)
"-DSDL_DIRECTX=OFF"
"-DSDL_WASAPI=OFF"
"-DSDL_RENDER_D3D=OFF"
BUILD_ALWAYS 1)
# Build OpenAL Soft module
ExternalProject_Add(openal-soft
@ -107,6 +120,9 @@ ExternalProject_Add(openal-soft
CMAKE_ARGS
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
"-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
"-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
"-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
"-DLIBTYPE=STATIC"
"-DFORCE_STATIC_VCRT=ON"
"-DALSOFT_UTILS=OFF"
@ -203,6 +219,9 @@ ExternalProject_Add(physfs
CMAKE_ARGS
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
"-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
"-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
"-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
"-DPHYSFS_ARCHIVE_ZIP=ON"
"-DPHYSFS_ARCHIVE_7Z=OFF"
"-DPHYSFS_ARCHIVE_GRP=OFF"
@ -216,9 +235,6 @@ ExternalProject_Add(physfs
"-DPHYSFS_BUILD_STATIC=ON"
"-DPHYSFS_BUILD_SHARED=OFF"
"-DPHYSFS_BUILD_TEST=OFF"
"-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
"-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
"-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
BUILD_ALWAYS 0)
# Build FreeType module
@ -233,6 +249,11 @@ ExternalProject_Add(freetype
"-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
"-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
"-DBUILD_SHARED_LIBS=false"
"-DFT_DISABLE_ZLIB=ON"
"-DFT_DISABLE_BZIP2=ON"
"-DFT_DISABLE_PNG=ON"
"-DFT_DISABLE_HARFBUZZ=ON"
"-DFT_DISABLE_BROTLI=ON"
BUILD_ALWAYS 0)
# Build antkeeper-source module
@ -250,6 +271,9 @@ ExternalProject_Add(antkeeper-source
"-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
"-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
"-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
"-DCMAKE_EXE_LINKER_FLAGS='${CMAKE_EXE_LINKER_FLAGS}'"
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG='${CMAKE_EXE_LINKER_FLAGS_DEBUG}'"
"-DCMAKE_EXE_LINKER_FLAGS_RELEASE='${CMAKE_EXE_LINKER_FLAGSRELEASE}'"
BUILD_ALWAYS 1)
# Build antkeeper-data module (if exists)

+ 1
- 1
modules/antkeeper-data

@ -1 +1 @@
Subproject commit 495326e4d1d0210263e072b869ed742d0f734c5a
Subproject commit bd7cda4f17855ef021c45c0a657a7e319c560349

+ 1
- 1
modules/antkeeper-source

@ -1 +1 @@
Subproject commit 3eddbefccc3ec3911f4ad761f2e794aa25849631
Subproject commit 5d530b0d8735345c28934b8b6c910f36197271d9

+ 2
- 0
modules/dr_wav/dr_wav.c View File

@ -1,2 +1,4 @@
#define DR_WAV_IMPLEMENTATION
#define DR_WAV_NO_CONVERSION_API
#define DR_WAV_NO_STDIO
#include "dr_wav.h"

+ 11
- 0
modules/stb/stb_image.c View File

@ -1,2 +1,13 @@
#define STB_IMAGE_IMPLEMENTATION
#define STBI_NO_BMP
#define STBI_NO_PSD
#define STBI_NO_GIF
#define STBI_NO_PIC
#define STBI_NO_PNM
#if defined(NDEBUG)
#define STBI_ASSERT(x)
#endif
#include "stb_image.h"

+ 3
- 0
modules/stb/stb_image_write.c View File

@ -1,2 +1,5 @@
#define STB_IMAGE_WRITE_IMPLEMENTATION
#if defined(NDEBUG)
#define STBIW_ASSERT(x)
#endif
#include "stb_image_write.h"

Loading…
Cancel
Save