CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(mobileap-agent C CXX) ## Default SET(BASE_SRCS src/mobileap.c src/mobileap_softap.c src/mobileap_main.c src/mobileap_wifi.c src/mobileap_usb.c src/mobileap_bluetooth.c src/mobileap_common.c src/mobileap_network.c src/mobileap_iptables.c src/mobileap_handler.c src/gdbus/mobileap_dbus.c ) SET(BASE_PKGS alarm-service capi-network-bluetooth capi-network-connection capi-network-wifi-manager capi-system-device capi-system-info dbus-1 deviced dlog dpm gio-2.0 gio-unix-2.0 libcrypto3 libtzplatform-config key-manager vconf) SET(HEADED_PKGS appcore-common appsvc notification syspopup-caller) MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") ## Redefine for BASE IF("${CMAKE_BUILD_TYPE}" STREQUAL "BASE") SET(SRCS ${BASE_SRCS}) SET(PKGS "${BASE_PKGS}") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "BASE") ## Redefine for headed IF("${CMAKE_BUILD_TYPE}" STREQUAL "HEADED") SET(SRCS ${BASE_SRCS} src/mobileap_p2p.c src/mobileap_wfd.c src/mobileap_notification.c ) SET(PKGS "${BASE_PKGS} ${HEADED_PKGS} capi-network-wifi-direct") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "HEADED") ## Redefine for TM1 IF("${CMAKE_BUILD_TYPE}" STREQUAL "TM1") SET(SRCS ${BASE_SRCS} src/mobileap_p2p.c src/mobileap_wfd.c src/mobileap_notification.c ) SET(PKGS "${BASE_PKGS} ${HEADED_PKGS} capi-network-wifi-direct") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "TM1") ## Redefine for DA IF("${CMAKE_BUILD_TYPE}" STREQUAL "DA") SET(SRCS ${BASE_SRCS}) SET(PKGS "${BASE_PKGS} capi-network-wifi-direct") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "DA") SET(CMAKE_INSTALL_PREFIX /usr) SET(APP_VENDOR "samsung") SET(APP_NAME mobileap-agent) SET(APP_DIR ${CMAKE_INSTALL_PREFIX}/bin) SET(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${INCLUDE_DIR} ${CMAKE_SOURCE_DIR}) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED ${PKGS}) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -D_GNU_SOURCE -fPIE -Wall") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fPIE") SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIE") FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") MESSAGE("add -DTARGET") ENDIF("${ARCH}" STREQUAL "arm") IF(TIZEN_PROFILE_TV) ADD_DEFINITIONS(-DTIZEN_PROFILE_TV) ENDIF(TIZEN_PROFILE_TV) ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DVENDOR=\"${APP_VENDOR}\"") ADD_DEFINITIONS("-DAPPNAME=\"${APP_NAME}\"") ADD_DEFINITIONS("-DAPP_DIR=\"${APP_DIR}\"") IF(TIZEN_FEATURE_WLAN_BOARD_SPRD) ADD_DEFINITIONS(-DTIZEN_FEATURE_WLAN_BOARD_SPRD) ENDIF(TIZEN_FEATURE_WLAN_BOARD_SPRD) IF(TIZEN_FEATURE_MULTICAST) ADD_DEFINITIONS(-DTIZEN_FEATURE_MULTICAST) ENDIF(TIZEN_FEATURE_MULTICAST) IF(TIZEN_FEATURE_ENABLE_IPV6) ADD_DEFINITIONS(-DTIZEN_FEATURE_ENABLE_IPV6) ENDIF(TIZEN_FEATURE_ENABLE_IPV6) IF(TIZEN_FEATURE_HEADLESS) ADD_DEFINITIONS(-DTIZEN_FEATURE_HEADLESS) ENDIF(TIZEN_FEATURE_HEADLESS) IF(TIZEN_FEATURE_ENABLE_WIFI_DIRECT) ADD_DEFINITIONS(-DTIZEN_FEATURE_ENABLE_WIFI_DIRECT) ENDIF(TIZEN_FEATURE_ENABLE_WIFI_DIRECT) IF(TIZEN_DA) ADD_DEFINITIONS(-DTIZEN_DA) ENDIF(TIZEN_DA) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie") ADD_CUSTOM_COMMAND( WORKING_DIRECTORY OUTPUT ${CMAKE_BINARY_DIR}/mobileap-agent-server-stub.c COMMAND gdbus-codegen --interface-prefix org.tizen. --generate-c-code mobileap-agent-server-stub --c-generate-object-manager --generate-docbook generated-docs ${INCLUDE_DIR}/tethering-dbus-interface.xml ${INCLUDE_DIR}/softap-dbus-interface.xml COMMENT "Generating GDBus .c/.h") ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS} ${CMAKE_BINARY_DIR}/mobileap-agent-server-stub.c) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobileap-agent-cmd.sh DESTINATION /usr/bin/) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tethering_dump.sh DESTINATION /opt/etc/dump.d/module.d/) REMOVE_DEFINITIONS(-DTIZEN_FEATURE_UNITTEST) IF(BUILD_GTESTS) ADD_DEFINITIONS(-DTIZEN_FEATURE_UNITTEST) ADD_SUBDIRECTORY(unittest) ENDIF(BUILD_GTESTS)