From d45c69058652547e2d432d70abfb27afb135131f Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 8 Jan 2022 16:23:23 +0100 Subject: [PATCH] Some CMake configuration changes for building with rlottie. --- CMakeLists.txt | 8 ++++---- es-app/CMakeLists.txt | 7 ------- es-core/CMakeLists.txt | 4 ---- external/CMakeLists.txt | 10 ++++++++-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dba2b67f..34ac5998c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,7 +161,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Od /DEBUG:FULL") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -g3 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -g3 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers -Wunused-macros") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0") endif() # If using Clang, then add additional debug data needed by GDB. @@ -176,7 +176,7 @@ elseif(CMAKE_BUILD_TYPE MATCHES Profiling) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /O2 /DEBUG:FULL") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -g3 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -g3 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers -Wunused-macros") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2") endif() else() @@ -185,7 +185,7 @@ else() if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG /std:c++17 /O2 /DEBUG:NONE") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -DNDEBUG -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -DNDEBUG -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers -Wunused-macros") if(APPLE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2") else() @@ -479,7 +479,7 @@ set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) # Add each component. -add_subdirectory("external" EXCLUDE_FROM_ALL) +add_subdirectory("external") add_subdirectory("es-core") add_subdirectory("es-app") diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index 5d9b84ce5..dd7645e42 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -113,13 +113,6 @@ if(WIN32) LIST(APPEND ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation.rc) endif() -#--------------------------------------------------------------------------------------------------- -# Miscellaneous configuration. - -if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-macros") -endif() - #--------------------------------------------------------------------------------------------------- # OS-specific installation and package generation setup. diff --git a/es-core/CMakeLists.txt b/es-core/CMakeLists.txt index 464b39054..614b8a415 100644 --- a/es-core/CMakeLists.txt +++ b/es-core/CMakeLists.txt @@ -167,10 +167,6 @@ set(CORE_SOURCES #--------------------------------------------------------------------------------------------------- # Miscellaneous configuration. -if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-macros") -endif() - include_directories(${COMMON_INCLUDE_DIRS}) add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS}) target_link_libraries(es-core ${COMMON_LIBRARIES}) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 11da7685a..2a56f4185 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -12,10 +12,16 @@ if(NOT WIN32) endif() # There is a bug that makes rlottie hang forever on application shutdown if compiled using MinGW -# with threading support enabled. Disable it for MSVC as well to keep the behavior consistent. +# with threading support enabled. Disable it for MSVC as well to keep the behavior consistent +# across builds with either of these compilers. if(WIN32) option(LOTTIE_THREAD OFF) endif() option(LOTTIE_MODULE OFF) -add_subdirectory("rlottie") + +# Only use the compiler and linker flags defined by rlottie. +unset(CMAKE_CXX_FLAGS) +unset(CMAKE_EXE_LINKER_FLAGS) + +add_subdirectory("rlottie" EXCLUDE_FROM_ALL)