Install preload-list for launchpad-loader
[platform/core/appfw/launchpad.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 SET (this_target_pool launchpad_pool)
3 SET (this_target_loader launchpad_loader)
4 SET (this_target_lib launchpad)
5 SET (VERSION_MAJOR 0)
6
7 INCLUDE(FindPkgConfig)
8 PKG_CHECK_MODULES(${this_target_pool} REQUIRED
9         dlog
10         libsystemd-daemon
11         vconf
12         security-manager
13         bundle
14         gio-2.0
15         )
16
17 FOREACH(flag ${${this_target_pool}_CFLAGS})
18         SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}")
19 ENDFOREACH(flag)
20
21 PKG_CHECK_MODULES(${this_target_loader} REQUIRED
22         dlog
23         ecore
24         elementary
25         security-manager
26         bundle
27         aul
28         )
29
30 FOREACH(flag ${${this_target_loader}_CFLAGS})
31         SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}")
32 ENDFOREACH(flag)
33
34 PKG_CHECK_MODULES(${this_target_lib} REQUIRED
35         dlog
36         bundle
37         aul
38         security-manager
39         )
40
41 FOREACH(flag ${${this_target_lib}_CFLAGS})
42         SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}")
43 ENDFOREACH(flag)
44
45 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" )
46 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden")
47 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fPIE")
48 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections")
49 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64")
50
51 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common}")
52 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}")
53 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
54
55 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
56 SET(CMAKE_C_FLAGS_RELEASE "-O2")
57 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
58 SET(CMAKE_SKIP_BUILD_RPATH TRUE)
59
60 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
61 IF(_APPFW_FEATURE_PRIORITY_CHANGE)
62         ADD_DEFINITIONS("-D_APPFW_FEATURE_PRIORITY_CHANGE")
63 ENDIF(_APPFW_FEATURE_PRIORITY_CHANGE)
64
65 ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
66 ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
67 ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
68 #ADD_DEFINITIONS("-DPERF_ACTIVATE")
69
70 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
71
72 # launchpad-loader
73 SET(LAUNCHPAD_LOADER "launchpad-loader")
74 SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
75         src/launchpad_loader.c
76         src/launchpad_common.c
77         src/launchpad_lib.c
78         )
79 ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
80
81 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl")
82 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
83 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
84 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
85         PROPERTIES SKIP_BUILD_RPATH TRUE
86         ) # remove rpath option that is automatically generated by cmake.
87 INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
88
89 # launchpad-process-pool
90 SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
91 SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
92         src/launchpad.c
93         src/launchpad_common.c
94         )
95 ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
96
97 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie")
98 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
99 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
100         PROPERTIES SKIP_BUILD_RPATH TRUE
101         ) # remove rpath option that is automatically generated by cmake.
102
103 INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
104
105 CONFIGURE_FILE(packaging/preload_list.txt.in packaging/preload_list.txt @ONLY)
106 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/preload_list.txt DESTINATION share/aul)
107 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/launchpad-process-pool-preload-list.txt DESTINATION share/aul)
108
109 # liblaunchpad
110 SET(LAUNCHPAD_LIB "launchpad")
111 ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
112                 src/launchpad_lib.c
113                 src/launchpad_common.c
114                 )
115 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
116 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
117 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
118 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
119
120 INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
121 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
122 CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
123 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
124
125
126