From 4ace296b3a85e07cbf53eeb82528c33d9d736023 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Tue, 2 Apr 2024 10:51:17 -0700 Subject: [PATCH] [Build] Improve the TRANSLATIONS_ONLY build speed * Move CMake dependencies checkout to `cmake/Dependencies.cmake`. * Disable most dependencies checkout from the `TRANSLATIONS_ONLY` build. * Remove the debug/translations_only GitHub Action. --- .github/workflows/macos-build.yml | 4 + .github/workflows/msys2-build.yml | 4 + .github/workflows/ubuntu-build.yml | 7 + .github/workflows/visual-studio-build.yml | 31 ++-- CMakeLists.txt | 172 +--------------------- cmake/Architecture.cmake | 9 ++ cmake/Dependencies.cmake | 122 +++++++++++++++ cmake/Options.cmake | 35 +++-- cmake/Set-Toolchain-vcpkg.cmake | 4 + cmake/Toolchain.cmake | 47 ++++++ 10 files changed, 240 insertions(+), 195 deletions(-) create mode 100644 cmake/Dependencies.cmake diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index 3cca32e5..487334c1 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -22,6 +22,10 @@ jobs: - libretro_build: 'DEBUG=1' build_type: debug build_options: libretro + exclude: + # Exclude debug/translations_only build + - build_type: debug + build_options: translations_only runs-on: macos-latest steps: diff --git a/.github/workflows/msys2-build.yml b/.github/workflows/msys2-build.yml index f9e12e10..f13bc70f 100644 --- a/.github/workflows/msys2-build.yml +++ b/.github/workflows/msys2-build.yml @@ -22,6 +22,10 @@ jobs: - libretro_build: 'DEBUG=1' build_type: debug build_options: libretro + exclude: + # Exclude debug/translations_only build + - build_type: debug + build_options: translations_only runs-on: windows-latest env: MSYSTEM: CLANG64 diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index e71c80ac..7d6c6084 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -27,6 +27,13 @@ jobs: - libretro_build: 'DEBUG=1' build_type: debug build_options: libretro + exclude: + # Exclude debug/translations_only build + - build_type: debug + build_options: translations_only + - build_type: release + build_options: translations_only + build_compiler: clang runs-on: ubuntu-latest steps: - name: Checkout the code diff --git a/.github/workflows/visual-studio-build.yml b/.github/workflows/visual-studio-build.yml index 230be781..5e3220e1 100644 --- a/.github/workflows/visual-studio-build.yml +++ b/.github/workflows/visual-studio-build.yml @@ -19,6 +19,22 @@ jobs: build_options: link_off - cmake_options: '-DTRANSLATIONS_ONLY=ON' build_options: translations_only + - cmake_vcpkg_triplet: 'x64-windows-static' + msvc_arch: x64 + - cmake_vcpkg_triplet: 'x86-windows-static' + msvc_arch: amd64_x86 + - cmake_vcpkg_triplet: 'arm64-windows-static' + msvc_arch: amd64_arm64 + exclude: + # Exclude debug/translations_only build + - build_type: debug + build_options: translations_only + - build_type: release + build_options: translations_only + msvc_arch: amd64_x86 + - build_type: release + build_options: translations_only + msvc_arch: amd64_arm64 runs-on: windows-latest steps: - name: Checkout the code @@ -31,20 +47,9 @@ jobs: with: arch: ${{ matrix.msvc_arch }} - - if: matrix.msvc_arch == 'x64' - name: Configure (x64) + - name: Configure run: >- - cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x64-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} - - - if: matrix.msvc_arch == 'amd64_x86' - name: Configure (x86) - run: >- - cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x86-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} - - - if: matrix.msvc_arch == 'amd64_arm64' - name: Configure (arm64) - run: >- - cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=arm64-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} + cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=${{ matrix.cmake_vcpkg_triplet }} ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} - name: Build run: cmake --build build diff --git a/CMakeLists.txt b/CMakeLists.txt index b6ade0c2..cc56b5d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,26 +108,7 @@ include(GNUInstallDirs) include(Options) include(Architecture) include(Toolchain) - -#Output all binaries at top level -set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}) - -if(NOT HTTPS) - add_compile_definitions(NO_HTTPS) -endif() - -if(ENABLE_GBA_LOGGING) - add_compile_definitions(GBA_LOGGING ) -endif() - -if(ENABLE_MMX) - add_compile_definitions(MMX) -endif() - -# The SDL port can't be built without debugging support -if(NOT ENABLE_DEBUGGER AND ENABLE_SDL) - message(SEND_ERROR "The SDL port can't be built without debugging support") -endif() +include(Dependencies) if(EXISTS "${CMAKE_SOURCE_DIR}/.git") include(GitTagVersion) @@ -185,159 +166,8 @@ if(NOT VBAM_VERSION) changelog_version(VBAM_VERSION VBAM_REVISION VBAM_VERSION_RELEASE) endif() -# We do not support amd64 asm yet -if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX)) - message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.") -endif() - -# Look for some dependencies using CMake scripts -find_package(ZLIB REQUIRED) - -set(OpenGL_GL_PREFERENCE GLVND) - -if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD) - set(OpenGL_GL_PREFERENCE LEGACY) -endif() - -find_package(OpenGL REQUIRED) -find_package(SDL2 REQUIRED) - -# Add libsamplerate to SDL2 with vcpkg -unset(SDL2_LIBRARY_TEMP) -if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg") - if(WIN32) - unset(arch_suffix) - unset(path_prefix) - if(VCPKG_TARGET_TRIPLET MATCHES -static) - set(arch_suffix -static) - endif() - if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$") - set(path_prefix debug) - endif() - set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix}) - - SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${installed_prefix}/lib/samplerate.lib) - else() - SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} -lsamplerate) - endif() -endif() - -if(VBAM_STATIC) - set(VBAM_SDL2_LIBS SDL2::SDL2-static ${SDL2_LIBRARY_TEMP}) -else() - set(VBAM_SDL2_LIBS SDL2::SDL2 ${SDL2_LIBRARY_TEMP}) -endif() - -set(VBAM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated) - -# Set up "src" and generated directory as a global include directory. -include_directories( - ${CMAKE_SOURCE_DIR}/src - ${VBAM_GENERATED_DIR} -) - -if(ENABLE_FFMPEG) - if(NOT FFMPEG_LIBRARIES) - message(FATAL_ERROR "ENABLE_FFMPEG was specified, but required versions of ffmpeg libraries cannot be found!") - endif() - - if(APPLE) - list(APPEND FFMPEG_LDFLAGS "SHELL:-framework CoreText" "SHELL:-framework ApplicationServices") - - if(UPSTREAM_RELEASE) - list(APPEND FFMPEG_LDFLAGS -lbz2 -ltiff "SHELL:-framework DiskArbitration" -lfreetype -lfontconfig -llzma -lxml2 -lharfbuzz) - endif() - elseif(WIN32) - set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid) - list(APPEND FFMPEG_LIBRARIES secur32 bcrypt ${WIN32_MEDIA_FOUNDATION_LIBS}) - - if(MSYS AND VBAM_STATIC) - foreach(lib tiff jbig lzma) - cygpath(lib "$ENV{MSYSTEM_PREFIX}/lib/lib${lib}.a") - - list(APPEND FFMPEG_LIBRARIES "${lib}") - endforeach() - endif() - endif() -else() - add_compile_definitions(NO_FFMPEG) -endif() - -if(NOT ENABLE_ONLINEUPDATES) - add_compile_definitions(NO_ONLINEUPDATES) -endif() - -# C defines -add_compile_definitions(HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") -add_compile_definitions(PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam") -add_compile_definitions(__STDC_FORMAT_MACROS) - -if(ENABLE_LINK) - # IPC linking code needs sem_timedwait which can be either in librt or pthreads - if(NOT WIN32) - find_library(RT_LIB rt) - if(RT_LIB) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB}) - set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB}) - endif() - endif() - - include(CheckFunctionExists) - check_function_exists(sem_timedwait SEM_TIMEDWAIT) - if(SEM_TIMEDWAIT) - add_compile_definitions(HAVE_SEM_TIMEDWAIT) - endif() -else() - add_compile_definitions(NO_LINK) -endif() - -# The debugger is enabled by default -if(ENABLE_DEBUGGER) - add_compile_definitions(VBAM_ENABLE_DEBUGGER) -endif() - -# The ASM core is disabled by default because we don't know on which platform we are -if(NOT ENABLE_ASM_CORE) - add_compile_definitions(C_CORE) -endif() - # Enable internationalization set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale) -add_compile_definitions(LOCALEDIR="${LOCALEDIR}") - -# for now, only GBALink.cpp uses gettext() directly -if(APPLE) - # use Homebrew gettext if available - if(EXISTS "/usr/local/opt/gettext") - set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH};/usr/local/opt/gettext/include") - set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};/usr/local/opt/gettext/lib") - set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/opt/gettext/bin") - endif() -endif() - -if(ENABLE_LINK OR ENABLE_WX) - find_path(LIBINTL_INC libintl.h) - find_library(LIBINTL_LIB NAMES libintl intl) - find_library(LIBICONV_LIB NAMES libiconv iconv) - find_library(LIBCHARSET_LIB NAMES libcharset charset) - if(LIBINTL_LIB) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIB}) - list(APPEND NLS_LIBS ${LIBINTL_LIB}) - endif() - if(LIBICONV_LIB) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIB}) - list(APPEND NLS_LIBS ${LIBICONV_LIB}) - endif() - if(LIBCHARSET_LIB) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_LIB}) - list(APPEND NLS_LIBS ${LIBCHARSET_LIB}) - endif() - include(CheckFunctionExists) - check_function_exists(gettext GETTEXT_FN) - if(NOT (LIBINTL_INC OR GETTEXT_FN)) - message(FATAL_ERROR "NLS requires libintl/gettext") - endif() -endif() if(NOT TRANSLATIONS_ONLY) add_subdirectory(third_party/include/nonstd) diff --git a/cmake/Architecture.cmake b/cmake/Architecture.cmake index 0097a0e5..a639c7a2 100644 --- a/cmake/Architecture.cmake +++ b/cmake/Architecture.cmake @@ -1,3 +1,7 @@ +if(TRANSLATIONS_ONLY) + return() +endif() + if(NOT CMAKE_SYSTEM_PROCESSOR) if(NOT CMAKE_TOOLCHAIN_FILE AND CMAKE_HOST_SYSTEM_PROCESSOR) set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR}) @@ -63,3 +67,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]") set(CMAKE_CROSSCOMPILING TRUE) endif() endif() + +# We do not support amd64 asm yet +if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX)) + message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.") +endif() diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake new file mode 100644 index 00000000..9af46528 --- /dev/null +++ b/cmake/Dependencies.cmake @@ -0,0 +1,122 @@ +if(TRANSLATIONS_ONLY) + return() +endif() + +# Look for some dependencies using CMake scripts +find_package(ZLIB REQUIRED) + +set(OpenGL_GL_PREFERENCE GLVND) + +if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD) + set(OpenGL_GL_PREFERENCE LEGACY) +endif() + +find_package(OpenGL REQUIRED) +find_package(SDL2 REQUIRED) + +# Add libsamplerate to SDL2 with vcpkg +unset(SDL2_LIBRARY_TEMP) +if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg") + if(WIN32) + unset(arch_suffix) + unset(path_prefix) + if(VCPKG_TARGET_TRIPLET MATCHES -static) + set(arch_suffix -static) + endif() + if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$") + set(path_prefix debug) + endif() + set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix}) + + SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${installed_prefix}/lib/samplerate.lib) + else() + SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} -lsamplerate) + endif() +endif() + +if(VBAM_STATIC) + set(VBAM_SDL2_LIBS SDL2::SDL2-static ${SDL2_LIBRARY_TEMP}) +else() + set(VBAM_SDL2_LIBS SDL2::SDL2 ${SDL2_LIBRARY_TEMP}) +endif() + +if(ENABLE_FFMPEG) + if(NOT FFMPEG_LIBRARIES) + message(FATAL_ERROR "ENABLE_FFMPEG was specified, but required versions of ffmpeg libraries cannot be found!") + endif() + + if(APPLE) + list(APPEND FFMPEG_LDFLAGS "SHELL:-framework CoreText" "SHELL:-framework ApplicationServices") + + if(UPSTREAM_RELEASE) + list(APPEND FFMPEG_LDFLAGS -lbz2 -ltiff "SHELL:-framework DiskArbitration" -lfreetype -lfontconfig -llzma -lxml2 -lharfbuzz) + endif() + elseif(WIN32) + set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid) + list(APPEND FFMPEG_LIBRARIES secur32 bcrypt ${WIN32_MEDIA_FOUNDATION_LIBS}) + + if(MSYS AND VBAM_STATIC) + foreach(lib tiff jbig lzma) + cygpath(lib "$ENV{MSYSTEM_PREFIX}/lib/lib${lib}.a") + + list(APPEND FFMPEG_LIBRARIES "${lib}") + endforeach() + endif() + endif() +else() + add_compile_definitions(NO_FFMPEG) +endif() + +if(ENABLE_LINK) + # IPC linking code needs sem_timedwait which can be either in librt or pthreads + if(NOT WIN32) + find_library(RT_LIB rt) + if(RT_LIB) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB}) + set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB}) + endif() + endif() + + include(CheckFunctionExists) + check_function_exists(sem_timedwait SEM_TIMEDWAIT) + if(SEM_TIMEDWAIT) + add_compile_definitions(HAVE_SEM_TIMEDWAIT) + endif() +else() + add_compile_definitions(NO_LINK) +endif() + +# for now, only GBALink.cpp uses gettext() directly +if(APPLE) + # use Homebrew gettext if available + if(EXISTS "/usr/local/opt/gettext") + set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH};/usr/local/opt/gettext/include") + set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};/usr/local/opt/gettext/lib") + set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/opt/gettext/bin") + endif() +endif() + +if(ENABLE_LINK OR ENABLE_WX) + find_path(LIBINTL_INC libintl.h) + find_library(LIBINTL_LIB NAMES libintl intl) + find_library(LIBICONV_LIB NAMES libiconv iconv) + find_library(LIBCHARSET_LIB NAMES libcharset charset) + if(LIBINTL_LIB) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIB}) + list(APPEND NLS_LIBS ${LIBINTL_LIB}) + endif() + if(LIBICONV_LIB) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIB}) + list(APPEND NLS_LIBS ${LIBICONV_LIB}) + endif() + if(LIBCHARSET_LIB) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_LIB}) + list(APPEND NLS_LIBS ${LIBCHARSET_LIB}) + endif() + include(CheckFunctionExists) + check_function_exists(gettext GETTEXT_FN) + if(NOT (LIBINTL_INC OR GETTEXT_FN)) + message(FATAL_ERROR "NLS requires libintl/gettext") + endif() +endif() + diff --git a/cmake/Options.cmake b/cmake/Options.cmake index 92824136..4b8ac851 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -55,17 +55,21 @@ cmake_dependent_option(ENABLE_MMX "Enable MMX" ${MMX_DEFAULT} "ENABLE_ASM_SCALER option(ENABLE_LIRC "Enable LIRC support" OFF) # Link / SFML -find_package(SFML 2.4 COMPONENTS network system) -if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - if(SFML_STATIC_LIBRARIES AND SFML_NETWORK_LIBRARY_STATIC_DEBUG AND SFML_SYSTEM_LIBRARY_STATIC_DEBUG) - set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_STATIC_DEBUG} ${SFML_SYSTEM_LIBRARY_STATIC_DEBUG}) - elseif(SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG AND SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG) - set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG} ${SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG}) +if(TRANSLATIONS_ONLY) + set(ENABLE_LINK_DEFAULT OFF) +else() + find_package(SFML 2.4 COMPONENTS network system) + if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + if(SFML_STATIC_LIBRARIES AND SFML_NETWORK_LIBRARY_STATIC_DEBUG AND SFML_SYSTEM_LIBRARY_STATIC_DEBUG) + set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_STATIC_DEBUG} ${SFML_SYSTEM_LIBRARY_STATIC_DEBUG}) + elseif(SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG AND SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG) + set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG} ${SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG}) + endif() + endif() + set(ENABLE_LINK_DEFAULT OFF) + if(SFML_FOUND) + set(ENABLE_LINK_DEFAULT ON) endif() -endif() -set(ENABLE_LINK_DEFAULT OFF) -if(SFML_FOUND) - set(ENABLE_LINK_DEFAULT ON) endif() option(ENABLE_LINK "Enable GBA linking functionality" ${ENABLE_LINK_DEFAULT}) @@ -74,7 +78,7 @@ set(FFMPEG_DEFAULT OFF) set(FFMPEG_COMPONENTS AVCODEC AVFORMAT SWSCALE AVUTIL SWRESAMPLE) set(FFMPEG_COMPONENT_VERSIONS AVCODEC>=58.18.100 AVFORMAT>=58.12.100 SWSCALE>=5.1.100 AVUTIL>=56.14.100 SWRESAMPLE>=3.1.100) -if(NOT DEFINED ENABLE_FFMPEG OR ENABLE_FFMPEG) +if(NOT TRANSLATIONS_ONLY AND NOT DEFINED ENABLE_FFMPEG OR ENABLE_FFMPEG) set(FFMPEG_DEFAULT ON) find_package(FFmpeg COMPONENTS ${FFMPEG_COMPONENTS}) @@ -139,3 +143,12 @@ endif() option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" OFF) option(ZIP_SUFFIX [=[suffix for release zip files, e.g. "-somebranch".zip]=] OFF) + +# The SDL port can't be built without debugging support +if(NOT ENABLE_DEBUGGER AND ENABLE_SDL) + message(FATAL_ERROR "The SDL port can't be built without debugging support") +endif() + +if(TRANSLATIONS_ONLY AND (ENABLE_SDL OR ENABLE_WX)) + message(FATAL_ERROR "The SDL and wxWidgets ports can't be built when TRANSLATIONS_ONLY is enabled") +endif() diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index befbe0b3..790d603f 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -1,3 +1,7 @@ +if(TRANSLATIONS_ONLY) + return() +endif() + if(NOT DEFINED VCPKG_TARGET_TRIPLET) if(NOT WIN32) return() diff --git a/cmake/Toolchain.cmake b/cmake/Toolchain.cmake index 92223ab0..cec1a17d 100644 --- a/cmake/Toolchain.cmake +++ b/cmake/Toolchain.cmake @@ -1,3 +1,7 @@ +if(TRANSLATIONS_ONLY) + return() +endif() + # Compiler stuff include(CheckCXXCompilerFlag) @@ -21,6 +25,49 @@ if(ENABLE_LTO) endif() endif() +# Output all binaries at top level +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}) + +if(NOT HTTPS) + add_compile_definitions(NO_HTTPS) +endif() + +if(ENABLE_GBA_LOGGING) + add_compile_definitions(GBA_LOGGING ) +endif() + +if(ENABLE_MMX) + add_compile_definitions(MMX) +endif() + + +if(NOT ENABLE_ONLINEUPDATES) + add_compile_definitions(NO_ONLINEUPDATES) +endif() + +# The debugger is enabled by default +if(ENABLE_DEBUGGER) + add_compile_definitions(VBAM_ENABLE_DEBUGGER) +endif() + +# The ASM core is disabled by default because we don't know on which platform we are +if(NOT ENABLE_ASM_CORE) + add_compile_definitions(C_CORE) +endif() + +# Set up "src" and generated directory as a global include directory. +set(VBAM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated) +include_directories( + ${CMAKE_SOURCE_DIR}/src + ${VBAM_GENERATED_DIR} +) + +# C defines +add_compile_definitions(HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") +add_compile_definitions(PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam") +add_compile_definitions(__STDC_FORMAT_MACROS) +add_compile_definitions(LOCALEDIR="${LOCALEDIR}") + # Common compiler settings. if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_compile_definitions(DEBUG)