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)
8 PKG_CHECK_MODULES(${this_target_pool} REQUIRED
17 FOREACH(flag ${${this_target_pool}_CFLAGS})
18 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}")
21 PKG_CHECK_MODULES(${this_target_loader} REQUIRED
30 FOREACH(flag ${${this_target_loader}_CFLAGS})
31 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}")
34 PKG_CHECK_MODULES(${this_target_lib} REQUIRED
41 FOREACH(flag ${${this_target_lib}_CFLAGS})
42 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}")
45 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" )
46 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden")
47 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fPIE")
48 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections")
49 SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64")
51 SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common}")
52 SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}")
53 SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
55 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
56 SET(CMAKE_C_FLAGS_RELEASE "-O2")
57 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
58 SET(CMAKE_SKIP_BUILD_RPATH TRUE)
60 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
61 IF(_APPFW_FEATURE_PRIORITY_CHANGE)
62 ADD_DEFINITIONS("-D_APPFW_FEATURE_PRIORITY_CHANGE")
63 ENDIF(_APPFW_FEATURE_PRIORITY_CHANGE)
65 ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
66 ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
67 ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
68 #ADD_DEFINITIONS("-DPERF_ACTIVATE")
70 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
73 SET(LAUNCHPAD_LOADER "launchpad-loader")
74 SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
75 src/launchpad_loader.c
76 src/launchpad_common.c
79 ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
81 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl")
82 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
83 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
84 SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
85 PROPERTIES SKIP_BUILD_RPATH TRUE
86 ) # remove rpath option that is automatically generated by cmake.
87 INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
89 # launchpad-process-pool
90 SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
91 SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
93 src/launchpad_common.c
95 ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
97 TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie")
98 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
99 SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
100 PROPERTIES SKIP_BUILD_RPATH TRUE
101 ) # remove rpath option that is automatically generated by cmake.
103 INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
105 CONFIGURE_FILE(packaging/preload_list.txt.in packaging/preload_list.txt @ONLY)
106 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/preload_list.txt DESTINATION share/aul)
107 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/launchpad-process-pool-preload-list.txt DESTINATION share/aul)
110 SET(LAUNCHPAD_LIB "launchpad")
111 ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
113 src/launchpad_common.c
115 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
116 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
117 SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
118 TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
120 INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
121 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
122 CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
123 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)