find_package(PythonInterp 3.2 REQUIRED) 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() # there is a .config in ${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config 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") config("INSTALL_APPDIR" "Kconfig") config("INSTALL_ICONDIR" "Kconfig") add_custom_command(OUTPUT "${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}") add_custom_target(config_header DEPENDS "${PROJECT_BINARY_DIR}/include/config.h") # 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() ## 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")