-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(launchpad C CXX)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
+PROJECT(launchpad)
-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("-DLAUNCHPAD_LOG")
ADD_DEFINITIONS("-DPRELOAD_ACTIVATE")
ADD_DEFINITIONS("-DPREEXEC_ACTIVATE")
+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")
+
+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")
+
+## Linker flags
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+## 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")
+
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
+
+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)