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
19 FOREACH(flag ${${this_target_pool}_CFLAGS})
20 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}")
23 PKG_CHECK_MODULES(${this_target_loader} REQUIRED
35 FOREACH(flag ${${this_target_loader}_CFLAGS})
36 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}")
39 PKG_CHECK_MODULES(${this_target_lib} REQUIRED
46 FOREACH(flag ${${this_target_lib}_CFLAGS})
47 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}")
50 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" )
51 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden")
52 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fPIE")
53 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections")
54 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64")
55 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror")
57 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common}")
58 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}")
59 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
61 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
62 SET(CMAKE_C_FLAGS_RELEASE "-O2")
63 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
65 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
66 IF(_TIZEN_FEATURE_PRIORITY_CHANGE)
67 ADD_DEFINITIONS("-DTIZEN_FEATURE_PRIORITY_CHANGE")
68 ENDIF(_TIZEN_FEATURE_PRIORITY_CHANGE)
69 IF(_TIZEN_FEATURE_LOADER_PRIORITY)
70 ADD_DEFINITIONS("-DTIZEN_FEATURE_LOADER_PRIORITY")
71 ENDIF(_TIZEN_FEATURE_LOADER_PRIORITY)
73 ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
74 ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
75 ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
76 #ADD_DEFINITIONS("-DPERF_ACTIVATE")
78 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
81 SET(LAUNCHPAD_LOADER "launchpad-loader")
82 SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
83 src/launchpad_loader.c
84 src/launchpad_common.c
87 ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
89 # To support 2.x applications which use their own shared libraries.
90 # Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the
91 # dynamic linker looks in the CWD forcely.
92 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags")
93 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
94 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
95 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
96 PROPERTIES SKIP_BUILD_RPATH TRUE
97 ) # remove rpath option that is automatically generated by cmake.
98 INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
100 # launchpad-process-pool
101 SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
102 SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
104 src/launchpad_common.c
108 src/launchpad_debug.c
109 src/launchpad_signal.c
111 ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
113 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie -lm")
114 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
115 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
116 PROPERTIES SKIP_BUILD_RPATH TRUE
117 ) # remove rpath option that is automatically generated by cmake.
119 CONFIGURE_FILE(packaging/default.debugger.in packaging/default.debugger @ONLY)
120 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.debugger DESTINATION share/aul)
121 INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
123 CONFIGURE_FILE(packaging/default.loader.in packaging/default.loader @ONLY)
124 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.loader DESTINATION share/aul)
127 SET(LAUNCHPAD_LIB "launchpad")
128 ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
130 src/launchpad_common.c
132 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${MAJORVER})
133 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
134 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
135 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
137 INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
138 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
139 CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
140 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)