1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 SET(PACKAGE ${PROJECT_NAME})
4 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
5 SET(BINDIR "${PREFIX}/bin")
6 SET(DATADIR "${PREFIX}/share")
7 SET(LIBDIR "${PREFIX}/${LIB_PATH}")
8 SET(INTERFACES "${CMAKE_SOURCE_DIR}/interfaces")
37 src/network-statistics.c
38 src/dbus/netsupplicant.c
39 src/wifi-background-scan.c
43 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
44 SET(CMAKE_BUILD_TYPE "Release")
45 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
46 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
48 IF(TIZEN_WLAN_PASSPOINT)
49 ADD_DEFINITIONS(-DTIZEN_WLAN_PASSPOINT)
50 ENDIF(TIZEN_WLAN_PASSPOINT)
52 IF(TIZEN_WLAN_USE_P2P_INTERFACE)
53 ADD_DEFINITIONS(-DTIZEN_WLAN_USE_P2P_INTERFACE)
54 ENDIF(TIZEN_WLAN_USE_P2P_INTERFACE)
57 ADD_DEFINITIONS(-DTIZEN_P2P_ENABLE)
58 ENDIF(TIZEN_P2P_ENABLE)
60 IF(TIZEN_TETHERING_ENABLE)
61 ADD_DEFINITIONS(-DTIZEN_TETHERING_ENABLE)
62 ENDIF(TIZEN_TETHERING_ENABLE)
64 IF(TIZEN_CAPTIVE_PORTAL)
65 ADD_DEFINITIONS(-DTIZEN_CAPTIVE_PORTAL)
66 SET(SRCS ${SRCS} src/utils/network-accessibility.c)
67 ENDIF(TIZEN_CAPTIVE_PORTAL)
70 ADD_DEFINITIONS(-DTIZEN_WEARABLE)
73 INCLUDE(FindPkgConfig)
74 PKG_CHECK_MODULES(pkgs REQUIRED
83 ${WEARABLE_REQUIRED_PKGS}
86 FOREACH(flag ${pkgs_CFLAGS})
87 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
90 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -fvisibility=hidden")
91 SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -Wall -Werror -fvisibility=hidden -fvisibility-inlines-hidden")
92 SET(CMAKE_C_FLAGS "-I${CMAKE_SOURCE_DIR} -I${CMAKE_SOURCE_DIR}/include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
93 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fPIE")
94 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIE")
96 IF(WLAN_CONCURRENT_MODE)
97 ADD_DEFINITIONS(-DWLAN_CONCURRENT_MODE)
98 ENDIF(WLAN_CONCURRENT_MODE)
100 FIND_PROGRAM(UNAME NAMES uname)
101 EXEC_PROGRAM("${UNAME}" ARGS "-m"
102 OUTPUT_VARIABLE "ARCH")
103 IF("${ARCH}" STREQUAL "arm")
104 ADD_DEFINITIONS("-DTARGET_ARM")
105 MESSAGE("add -DTARGET_ARM")
106 ENDIF("${ARCH}" STREQUAL "arm")
108 ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
109 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
111 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
115 OUTPUT ${CMAKE_SOURCE_DIR}/generated-code.c
116 COMMAND gdbus-codegen --interface-prefix net.netconfig.
117 --generate-c-code generated-code
118 --c-generate-object-manager
119 --generate-docbook generated-code-docs
120 ${INTERFACES}/netconfig-iface-network-state.xml ${INTERFACES}/netconfig-iface-network-statistics.xml ${INTERFACES}/netconfig-iface-wifi.xml ${INTERFACES}/netconfig-iface-vpnsvc.xml
121 COMMENT "Generating GDBus .c/.h")
123 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS} ${CMAKE_SOURCE_DIR}/generated-code.c)
125 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${PCAP_LIB} "-ldl")
127 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
128 INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/security-network-config.conf DESTINATION /usr/lib/tmpfiles.d/)
130 ADD_SUBDIRECTORY(plugin/headed)
131 ADD_SUBDIRECTORY(plugin/telephony)