aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-05-24 15:35:20 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-06-03 11:03:46 +0000
commit6c69a6ab7c61d03150ed2e58725c3a61a443fdc0 (patch)
treed6afabf14cc77b22b01b0a4f3e484ac83be31271 /cmake
parent677d336def1686d0d6d8f6d55bf8e2686ed27e07 (diff)
Initial CMake port
Crude port of QtQml, QtQmlModels, QtQuick and a few tests and a few examples. Task-number: QTBUG-74136 Change-Id: I5de4d8215b33d1a4a72c2c0e7951e4b384f27e3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtDeclarativeSetup.cmake47
1 files changed, 47 insertions, 0 deletions
diff --git a/cmake/QtDeclarativeSetup.cmake b/cmake/QtDeclarativeSetup.cmake
new file mode 100644
index 0000000000..91c1a3fc01
--- /dev/null
+++ b/cmake/QtDeclarativeSetup.cmake
@@ -0,0 +1,47 @@
+# 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()
+
+
+# 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 ${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()