############################################# # # Step 1. Set Variable and Build Dependency # # set a name for the entire project PROJECT(oma-ds) # set variables SET(EXENAME "${PROJECT_NAME}-agent") SET(BINDIR "${PREFIX}/bin") SET(OMADS_SRC_DIR "${CMAKE_SOURCE_DIR}/src/agent") SET(OMADS_COMPONETS "main;common;framework/san-parser;framework/event;framework/task;service-adapter;service-adapter/network-binder;service-adapter/protocol-binder;service-engine") # checks for build dependency modules : a pkg-config module for CMake INCLUDE(FindPkgConfig) pkg_check_modules(LPKGS REQUIRED glib-2.0 libsoup-2.4 sqlite3 sync-agent vconf dlog aul dbus-glib-1 ) ############################################# # # Step 2. Set Compile Environment # # set extra cflags from build dependency STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}") # find all source files in a directory. FOREACH(OMADS_COMPONET ${OMADS_COMPONETS}) AUX_SOURCE_DIRECTORY(${OMADS_SRC_DIR}/${OMADS_COMPONET} SRCS) ENDFOREACH(OMADS_COMPONET) # add internal include directories to the build. INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/san-parser) # add define macros ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ") ############################################# # # Step 3. Set Link Environment # # add an executable to the project using the specified source files. ADD_EXECUTABLE(${EXENAME} ${SRCS}) # link a target to given libraries. TARGET_LINK_LIBRARIES(${EXENAME} ${LPKGS_LIBRARIES}) # sets additional compiler flags used to build sources within the target. SET_TARGET_PROPERTIES(${EXENAME} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS}) ############################################# # # Step 4. Install packages # # install executable file INSTALL(TARGETS ${EXENAME} DESTINATION ${BINDIR}) # install oma ds configuration files INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/oma-ds-cfg DESTINATION /usr/share) # install oma ds dbus file INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadsagent.service DESTINATION /usr/share/dbus-1/system-services) INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadsagent.conf DESTINATION /etc/dbus-1/system.d) # install systemd unit INSTALL(FILES ${CMAKE_SOURCE_DIR}/oma-ds-agent.service DESTINATION /usr/lib/systemd/system) INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/usr/lib/systemd/system/graphical.target.wants)") INSTALL(CODE "EXECUTE_PROCESS(COMMAND ln -sf ../oma-ds-agent.service . WORKING_DIRECTORY \$ENV{DESTDIR}/usr/lib/systemd/system/graphical.target.wants)")