Wait mountpoints before executing an application
[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
6 INCLUDE(FindPkgConfig)
7 PKG_CHECK_MODULES(${this_target_pool} REQUIRED
8         dlog
9         libsystemd
10         security-manager
11         tanchor
12         bundle
13         gio-2.0
14         ttrace
15         vconf
16         libtzplatform-config
17         libcap
18         )
19
20 FOREACH(flag ${${this_target_pool}_CFLAGS})
21         SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}")
22 ENDFOREACH(flag)
23
24 PKG_CHECK_MODULES(${this_target_loader} REQUIRED
25         dlog
26         ecore
27         elementary
28         security-manager
29         libtzplatform-config
30         tanchor
31         bundle
32         aul
33         vconf
34         buxton2
35         libsystemd
36         voice-control-elm
37         gio-2.0
38         )
39
40 FOREACH(flag ${${this_target_loader}_CFLAGS})
41         SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}")
42 ENDFOREACH(flag)
43
44 PKG_CHECK_MODULES(${this_target_lib} REQUIRED
45         dlog
46         bundle
47         aul
48         security-manager
49         libtzplatform-config
50         tanchor
51         )
52
53 FOREACH(flag ${${this_target_lib}_CFLAGS})
54         SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}")
55 ENDFOREACH(flag)
56
57 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" )
58 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden")
59 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fPIE")
60 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections")
61 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64")
62 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror")
63
64 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common}")
65 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}")
66 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
67
68 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
69 SET(CMAKE_C_FLAGS_RELEASE "-O2")
70 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
71
72 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
73 IF(_TIZEN_FEATURE_PRIORITY_CHANGE)
74         ADD_DEFINITIONS("-DTIZEN_FEATURE_PRIORITY_CHANGE")
75 ENDIF(_TIZEN_FEATURE_PRIORITY_CHANGE)
76 IF(_TIZEN_FEATURE_LOADER_PRIORITY)
77         ADD_DEFINITIONS("-DTIZEN_FEATURE_LOADER_PRIORITY")
78 ENDIF(_TIZEN_FEATURE_LOADER_PRIORITY)
79 IF(_TIZEN_FEATURE_SET_PERSONALITY_32)
80         ADD_DEFINITIONS("-DTIZEN_FEATURE_SET_PERSONALITY_32")
81 ENDIF(_TIZEN_FEATURE_SET_PERSONALITY_32)
82
83 ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
84 ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
85 ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
86 #ADD_DEFINITIONS("-DPERF_ACTIVATE")
87
88 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
89
90 # launchpad-loader
91 SET(LAUNCHPAD_LOADER "launchpad-loader")
92 SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
93         src/launchpad_loader.c
94         src/launchpad_common.c
95         src/launchpad_lib.c
96         )
97 ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
98
99 # To support 2.x applications which use their own shared libraries.
100 # Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the
101 # dynamic linker looks in the CWD forcely.
102 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags")
103 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
104 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
105 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
106         PROPERTIES SKIP_BUILD_RPATH TRUE
107         ) # remove rpath option that is automatically generated by cmake.
108 INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
109
110 # launchpad-process-pool
111 SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
112 SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
113         src/launchpad.c
114         src/launchpad_common.c
115         src/loader_info.c
116         src/launcher_info.c
117         src/debugger_info.c
118         src/launchpad_debug.c
119         src/launchpad_signal.c
120         )
121 ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
122
123 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie -lm")
124 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
125 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
126         PROPERTIES SKIP_BUILD_RPATH TRUE
127         ) # remove rpath option that is automatically generated by cmake.
128
129 CONFIGURE_FILE(packaging/default.debugger.in packaging/default.debugger @ONLY)
130 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.debugger DESTINATION share/aul)
131 INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
132
133 CONFIGURE_FILE(packaging/default.loader.in packaging/default.loader @ONLY)
134 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.loader DESTINATION share/aul)
135
136 # liblaunchpad
137 SET(LAUNCHPAD_LIB "launchpad")
138 ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
139                 src/launchpad_lib.c
140                 src/launchpad_common.c
141                 )
142 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${MAJORVER})
143 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
144 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
145 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
146
147 INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
148 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
149 CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
150 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
151
152
153