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 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common} -fPIE")
78 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common} -fPIE")
79 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
80 SET(EXTRA_CFLAGS_hydra "${EXTRA_CFLAGS_hydra} ${EXTRA_CFLAGS_common}")
82 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
83 SET(CMAKE_C_FLAGS_RELEASE "-O2")
84 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
86 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
87 IF(_TIZEN_FEATURE_PRIORITY_CHANGE)
88 ADD_DEFINITIONS("-DTIZEN_FEATURE_PRIORITY_CHANGE")
89 ENDIF(_TIZEN_FEATURE_PRIORITY_CHANGE)
90 IF(_TIZEN_FEATURE_LOADER_PRIORITY)
91 ADD_DEFINITIONS("-DTIZEN_FEATURE_LOADER_PRIORITY")
92 ENDIF(_TIZEN_FEATURE_LOADER_PRIORITY)
93 IF(_TIZEN_FEATURE_SET_PERSONALITY_32)
94 ADD_DEFINITIONS("-DTIZEN_FEATURE_SET_PERSONALITY_32")
95 ENDIF(_TIZEN_FEATURE_SET_PERSONALITY_32)
97 ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
98 ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
99 ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
100 #ADD_DEFINITIONS("-DPERF_ACTIVATE")
102 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
105 SET(LAUNCHPAD_LOADER "launchpad-loader")
106 SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
107 src/launchpad_loader.c
108 src/launchpad_common.c
111 ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
113 # To support 2.x applications which use their own shared libraries.
114 # Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the
115 # dynamic linker looks in the CWD forcely.
116 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags")
117 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
118 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
119 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
120 PROPERTIES SKIP_BUILD_RPATH TRUE
121 ) # remove rpath option that is automatically generated by cmake.
122 INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
124 # launchpad-process-pool
125 SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
126 SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
128 src/launchpad_common.c
132 src/launchpad_debug.c
133 src/launchpad_signal.c
134 src/launchpad_config.c
136 ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
138 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie -lm")
139 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
140 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
141 PROPERTIES SKIP_BUILD_RPATH TRUE
142 ) # remove rpath option that is automatically generated by cmake.
144 CONFIGURE_FILE(packaging/default.debugger.in packaging/default.debugger @ONLY)
145 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.debugger DESTINATION share/aul)
146 INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
148 CONFIGURE_FILE(packaging/default.loader.in packaging/default.loader @ONLY)
149 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.loader DESTINATION share/aul)
151 CONFIGURE_FILE(conf/launchpad.conf.in conf/launchpad.conf @ONLY)
152 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf DESTINATION share/aul)
155 SET(LAUNCHPAD_LIB "launchpad")
156 ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
158 src/launchpad_common.c
160 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${MAJORVER})
161 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
162 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
163 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
165 INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
166 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
167 CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
168 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
169 CONFIGURE_FILE(launchpad.pc.in liblaunchpad.pc @ONLY)
170 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblaunchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
173 SET(LAUNCHPAD_HYDRA "launchpad-hydra")
174 ADD_LIBRARY(${LAUNCHPAD_HYDRA} SHARED
175 src/launchpad_hydra.c
177 SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES SOVERSION ${MAJORVER})
178 SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES VERSION ${VERSION})
179 SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_hydra})
180 TARGET_LINK_LIBRARIES(${LAUNCHPAD_HYDRA} ${${this_target_hydra}_LDFLAGS} "-ldl")
182 INSTALL(TARGETS ${LAUNCHPAD_HYDRA} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
183 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad_hydra.h DESTINATION include/launchpad)
185 CONFIGURE_FILE(liblaunchpad-hydra.pc.in liblaunchpad-hydra.pc @ONLY)
186 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblaunchpad-hydra.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)