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 (this_target_hydra launchpad_hydra)
8 PKG_CHECK_MODULES(${this_target_pool} REQUIRED
23 FOREACH(flag ${${this_target_pool}_CFLAGS})
24 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}")
27 PKG_CHECK_MODULES(${this_target_loader} REQUIRED
44 FOREACH(flag ${${this_target_loader}_CFLAGS})
45 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}")
48 PKG_CHECK_MODULES(${this_target_lib} REQUIRED
59 FOREACH(flag ${${this_target_lib}_CFLAGS})
60 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}")
63 PKG_CHECK_MODULES(${this_target_hydra} REQUIRED
67 FOREACH(flag ${${this_target_hydra}_CFLAGS})
68 SET(EXTRA_CFLAGS_hydra "${EXTRA_CFLAGS_hydra} ${flag}")
71 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" )
72 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden")
73 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections")
74 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64")
75 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror")
77 IF(_TIZEN_FEATURE_PRELINK)
78 MESSAGE(STATUS "[__PRELINK__] Enable")
79 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common}")
80 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}")
81 ELSE(_TIZEN_FEATURE_PRELINK)
82 MESSAGE(STATUS "[__PRELINK__] Disable")
83 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common} -fPIE")
84 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common} -fPIE")
85 ENDIF(_TIZEN_FEATURE_PRELINK)
87 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
88 SET(EXTRA_CFLAGS_hydra "${EXTRA_CFLAGS_hydra} ${EXTRA_CFLAGS_common}")
90 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
91 SET(CMAKE_C_FLAGS_RELEASE "-O2")
92 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
94 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
95 IF(_TIZEN_FEATURE_PRIORITY_CHANGE)
96 ADD_DEFINITIONS("-DTIZEN_FEATURE_PRIORITY_CHANGE")
97 ENDIF(_TIZEN_FEATURE_PRIORITY_CHANGE)
98 IF(_TIZEN_FEATURE_LOADER_PRIORITY)
99 ADD_DEFINITIONS("-DTIZEN_FEATURE_LOADER_PRIORITY")
100 ENDIF(_TIZEN_FEATURE_LOADER_PRIORITY)
101 IF(_TIZEN_FEATURE_SET_PERSONALITY_32)
102 ADD_DEFINITIONS("-DTIZEN_FEATURE_SET_PERSONALITY_32")
103 ENDIF(_TIZEN_FEATURE_SET_PERSONALITY_32)
105 ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
106 ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
107 ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
108 #ADD_DEFINITIONS("-DPERF_ACTIVATE")
110 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
113 SET(LAUNCHPAD_LOADER "launchpad-loader")
114 SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
115 src/launchpad_loader.c
116 src/launchpad_common.c
119 ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
121 # To support 2.x applications which use their own shared libraries.
122 # Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the
123 # dynamic linker looks in the CWD forcely.
124 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags")
126 IF(_TIZEN_FEATURE_PRELINK)
127 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS})
128 ELSE(_TIZEN_FEATURE_PRELINK)
129 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
130 ENDIF(_TIZEN_FEATURE_PRELINK)
132 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
133 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
134 PROPERTIES SKIP_BUILD_RPATH TRUE
135 ) # remove rpath option that is automatically generated by cmake.
136 INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
138 # launchpad-process-pool
139 SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
140 SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
142 src/launchpad_common.c
146 src/launchpad_debug.c
147 src/launchpad_signal.c
148 src/launchpad_config.c
149 src/launchpad_io_channel.c
151 ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
153 IF(_TIZEN_FEATURE_PRELINK)
154 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-lm")
155 ELSE(_TIZEN_FEATURE_PRELINK)
156 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie -lm")
157 ENDIF(_TIZEN_FEATURE_PRELINK)
158 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
159 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
160 PROPERTIES SKIP_BUILD_RPATH TRUE
161 ) # remove rpath option that is automatically generated by cmake.
163 CONFIGURE_FILE(packaging/default.debugger.in packaging/default.debugger @ONLY)
164 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.debugger DESTINATION share/aul)
165 INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
167 CONFIGURE_FILE(packaging/default.loader.in packaging/default.loader @ONLY)
168 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.loader DESTINATION share/aul)
170 CONFIGURE_FILE(conf/launchpad.conf.in conf/launchpad.conf @ONLY)
171 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf DESTINATION share/aul)
174 SET(LAUNCHPAD_LIB "launchpad")
175 ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
177 src/launchpad_common.c
179 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${MAJORVER})
180 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
181 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
182 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
184 INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
185 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
186 CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
187 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
188 CONFIGURE_FILE(launchpad.pc.in liblaunchpad.pc @ONLY)
189 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblaunchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
192 SET(LAUNCHPAD_HYDRA "launchpad-hydra")
193 ADD_LIBRARY(${LAUNCHPAD_HYDRA} SHARED
194 src/launchpad_hydra.c
196 SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES SOVERSION ${MAJORVER})
197 SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES VERSION ${VERSION})
198 SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_hydra})
199 TARGET_LINK_LIBRARIES(${LAUNCHPAD_HYDRA} ${${this_target_hydra}_LDFLAGS} "-ldl")
201 INSTALL(TARGETS ${LAUNCHPAD_HYDRA} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
202 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad_hydra.h DESTINATION include/launchpad)
204 CONFIGURE_FILE(liblaunchpad-hydra.pc.in liblaunchpad-hydra.pc @ONLY)
205 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblaunchpad-hydra.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)