diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-10-20 15:14:24 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-10-20 15:14:24 +0200 |
commit | 88492823826b3720be4ba29d246848031418bfb5 (patch) | |
tree | 4f17cc7f4ef3f76f869a1d4fcb94722464aa9d0b /cmake | |
parent | Hostlist test: test non-empty domain (diff) | |
download | smolbote-88492823826b3720be4ba29d246848031418bfb5.tar.xz |
Add Kconfiglib to parse Kconfig/.config
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/VendorConfig.cmake | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/cmake/VendorConfig.cmake b/cmake/VendorConfig.cmake index 1e12b33..c4f3ce9 100644 --- a/cmake/VendorConfig.cmake +++ b/cmake/VendorConfig.cmake @@ -1,3 +1,5 @@ +find_package(PythonInterp 3.2 REQUIRED) + string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME) if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config") @@ -5,28 +7,34 @@ if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config") 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}) +add_custom_target(config_header + BYPRODUCTS "${PROJECT_BINARY_DIR}/include/config.h" + COMMAND ${CMAKE_COMMAND} -E env "srctree=${PROJECT_SOURCE_DIR}" + ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/Kconfiglib/genconfig.py" "--header-path=${PROJECT_BINARY_DIR}/include/config.h" "${PROJECT_SOURCE_DIR}/src/Kconfig" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}") + +function(config KEY KCONFIG) +execute_process( + COMMAND ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/config.py" "--kconfig=${PROJECT_SOURCE_DIR}/${KCONFIG}" "--dotconfig=${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config" ${KEY} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE output OUTPUT_STRIP_TRAILING_WHITESPACE) + set("CONFIG_${KEY}" ${output} PARENT_SCOPE) +endfunction() + +config("POI_NAME" "src/Kconfig") +config("POI_EXE" "src/Kconfig") + +config("INSTALL_BINDIR" "Kconfig") +config("INSTALL_LIBDIR" "Kconfig") +config("INSTALL_PLUGINDIR" "Kconfig") + +# QTBUG defines +execute_process( + COMMAND ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/config.py" "--kconfig=${PROJECT_SOURCE_DIR}/src/Kconfig" "--dotconfig=${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config" "QTBUG" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE QTBUGS OUTPUT_STRIP_TRAILING_WHITESPACE) +foreach(bug IN LISTS QTBUGS) + set(${bug} CACHE STRING "${bug} workaround") 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 -if(NOT CONFIG_INSTALL_PREFIX STREQUAL "") - set(CMAKE_INSTALL_PREFIX ${CONFIG_INSTALL_PREFIX}) -endif() ## Version information, used in src/version.h.in if (EXISTS "${PROJECT_SOURCE_DIR}/.git") @@ -39,13 +47,3 @@ 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) |