aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-15 07:32:44 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-15 07:41:45 +0200
commitc31a89a3b56e7d081178e09cc58add5c5b84a91a (patch)
tree4b547f0c347679fa6b3f118f1ba6a231c58010f1 /cmake
parentUpdate CMakeLists option names (diff)
downloadsmolbote-c31a89a3b56e7d081178e09cc58add5c5b84a91a.tar.xz
Rewrite vendor.cmake to cmake/VendorConfig.cmake
Add menuconfig-editable .config files to platforms. VendorConfig.cmake looks for and includes .config files based on platform name.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/VendorConfig.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/cmake/VendorConfig.cmake b/cmake/VendorConfig.cmake
new file mode 100644
index 0000000..42e72c8
--- /dev/null
+++ b/cmake/VendorConfig.cmake
@@ -0,0 +1,49 @@
+string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME)
+
+if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config")
+ message(FATAL_ERROR "No vendor config for ${SYSTEM_NAME}: ${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config is missing")
+endif()
+
+# the .config has been found
+
+# read .config entries that start with CONFIG_ to a list of strings
+file(STRINGS ${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config vendor_config REGEX "^CONFIG_")
+
+# for every item in the list, turn it into a list and set it
+foreach(item IN LISTS vendor_config)
+ #message("${item}")
+ string(REPLACE "\"" "" item ${item})
+ string(REGEX REPLACE "(^CONFIG_[^=]*)=(.*$)" "\\1;\\2" item_list ${item})
+ #message("${item_list}")
+ set(${item_list})
+endforeach()
+
+# Compiler settings
+# Compiler flags
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CONFIG_CXX_FLAGS} ${CONFIG_CXX_FLAGS_DEBUG}")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CONFIG_CXX_FLAGS} ${CONFIG_CXX_FLAGS_RELEASE}")
+
+# Install paths
+set(CMAKE_INSTALL_PREFIX ${CONFIG_INSTALL_PREFIX})
+
+## Version information, used in src/version.h.in
+if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
+ execute_process(COMMAND git rev-list --count HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerShortId OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+set(poi_Version "r${VerRevision}" CACHE STRING "Short version string")
+set(poi_Describe "r${VerRevision}-${VerShortId}" CACHE STRING "Long version string")
+set(poi_Build "${VerBranch}-${VerCommit}" CACHE STRING "Build string")
+
+# linking to libc++ doesn't work
+if (CONFIG_LLVMLIBCPP)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
+endif (CONFIG_LLVMLIBCPP)
+
+if(CONFIG_QTWARNINGS)
+ add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900)
+endif(CONFIG_QTWARNINGS)