lottie/example: Added image_test.json(resource with image resource )
[platform/core/uifw/lottie-player.git] / CMakeLists.txt
1 cmake_minimum_required( VERSION 3.2 )
2
3 #declare project
4 project( lottie-player VERSION 0.0.1 LANGUAGES C CXX ASM)
5
6 #declare target
7 add_library( lottie-player SHARED  "" )
8
9 #declare version of the target
10 set(player_version_major 0)
11 set(player_version_minor 0)
12 set(player_version_patch 1)
13 set(player_version ${player_version_major}.${player_version_minor}.${player_version_patch} )
14 set_target_properties(lottie-player PROPERTIES
15                         VERSION    ${player_version}
16                         SOVERSION  ${player_version_major}
17                       )
18
19 #declare alias so that library can be used inside the build tree, e.g. when testing
20 add_library(lottie-player::lottie-player ALIAS lottie-player)
21
22 #declare target compilation options
23 target_compile_options(lottie-player
24                     PUBLIC
25                         -std=c++14
26                     PRIVATE
27                         -Wall -fvisibility=hidden -O2)
28
29 #declare dependancy
30 set( CMAKE_THREAD_PREFER_PTHREAD TRUE )
31 find_package( Threads )
32
33 target_link_libraries(lottie-player
34                     PUBLIC
35                         "${CMAKE_THREAD_LIBS_INIT}"
36                      )
37
38 # for dlopen, dlsym and dlclose dependancy
39 target_link_libraries(lottie-player
40                     PRIVATE
41                     ${CMAKE_DL_LIBS})
42
43 target_link_libraries(lottie-player
44                     PUBLIC
45                          "-Wl,--no-undefined"
46                       )
47
48 #declare source and include files
49 add_subdirectory(inc)
50 add_subdirectory(src)
51
52 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
53 SET(EXEC_DIR ${PREFIX})
54 SET(LIBDIR ${LIB_INSTALL_DIR})
55 SET(INCDIR ${PREFIX}/include)
56 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
57 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
58
59 #install header
60 install(FILES inc/lottieanimation.h inc/lottieanimation_capi.h inc/lottiecommon.h  DESTINATION include)
61
62 #install lib
63 install( TARGETS lottie-player EXPORT lottie-player-targets
64          LIBRARY     DESTINATION    ${LIB_INSTALL_DIR}
65          ARCHIVE     DESTINATION    ${LIB_INSTALL_DIR}
66          INCLUDES    DESTINATION    include
67        )
68
69 #install config file.
70
71 install( EXPORT lottie-player-targets
72          FILE          lottie-playerTargets.cmake
73          NAMESPACE     lottie-player::
74          DESTINATION   ${LIB_INSTALL_DIR}/cmake/lottie-player
75        )
76
77
78 #Create a ConfigVersion.cmake file
79 include(CMakePackageConfigHelpers)
80 write_basic_package_version_file(
81     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
82     VERSION ${PROJECT_VERSION}
83     COMPATIBILITY AnyNewerVersion
84 )
85
86 configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/lottie-playerConfig.cmake.in
87     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
88     INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/lottie-player
89 )
90
91 #Install the config, configversion and custom find modules
92 install(FILES
93     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
94     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
95     DESTINATION ${LIB_INSTALL_DIR}/cmake/lottie-player
96 )
97
98
99 export(EXPORT lottie-player-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerTargets.cmake NAMESPACE lottie-player::)
100
101 #Register package in user's package registry
102 export(PACKAGE lottie-player)
103