-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET (this_target_pool launchpad_pool)
-SET (this_target_loader launchpad_loader)
-SET (this_target_lib launchpad)
-SET (this_target_hydra launchpad_hydra)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
+PROJECT(launchpad)
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(${this_target_pool} REQUIRED
- dlog
- libsystemd
- security-manager
- tanchor
- bundle
- gio-2.0
- ttrace
- vconf
- libtzplatform-config
- libcap
- dbus-1
- iniparser
- )
-
-FOREACH(flag ${${this_target_pool}_CFLAGS})
- SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}")
-ENDFOREACH(flag)
-
-PKG_CHECK_MODULES(${this_target_loader} REQUIRED
- dlog
- ecore
- elementary
- security-manager
- libtzplatform-config
- tanchor
- bundle
- aul
- vconf
- buxton2
- libsystemd
- gio-2.0
- dbus-1
- libcap
- )
-
-FOREACH(flag ${${this_target_loader}_CFLAGS})
- SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}")
-ENDFOREACH(flag)
-
-PKG_CHECK_MODULES(${this_target_lib} REQUIRED
- dlog
- bundle
- aul
- security-manager
- libtzplatform-config
- tanchor
- dbus-1
- libcap
- )
-
-FOREACH(flag ${${this_target_lib}_CFLAGS})
- SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}")
-ENDFOREACH(flag)
-
-PKG_CHECK_MODULES(${this_target_hydra} REQUIRED
- dlog
- libsystemd)
-
-FOREACH(flag ${${this_target_hydra}_CFLAGS})
- SET(EXTRA_CFLAGS_hydra "${EXTRA_CFLAGS_hydra} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" )
-SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden")
-SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections")
-SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64")
-SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror")
-
-IF(_TIZEN_FEATURE_PRELINK)
-MESSAGE(STATUS "[__PRELINK__] Enable")
-SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common}")
-SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}")
-ELSE(_TIZEN_FEATURE_PRELINK)
-MESSAGE(STATUS "[__PRELINK__] Disable")
-SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common} -fPIE")
-SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common} -fPIE")
-ENDIF(_TIZEN_FEATURE_PRELINK)
-
-SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}")
-SET(EXTRA_CFLAGS_hydra "${EXTRA_CFLAGS_hydra} ${EXTRA_CFLAGS_common}")
-
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_C_FLAGS_RELEASE "-O2")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-
-ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
IF(_TIZEN_FEATURE_PRIORITY_CHANGE)
ADD_DEFINITIONS("-DTIZEN_FEATURE_PRIORITY_CHANGE")
ENDIF(_TIZEN_FEATURE_PRIORITY_CHANGE)
-IF(_TIZEN_FEATURE_LOADER_PRIORITY)
- ADD_DEFINITIONS("-DTIZEN_FEATURE_LOADER_PRIORITY")
-ENDIF(_TIZEN_FEATURE_LOADER_PRIORITY)
IF(_TIZEN_FEATURE_SET_PERSONALITY_32)
ADD_DEFINITIONS("-DTIZEN_FEATURE_SET_PERSONALITY_32")
ENDIF(_TIZEN_FEATURE_SET_PERSONALITY_32)
+ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
ADD_DEFINITIONS("-DLAUNCHPAD_LOG")
ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
-#ADD_DEFINITIONS("-DPERF_ACTIVATE")
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
-
-# launchpad-loader
-SET(LAUNCHPAD_LOADER "launchpad-loader")
-SET(${LAUNCHPAD_LOADER}_SOURCE_FILES
- src/launchpad_loader.c
- src/launchpad_common.c
- src/launchpad_lib.c
- )
-ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${${LAUNCHPAD_LOADER}_SOURCE_FILES})
-
-# To support 2.x applications which use their own shared libraries.
-# Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the
-# dynamic linker looks in the CWD forcely.
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags")
-
-IF(_TIZEN_FEATURE_PRELINK)
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS})
-ELSE(_TIZEN_FEATURE_PRELINK)
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${${this_target_loader}_LDFLAGS} "-pie")
-ENDIF(_TIZEN_FEATURE_PRELINK)
-
-SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader})
-SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER}
- PROPERTIES SKIP_BUILD_RPATH TRUE
- ) # remove rpath option that is automatically generated by cmake.
-INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin)
-
-# launchpad-process-pool
-SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
-SET(${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES
- src/launchpad.c
- src/launchpad_common.c
- src/loader_info.c
- src/launcher_info.c
- src/debugger_info.c
- src/launchpad_debug.c
- src/launchpad_signal.c
- src/launchpad_config.c
- src/launchpad_io_channel.c
- )
-ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${${LAUNCHPAD_PROCESS_POOL}_SOURCE_FILES})
-
-IF(_TIZEN_FEATURE_PRELINK)
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-lm")
-ELSE(_TIZEN_FEATURE_PRELINK)
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${${this_target_pool}_LDFLAGS} "-pie -lm")
-ENDIF(_TIZEN_FEATURE_PRELINK)
-SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
-SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL}
- PROPERTIES SKIP_BUILD_RPATH TRUE
- ) # remove rpath option that is automatically generated by cmake.
-
-CONFIGURE_FILE(packaging/default.debugger.in packaging/default.debugger @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.debugger DESTINATION share/aul)
-INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin)
-
-CONFIGURE_FILE(packaging/default.loader.in packaging/default.loader @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/default.loader DESTINATION share/aul)
-
-CONFIGURE_FILE(conf/launchpad.conf.in conf/launchpad.conf @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf DESTINATION share/aul)
+ADD_DEFINITIONS("-DLIBDIR=\"${CMAKE_INSTALL_LIBDIR}\"")
+
+## Compile flags
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-zdefs")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
-# liblaunchpad
-SET(LAUNCHPAD_LIB "launchpad")
-ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED
- src/launchpad_lib.c
- src/launchpad_common.c
- )
-SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION})
-SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib})
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${${this_target_lib}_LDFLAGS} "-ldl")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS} -std=c++17")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad)
-CONFIGURE_FILE(launchpad.pc.in launchpad.pc @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-CONFIGURE_FILE(launchpad.pc.in liblaunchpad.pc @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblaunchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+## Linker flags
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-# liblaunchpad_hydra
-SET(LAUNCHPAD_HYDRA "launchpad-hydra")
-ADD_LIBRARY(${LAUNCHPAD_HYDRA} SHARED
- src/launchpad_hydra.c
- )
-SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES VERSION ${VERSION})
-SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_hydra})
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_HYDRA} ${${this_target_hydra}_LDFLAGS} "-ldl")
+## Targets
+SET(TARGET_APP_DEFINED_LOADER "app-defined-loader")
+SET(TARGET_LAUNCHPAD "launchpad")
+SET(TARGET_LAUNCHPAD_COMMON "launchpad-common")
+SET(TARGET_LAUNCHPAD_GLIB "launchpad-glib")
+SET(TARGET_LAUNCHPAD_HYDRA "launchpad-hydra")
+SET(TARGET_LAUNCHPAD_LOADER "launchpad-loader")
+SET(TARGET_LAUNCHPAD_PARSER "launchpad-parser")
+SET(TARGET_LAUNCHPAD_PROCESS_POOL "launchpad-process-pool")
+SET(TARGET_LAUNCHPAD_PROCESS_POOL_UNITTEST "launchpad-process-pool-unittest")
-INSTALL(TARGETS ${LAUNCHPAD_HYDRA} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad_hydra.h DESTINATION include/launchpad)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
-CONFIGURE_FILE(liblaunchpad-hydra.pc.in liblaunchpad-hydra.pc @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblaunchpad-hydra.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INCLUDE(FindPkgConfig)
+INCLUDE(ApplyPkgConfig)
+
+PKG_CHECK_MODULES(AUL_DEPS REQUIRED aul)
+PKG_CHECK_MODULES(BUNDLE_DEPS REQUIRED bundle)
+PKG_CHECK_MODULES(BUXTON2_DEPS REQUIRED buxton2)
+PKG_CHECK_MODULES(CAPI_SYSTEM_RESOURCE_DEPS REQUIRED capi-system-resource)
+PKG_CHECK_MODULES(DBUS_DEPS REQUIRED dbus-1)
+PKG_CHECK_MODULES(DLOG_DEPS REQUIRED dlog)
+PKG_CHECK_MODULES(DLOG_REDIRECT_STDOUT_DEPS REQUIRED dlog-redirect-stdout)
+PKG_CHECK_MODULES(ECORE_CORE_DEPS REQUIRED ecore-core)
+PKG_CHECK_MODULES(ECORE_DEPS REQUIRED ecore)
+PKG_CHECK_MODULES(ELEMENTARY_DEPS REQUIRED elementary)
+PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0)
+PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock)
+PKG_CHECK_MODULES(INIPARSER_DEPS REQUIRED iniparser)
+PKG_CHECK_MODULES(LIBCAP_DEPS REQUIRED libcap)
+PKG_CHECK_MODULES(LIBSMACK_DEPS REQUIRED libsmack)
+PKG_CHECK_MODULES(LIBSYSTEMD_DEPS REQUIRED libsystemd)
+PKG_CHECK_MODULES(LIBTZPLATFORM_CONFIG_DEPS REQUIRED libtzplatform-config)
+PKG_CHECK_MODULES(LIBXML_DEPS REQUIRED libxml-2.0)
+PKG_CHECK_MODULES(PARCEL_DEPS REQUIRED parcel)
+PKG_CHECK_MODULES(PKGMGR_INSTALLER_DEPS REQUIRED pkgmgr-installer)
+PKG_CHECK_MODULES(SECURITY_MANAGER_DEPS REQUIRED security-manager)
+PKG_CHECK_MODULES(TANCHOR_DEPS REQUIRED tanchor)
+PKG_CHECK_MODULES(TIZEN_SHARED_QUEUE_DEPS REQUIRED tizen-shared-queue)
+PKG_CHECK_MODULES(TTRACE_DEPS REQUIRED ttrace)
+PKG_CHECK_MODULES(VCONF_DEPS REQUIRED vconf)
+
+ENABLE_TESTING()
+ADD_TEST(NAME ${TARGET_LAUNCHPAD_PROCESS_POOL_UNITTEST}
+ COMMAND ${TARGET_LAUNCHPAD_PROCESS_POOL_UNITTEST}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/launchpad-process-pool-unittest)
+
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(tests)