1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
6 SET(VERSION "${VERSION_MAJOR}.1.0")
10 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
11 SET(EXEC_PREFIX "\${prefix}")
13 # Build type : Release
14 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
15 SET(CMAKE_BUILD_TYPE "Release")
17 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
20 # Set required packages
21 INCLUDE(FindPkgConfig)
23 OPTION(MULTI_USER_SUPPORT "Enable multi-user support" OFF)
24 OPTION(ENABLE_PRIVACY_MANAGER "Enable privacy manager support" ON)
25 IF(ENABLE_PRIVACY_MANAGER)
26 ADD_DEFINITIONS("-DPRIVACY_MANAGER")
27 pkg_check_modules(pkgs REQUIRED dlog ecore x11 libprivilege-control app-checker rua glib-2.0 ecore-x ecore-input evas vconf pkgmgr-info app2sd privacy-manager-client)
28 ELSE(ENABLE_PRIVACY_MANAGER)
29 pkg_check_modules(pkgs REQUIRED dlog ecore x11 libprivilege-control app-checker rua glib-2.0 ecore-x ecore-input evas vconf pkgmgr-info app2sd)
30 ENDIF(ENABLE_PRIVACY_MANAGER)
31 IF(MULTI_USER_SUPPORT)
32 ADD_DEFINITIONS("-DMULTI_USER_SUPPORT")
33 ELSE(MULTI_USER_SUPPORT)
34 ADD_DEFINITIONS("-DDAC_ACTIVATE")
35 ENDIF(MULTI_USER_SUPPORT)
37 pkg_check_modules(libpkgs REQUIRED dlog bundle dbus-glib-1 ail xdgmime app-checker libsmack)
38 PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 gio-2.0 dlog bundle)
40 FIND_LIBRARY(LIB_DL dl)
42 FOREACH(flag ${libpkgs_CFLAGS})
43 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
46 FOREACH(flag ${pkgs_CFLAGS})
47 SET(TEST_CFLAGS "${TEST_CFLAGS} ${flag}")
51 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
52 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/legacy)
53 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/feature)
54 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,-zdefs" )
55 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
56 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic")
57 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
58 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TEST_CFLAGS}")
59 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
60 SET(CMAKE_C_FLAGS_RELEASE "-O2")
62 SET(CMAKE_SKIP_BUILD_RPATH true)
64 # Get uname value to set 'TARGET' definition
65 # TODO: Is this needed?
66 FIND_PROGRAM(UNAME NAMES uname)
67 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
68 IF("${ARCH}" STREQUAL "arm")
69 ADD_DEFINITIONS("-DTARGET")
70 MESSAGE("add -DTARGET")
71 ENDIF("${ARCH}" STREQUAL "arm")
73 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
74 ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"")
77 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
82 # aul_mods : modules (static library)
83 add_library(aul_mods STATIC
89 add_library(aul SHARED
93 src/launch_with_result.c
102 target_link_libraries(aul aul_mods ${libpkgs_LDFLAGS})
103 SET_TARGET_PROPERTIES(aul PROPERTIES SOVERSION ${VERSION_MAJOR})
104 SET_TARGET_PROPERTIES(aul PROPERTIES VERSION ${VERSION})
106 # launchpad(old avatar) daemon
107 SET(AVATAR_NAME "launchpad_preloading_preinitializing_daemon")
108 add_executable(${AVATAR_NAME}
109 launchpad_src/launchpad.c
110 launchpad_src/util_x.c
113 MESSAGE(" "${pkgs_LDFLAGS})
114 target_link_libraries(${AVATAR_NAME} aul_mods aul ${pkgs_LDFLAGS} ${LIB_DL})
115 set_target_properties(${AVATAR_NAME}
116 PROPERTIES SKIP_BUILD_RPATH true
117 ) # remove rpath option that is automatically generated by cmake.
122 am_daemon/amd_request.c
123 am_daemon/amd_appinfo.c
124 am_daemon/amd_cgutil.c
125 am_daemon/amd_launch.c
126 am_daemon/amd_status.c
128 target_link_libraries(amd aul_mods app-checker-server rua glib-2.0 bundle ail aul utilX ${pkgs_LDFLAGS})
130 SET(REL_AGENT daemon-manager-release-agent)
131 ADD_EXECUTABLE(${REL_AGENT} agent/${REL_AGENT}.c)
132 TARGET_LINK_LIBRARIES(${REL_AGENT} ${PKGS_LDFLAGS} aul aul_mods)
133 SET_TARGET_PROPERTIES(${REL_AGENT} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
135 INSTALL(TARGETS ${REL_AGENT} DESTINATION bin)
137 SET(LAUNCH_AGENT daemon-manager-launch-agent)
138 ADD_EXECUTABLE(${LAUNCH_AGENT} agent/${LAUNCH_AGENT}.c)
139 TARGET_LINK_LIBRARIES(${LAUNCH_AGENT} ${PKGS_LDFLAGS})
140 SET_TARGET_PROPERTIES(${LAUNCH_AGENT} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
142 INSTALL(TARGETS ${LAUNCH_AGENT} DESTINATION bin)
147 CONFIGURE_FILE(aul.pc.in aul.pc @ONLY)
148 CONFIGURE_FILE(legacy/preload_list.txt.in legacy/preload_list.txt @ONLY)
149 CONFIGURE_FILE(feature/preexec_list.txt.in feature/preexec_list.txt @ONLY)
152 INSTALL(TARGETS aul DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
153 INSTALL(TARGETS ${AVATAR_NAME} DESTINATION bin)
154 INSTALL(TARGETS amd DESTINATION bin)
156 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul.h DESTINATION include/aul)
157 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_service.h DESTINATION include/aul)
158 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/SLP_AUL_PG.h DESTINATION include/aul)
159 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/aul_service.sh DESTINATION bin)
160 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/aul_service_test.sh DESTINATION bin)
161 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/aul_mime.sh DESTINATION bin)
162 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/aul.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
164 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/legacy/preload_list.txt DESTINATION /usr/share/aul )
165 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/feature/preexec_list.txt DESTINATION /usr/share/aul )
166 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/mida_db.sql DESTINATION /usr/share/aul )
167 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/miregex DESTINATION /usr/share/aul )
168 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/service DESTINATION /usr/share/aul )
171 add_subdirectory(test)