Some CMake configuration changes for building with rlottie.

This commit is contained in:
Leon Styhre 2022-01-08 16:23:23 +01:00
parent b3421823a7
commit d45c690586
4 changed files with 12 additions and 17 deletions

View file

@ -161,7 +161,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Od /DEBUG:FULL") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Od /DEBUG:FULL")
else() 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") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0")
endif() endif()
# If using Clang, then add additional debug data needed by GDB. # 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") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /O2 /DEBUG:FULL") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /O2 /DEBUG:FULL")
else() 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") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2")
endif() endif()
else() else()
@ -185,7 +185,7 @@ else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG /std:c++17 /O2 /DEBUG:NONE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG /std:c++17 /O2 /DEBUG:NONE")
else() 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) if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2")
else() 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) set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
# Add each component. # Add each component.
add_subdirectory("external" EXCLUDE_FROM_ALL) add_subdirectory("external")
add_subdirectory("es-core") add_subdirectory("es-core")
add_subdirectory("es-app") add_subdirectory("es-app")

View file

@ -113,13 +113,6 @@ if(WIN32)
LIST(APPEND ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation.rc) LIST(APPEND ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation.rc)
endif() 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. # OS-specific installation and package generation setup.

View file

@ -167,10 +167,6 @@ set(CORE_SOURCES
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Miscellaneous configuration. # 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}) include_directories(${COMMON_INCLUDE_DIRS})
add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS}) add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS})
target_link_libraries(es-core ${COMMON_LIBRARIES}) target_link_libraries(es-core ${COMMON_LIBRARIES})

View file

@ -12,10 +12,16 @@ if(NOT WIN32)
endif() endif()
# There is a bug that makes rlottie hang forever on application shutdown if compiled using MinGW # 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) if(WIN32)
option(LOTTIE_THREAD OFF) option(LOTTIE_THREAD OFF)
endif() endif()
option(LOTTIE_MODULE OFF) 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)