The rlottie library is now built as optimized and without debug info on Unix and macOS.

Also disabled some annoying warning messages when compiling rlottie.
This commit is contained in:
Leon Styhre 2022-10-08 11:04:51 +02:00
parent 660348e0d9
commit c7a035127c

View file

@ -6,24 +6,55 @@
# CMake configuration for bundled dependencies built in-tree.
#
# On Windows, rlottie is built as a DLL file.
if(NOT WIN32)
set(BUILD_SHARED_LIBS OFF)
# This makes it possible to set options in subprojects.
set (CMAKE_POLICY_DEFAULT_CMP0077 NEW)
if (WIN32)
# On Windows the build type needs to match the main binary.
if (CMAKE_BUILD_TYPE MATCHES Profiling)
set (CMAKE_BUILD_TYPE Release)
elseif(NOT CMAKE_BUILD_TYPE MATCHES Debug)
set (CMAKE_BUILD_TYPE Release)
endif()
else()
# Always build with optimizations enabled and without debug info.
set (CMAKE_BUILD_TYPE Release)
endif()
# Disabled threading support for rlottie as this functionality actually leads to far worse
unset(CMAKE_CXX_FLAGS)
unset(CMAKE_EXE_LINKER_FLAGS)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
# Disable DLL interface warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251")
else()
# Strip the DLL files when building with MinGW.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
endif()
if (WIN32)
set(BUILD_SHARED_LIBS ON)
else()
set(BUILD_SHARED_LIBS OFF)
endif()
endif()
# Disable threading support for rlottie as this functionality actually leads to far worse
# performance. As well there is a bug on Windows that makes rlottie hang forever on application
# shutdown if compiled using MinGW with threading support enabled.
option(LOTTIE_THREAD OFF)
option(LOTTIE_MODULE OFF)
# Only use the compiler and linker flags defined by rlottie.
unset(CMAKE_CXX_FLAGS)
unset(CMAKE_EXE_LINKER_FLAGS)
if(EMSCRIPTEN)
set(CMAKE_CXX_FLAGS -pthread)
endif()
# rlottie generates a lot of annoying compiler warnings that we don't need to show.
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267 /wd4530 /wd4996")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
endif()
add_subdirectory(rlottie EXCLUDE_FROM_ALL)