summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-05-05 15:58:58 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2021-05-12 17:30:51 +0200
commit9ee8491056c110802868edad7201e5a8befe5b52 (patch)
treed68d1b52efa9f7f0cc0bc3855be1b7d3bf9d7d75
parent8efbb75d1554395089d60ec25283ecbcbf1c5a23 (diff)
Add support of the type library UUID
dumpcpp supports generating of the sources using the type library UUID. Add syntax that provides this functionality to the qt6_target_typelibs users. Modify the qutlook library to use the new syntax. Amends da3a24c06541b63011a3af91fbae9f9d2ec28912. Fixes: QTBUG-93446 Change-Id: Ic0b657bd39f57d32c3d404bee395f4f375a6d7f8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1acbc29ef950369a67256221d10867a32282412c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/activeqt/qutlook/CMakeLists.txt14
-rw-r--r--src/activeqt/container/Qt6AxContainerMacros.cmake34
2 files changed, 32 insertions, 16 deletions
diff --git a/examples/activeqt/qutlook/CMakeLists.txt b/examples/activeqt/qutlook/CMakeLists.txt
index af1de27..5e009fa 100644
--- a/examples/activeqt/qutlook/CMakeLists.txt
+++ b/examples/activeqt/qutlook/CMakeLists.txt
@@ -20,11 +20,18 @@ find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 COMPONENTS AxContainer)
+qt_add_executable(qutlook
+ addressview.cpp addressview.h
+ main.cpp
)
+
set_target_properties(qutlook PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
+qt6_target_typelibs(qutlook "msoutl:{00062FFF-0000-0000-C000-000000000046}")
+
target_link_libraries(qutlook PUBLIC
Qt::AxContainer
Qt::Core
@@ -32,13 +39,6 @@ target_link_libraries(qutlook PUBLIC
Qt::Widgets
)
-if(NOT TYPELIBS_ISEMPTY)
- target_sources(qutlook PUBLIC
- addressview.cpp addressview.h
- main.cpp
- )
-endif()
-
install(TARGETS qutlook
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/src/activeqt/container/Qt6AxContainerMacros.cmake b/src/activeqt/container/Qt6AxContainerMacros.cmake
index 4e90943..82a0745 100644
--- a/src/activeqt/container/Qt6AxContainerMacros.cmake
+++ b/src/activeqt/container/Qt6AxContainerMacros.cmake
@@ -8,6 +8,10 @@
# CMake find_file function rules. See https://cmake.org/cmake/help/latest/command/find_file.html
# for details.
# Note: The library name must include a file suffix, e.g "ieframe.dll".
+# LIBRARIES also may contain the library UUID in the following format:
+# <generated_files_basename>:<{00000000-0000-0000-0000-000000000000}>
+# The 'generated_files_basename' may contain ASCII letters, numbers and underscores and will be
+# used as the base name for the generated files.
#
# OUTPUT_DIRECTORY: Custom location of the generated source files.
# ${CMAKE_CURRENT_BINARY_DIR} is the default location if not specified. (OPTIONAL)
@@ -34,22 +38,34 @@ function(qt6_target_typelibs target)
endif()
set(out_sources "")
+ set(hex "[a-fA-F0-9]")
+ set(ident_ "[a-fA-F0-9_]")
foreach(lib IN LISTS arg_LIBRARIES)
unset(libpath CACHE)
- # If lib exists on the filesystem, we assume the user provided the path.
- get_filename_component(lib_abspath "${lib}" ABSOLUTE)
- if(EXISTS "${lib_abspath}")
- set(libpath "${lib_abspath}")
+ if(lib MATCHES "^(${ident_}+):(\\{${hex}{8}-${hex}{4}-${hex}{4}-${hex}{4}-${hex}{12}\\})$")
+ set(libpath "${CMAKE_MATCH_2}")
+ set(out_basename "${CMAKE_MATCH_1}")
+ string(MAKE_C_IDENTIFIER "${out_basename}" out_basename_valid)
+ if(NOT "${out_basename_valid}" STREQUAL "${out_basename}")
+ message("The specified generated files basename ${out_basename} is not valid\
+C indentifier")
+ endif()
else()
- find_file(libpath NAMES "${lib}")
- if(NOT libpath)
- message(FATAL_ERROR "qt6_target_typelibs: Unable to find type lib with name ${lib}")
+ # If lib exists on the filesystem, we assume the user provided the path.
+ get_filename_component(lib_abspath "${lib}" ABSOLUTE)
+ if(EXISTS "${lib_abspath}")
+ set(libpath "${lib_abspath}")
+ else()
+ find_file(libpath NAMES "${lib}")
+ if(NOT libpath)
+ message(FATAL_ERROR "qt6_target_typelibs: Unable to find type lib with name ${lib}")
+ endif()
endif()
+
+ get_filename_component(out_basename "${libpath}" NAME_WE)
endif()
- get_filename_component(out_basename "${libpath}" NAME_WE)
set(out_filebasepath "${output_directory}/${out_basename}")
-
set(out_header "${out_filebasepath}.h")
set_source_files_properties("${out_header}" PROPERTIES HEADER_FILE_ONLY TRUE)
set(out_source "${out_filebasepath}.cpp")