diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-12 15:27:58 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-12 15:28:15 +0100 |
commit | 8592ae4096f3f9c2b08b87ad2fcbbbfadf75f2d7 (patch) | |
tree | a757c1d80ec77952eae2cc4de5d89c01f14760fc /cmake | |
parent | e7decc7637e9eb7e66a0d19705090f18488028c0 (diff) | |
parent | 14492ecee2e34843efd3ef070503a43a48552055 (diff) |
Merge remote-tracking branch 'origin/wip/cmake' into dev
Conflicts:
dependencies.yaml
Change-Id: Ifff48b9d0e7962d481e63c49399e2d304e1011e5
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtDeclarativeSetup.cmake | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cmake/QtDeclarativeSetup.cmake b/cmake/QtDeclarativeSetup.cmake new file mode 100644 index 0000000000..2cd6f56127 --- /dev/null +++ b/cmake/QtDeclarativeSetup.cmake @@ -0,0 +1,48 @@ +# Generates a header file with a hash. +function(qt_declarative_write_tag_header target_name) + set(tag_file "${CMAKE_CURRENT_SOURCE_DIR}/../../.tag") + set(tag_contents "") + if(EXISTS "${tag_file}") + file(READ "${tag_file}" tag_contents) + endif() + if(NOT tag_file STREQUAL "$Format:%H$") + set(QML_COMPILE_HASH "${tag_contents}") + string(STRIP "${QML_COMPILE_HASH}" QML_COMPILE_HASH) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../.git") + execute_process( + COMMAND git rev-parse HEAD + OUTPUT_VARIABLE QML_COMPILE_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + string(LENGTH "${QML_COMPILE_HASH}" QML_COMPILE_HASH_LENGTH) + set(compile_hash_contents "// Generated file, DO NOT EDIT + #define QML_COMPILE_HASH \"${QML_COMPILE_HASH}\" + #define QML_COMPILE_HASH_LENGTH ${QML_COMPILE_HASH_LENGTH}" + ) + set(compile_hash_output_path "${CMAKE_CURRENT_BINARY_DIR}/qml_compile_hash_p.h") + file(GENERATE OUTPUT "${compile_hash_output_path}" + CONTENT "${compile_hash_contents}") +endfunction() + +find_package(PythonInterp REQUIRED) + +# Generate a header file containing a regular expression jit table. +function(qt_declarative_generate_reg_exp_jit_tables consuming_target) + set(generate_dir "${CMAKE_CURRENT_BINARY_DIR}/.generated") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + string(APPEND generate_dir "/debug") + elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + string(APPEND generate_dir "/release") + endif() + + set(output_file "${generate_dir}/RegExpJitTables.h") + set(retgen_script_file "${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/masm/yarr/create_regex_tables") + + add_custom_command( + OUTPUT "${output_file}" + COMMAND "${PYTHON_EXECUTABLE}" ${retgen_script_file} ${output_file} + MAIN_DEPENDENCY ${retgen_script_file} + ) + target_sources(${consuming_target} PRIVATE ${output_file}) + target_include_directories(${consuming_target} PRIVATE $<BUILD_INTERFACE:${generate_dir}>) +endfunction() |