Configure CMake to allow build static rlottie lib
authorNicholas Guriev <guriev-ns@ya.ru>
Sun, 21 Jul 2019 09:15:55 +0000 (12:15 +0300)
committerHermet Park <hermetpark@gmail.com>
Fri, 9 Aug 2019 08:54:22 +0000 (17:54 +0900)
CMakeLists.txt
src/vector/stb/CMakeLists.txt

index 375a79d..e0d4e0b 100644 (file)
@@ -7,10 +7,14 @@ if (NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE MinSizeRel)
 endif()
 
-add_definitions(-DLOT_BUILD)
+if (NOT DEFINED BUILD_SHARED_LIBS)
+    # Keep the previous behavior of the build system, consistent with Meson.
+    set(BUILD_SHARED_LIBS ON)
+endif()
 
 #declare target
-add_library( rlottie SHARED  "" )
+add_library( rlottie )
+set_target_properties( rlottie PROPERTIES DEFINE_SYMBOL LOT_BUILD )
 
 #declare version of the target
 set(player_version_major 0)
@@ -64,10 +68,10 @@ target_link_libraries(rlottie
                         "${CMAKE_THREAD_LIBS_INIT}"
                      )
 
-# for dlopen, dlsym and dlclose dependancy
-target_link_libraries(rlottie
-                    PRIVATE
-                    ${CMAKE_DL_LIBS})
+if (LOTTIE_MODULE)
+    # for dlopen, dlsym and dlclose dependancy
+    target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS})
+endif()
 
 if(APPLE)
     target_link_libraries(rlottie
index 2b6abd1..dd96ec5 100644 (file)
@@ -2,6 +2,12 @@ if(LOTTIE_MODULE)
     add_library(rlottie-image-loader SHARED
                 stb_image.cpp
                )
+    target_compile_options(rlottie-image-loader PRIVATE
+                           -fvisibility=hidden
+                          )
+    set_target_properties(rlottie-image-loader PROPERTIES
+                          DEFINE_SYMBOL LOT_BUILD
+                         )
     install(TARGETS rlottie-image-loader
             LIBRARY DESTINATION ${LIB_INSTALL_DIR}
             ARCHIVE DESTINATION ${LIB_INSTALL_DIR}