From 998830181fdc270c48bffdc484fd366f5bdf2f1a Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 6 Jan 2022 23:19:37 +0100 Subject: [PATCH] Added CMake configuration for the Lottie animation support. --- CMakeLists.txt | 15 ++++++++++++--- es-app/CMakeLists.txt | 7 ++++++- es-core/CMakeLists.txt | 7 +++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3ba58751..fed1efd98 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 -Wunused-macros") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -g3 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") 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 -Wunused-macros") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -g3 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") 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 -Wunused-macros") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -DNDEBUG -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") if(APPLE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2") else() @@ -317,6 +317,7 @@ set(COMMON_INCLUDE_DIRS ${CURL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/external/glm ${CMAKE_CURRENT_SOURCE_DIR}/external/nanosvg/src ${CMAKE_CURRENT_SOURCE_DIR}/external/rapidjson/include + ${CMAKE_CURRENT_SOURCE_DIR}/external/rlottie/inc ${CMAKE_CURRENT_SOURCE_DIR}/es-core/src) if(APPLE) @@ -420,6 +421,9 @@ else() ${SDL2_LIBRARY}) endif() +# Lottie animation library rlottie. +set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${PROJECT_SOURCE_DIR}/librlottie.a) + if(APPLE) # See es-app/CMakeLists.txt for an explation for why an extra "Resources" directory # has been added to the install prefix. @@ -471,5 +475,10 @@ 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") add_subdirectory("es-core") add_subdirectory("es-app") + +# Make sure rlottie is built before es-core and set lottie2gif to not be built. +add_dependencies(es-core rlottie) +set_target_properties(lottie2gif PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index 7f5aaeb46..6db4af3cd 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -113,6 +113,11 @@ if(WIN32) LIST(APPEND ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation.rc) endif() +#--------------------------------------------------------------------------------------------------- +# Miscellaneous configuration. + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-macros") + #--------------------------------------------------------------------------------------------------- # OS-specific installation and package generation setup. @@ -125,7 +130,7 @@ if(APPLE OR WIN32) else() include_directories(${COMMON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/src) add_executable(emulationstation ${ES_SOURCES} ${ES_HEADERS}) - target_link_libraries(emulationstation ${COMMON_LIBRARIES} es-core) + target_link_libraries(emulationstation ${COMMON_LIBRARIES} ${CMAKE_DL_LIBS} es-core) set_target_properties(emulationstation PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) endif() diff --git a/es-core/CMakeLists.txt b/es-core/CMakeLists.txt index e4884b164..822d7b1ea 100644 --- a/es-core/CMakeLists.txt +++ b/es-core/CMakeLists.txt @@ -47,6 +47,7 @@ set(CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/components/IList.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageGridComponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/LottieComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/OptionListComponent.h @@ -122,6 +123,7 @@ set(CORE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/components/GridTileComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/components/LottieComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.cpp @@ -162,6 +164,11 @@ set(CORE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/TimeUtil.cpp ) +#--------------------------------------------------------------------------------------------------- +# Miscellaneous configuration. + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-macros") + include_directories(${COMMON_INCLUDE_DIRS}) add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS}) target_link_libraries(es-core ${COMMON_LIBRARIES})