blob: bb88eec83a294cdb35bafe4039e4af7e405f772f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
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 make_directory "${PROJECT_BINARY_DIR}/include"
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")
|