summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-xCMakeLists.txt68
1 files changed, 68 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..bbf3df8
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,68 @@
+project(wifi-settings)
+
+cmake_minimum_required(VERSION 3.3)
+
+include(GNUInstallDirs)
+
+set(PROJECT_VERSION "0.1")
+set(PROJECT_ICON "icon_wifi_128.png")
+set(PROJECT_LIBDIR "lib")
+set(PROJECT_QML "qml")
+set(PROJECT_IMPORT "imports")
+set(PROJECT_DOC "doc")
+
+set(CMAKE_BUILD_TYPE Debug)
+
+###########################################################################
+add_compile_options(-Wall -Wextra -Wconversion)
+add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
+add_compile_options(-Werror=maybe-uninitialized)
+add_compile_options(-Werror=implicit-function-declaration)
+add_compile_options(-ffunction-sections -fdata-sections)
+add_compile_options(-Wl,--as-needed -Wl,--gc-sections)
+add_compile_options(-fPIC)
+
+set(CMAKE_C_FLAGS_PROFILING "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
+set(CMAKE_C_FLAGS_DEBUG "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
+set(CMAKE_C_FLAGS_RELEASE "-g -O2")
+set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
+
+###########################################################################
+
+include(FindPkgConfig)
+
+pkg_check_modules(EXTRAS REQUIRED json-c afb-daemon glib-2.0 gio-2.0 gobject-2.0 zlib)
+add_compile_options(${EXTRAS_CFLAGS})
+include_directories(${EXTRAS_INCLUDE_DIRS})
+link_libraries(${EXTRAS_LIBRARIES})
+
+###########################################################################
+# the binding for afb
+
+message(STATUS "Creation of ${PROJECT_NAME} for AFB-DAEMON")
+
+###############################################################
+add_library(${PROJECT_NAME} MODULE wifi-api.c wifi-connman.c agent.c)
+
+set_target_properties(${PROJECT_NAME} PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+)
+
+configure_file(config.xml.in config.xml)
+
+add_custom_command(
+ OUTPUT ${PROJECT_NAME}.wgt
+ DEPENDS ${PROJECT_NAME}
+ COMMAND rm -rf package
+ COMMAND mkdir -p package/${PROJECT_LIBDIR} package/htdocs
+ COMMAND cp config.xml package/
+ COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_ICON} package/icon.png
+ COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_QML} package/${PROJECT_QML}
+ COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_IMPORT} package/${PROJECT_IMPORT}
+ COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_DOC} package/${PROJECT_DOC}
+ COMMAND cp ${PROJECT_NAME}.so package/${PROJECT_LIBDIR}
+ COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt package
+ COMMAND rm -rf package
+)
+add_custom_target(widget ALL DEPENDS ${PROJECT_NAME}.wgt)