lottie/example: enhanced lottieviewer example
[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 target_link_libraries(lottie-player
39                     PUBLIC
40                          "-Wl,--no-undefined"
41                       )
42
43 #declare source and include files
44 add_subdirectory(inc)
45 add_subdirectory(src)
46
47 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
48 SET(EXEC_DIR ${PREFIX})
49 SET(LIBDIR ${LIB_INSTALL_DIR})
50 SET(INCDIR ${PREFIX}/include)
51 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
52 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
53
54 #install header
55 install(FILES inc/lottieplayer.h DESTINATION include)
56
57 #install lib
58 install( TARGETS lottie-player EXPORT lottie-player-targets
59          LIBRARY     DESTINATION    lib
60          ARCHIVE     DESTINATION    lib
61          INCLUDES    DESTINATION    include
62        )
63
64 #install config file.
65
66 install( EXPORT lottie-player-targets
67          FILE          lottie-playerTargets.cmake
68          NAMESPACE     lottie-player::
69          DESTINATION   lib/cmake/lottie-player
70        )
71
72
73 #Create a ConfigVersion.cmake file
74 include(CMakePackageConfigHelpers)
75 write_basic_package_version_file(
76     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
77     VERSION ${PROJECT_VERSION}
78     COMPATIBILITY AnyNewerVersion
79 )
80
81 configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/lottie-playerConfig.cmake.in
82     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
83     INSTALL_DESTINATION lib/cmake/lottie-player
84 )
85
86 #Install the config, configversion and custom find modules
87 install(FILES
88     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfig.cmake
89     ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerConfigVersion.cmake
90     DESTINATION lib/cmake/lottie-player
91 )
92
93
94 export(EXPORT lottie-player-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/lottie-playerTargets.cmake NAMESPACE lottie-player::)
95
96 #Register package in user's package registry
97 export(PACKAGE lottie-player)
98