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)
7 PKG_CHECK_MODULES(${this_target_pool} REQUIRED
22 FOREACH(flag ${${this_target_pool}_CFLAGS})
23 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}")
26 PKG_CHECK_MODULES(${this_target_loader} REQUIRED
43 FOREACH(flag ${${this_target_loader}_CFLAGS})
44 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}")
47 PKG_CHECK_MODULES(${this_target_lib} REQUIRED
58 FOREACH(flag ${${this_target_lib}_CFLAGS})
59 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}")
62 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" )
63 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden")
64 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections")
65 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64")
66 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror")
68 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common} -fPIE")
69 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common} -fPIE")
70 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
72 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
73 SET(CMAKE_C_FLAGS_RELEASE "-O2")
74 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
76 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
77 IF(_TIZEN_FEATURE_PRIORITY_CHANGE)
78 ADD_DEFINITIONS("-DTIZEN_FEATURE_PRIORITY_CHANGE")
79 ENDIF(_TIZEN_FEATURE_PRIORITY_CHANGE)
80 IF(_TIZEN_FEATURE_LOADER_PRIORITY)
81 ADD_DEFINITIONS("-DTIZEN_FEATURE_LOADER_PRIORITY")
82 ENDIF(_TIZEN_FEATURE_LOADER_PRIORITY)
83 IF(_TIZEN_FEATURE_SET_PERSONALITY_32)
84 ADD_DEFINITIONS("-DTIZEN_FEATURE_SET_PERSONALITY_32")
85 ENDIF(_TIZEN_FEATURE_SET_PERSONALITY_32)
87 ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
88 ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
89 ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
90 #ADD_DEFINITIONS("-DPERF_ACTIVATE")
92 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
95 SET(LAUNCHPAD_LOADER "launchpad-loader")
96 SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
97 src/launchpad_loader.c
98 src/launchpad_common.c
101 ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
103 # To support 2.x applications which use their own shared libraries.
104 # Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the
105 # dynamic linker looks in the CWD forcely.
106 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags")
107 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
108 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
109 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
110 PROPERTIES SKIP_BUILD_RPATH TRUE
111 ) # remove rpath option that is automatically generated by cmake.
112 INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
114 # launchpad-process-pool
115 SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
116 SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
118 src/launchpad_common.c
122 src/launchpad_debug.c
123 src/launchpad_signal.c
124 src/launchpad_config.c
126 ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
128 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie -lm")
129 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
130 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
131 PROPERTIES SKIP_BUILD_RPATH TRUE
132 ) # remove rpath option that is automatically generated by cmake.
134 CONFIGURE_FILE(packaging/default.debugger.in packaging/default.debugger @ONLY)
135 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.debugger DESTINATION share/aul)
136 INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
138 CONFIGURE_FILE(packaging/default.loader.in packaging/default.loader @ONLY)
139 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.loader DESTINATION share/aul)
141 CONFIGURE_FILE(conf/launchpad.conf.in conf/launchpad.conf @ONLY)
142 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf DESTINATION share/aul)
145 SET(LAUNCHPAD_LIB "launchpad")
146 ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
148 src/launchpad_common.c
150 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${MAJORVER})
151 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
152 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
153 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
155 INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
156 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
157 CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
158 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
159 CONFIGURE_FILE(launchpad.pc.in liblaunchpad.pc @ONLY)
160 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblaunchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)