Added CMake configuration for the Lottie animation support.

This commit is contained in:
Leon Styhre 2022-01-06 23:19:37 +01:00
parent f56d7cc67b
commit 998830181f
3 changed files with 25 additions and 4 deletions

View file

@ -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)

View file

@ -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()

View file

@ -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})