summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2019-09-17 11:43:34 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2019-09-23 11:45:12 +0000
commit902dfced06b73b92ae6cb9adc7a51acff0bcc936 (patch)
tree891ec1cabccf906bf9527b1a8278228185af596a
parentd87b0adb32e7ed1d897670b59d7ebbb7c504c75c (diff)
downloadqtwebchannel-902dfced06b73b92ae6cb9adc7a51acff0bcc936.tar.gz
Add cmake support
Fixes: QTBUG-78190 Change-Id: Ibdfbcb479ce1af6370b9148516cef6f64e7c1abb Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--CMakeLists.txt13
-rw-r--r--coin/module_config.yaml13
-rw-r--r--examples/CMakeLists.txt7
-rw-r--r--examples/webchannel/CMakeLists.txt18
-rw-r--r--examples/webchannel/chatserver-cpp/CMakeLists.txt34
-rw-r--r--examples/webchannel/standalone/CMakeLists.txt45
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/imports/CMakeLists.txt3
-rw-r--r--src/imports/webchannel/CMakeLists.txt26
-rw-r--r--src/imports/webchannel/webchannel.pro1
-rw-r--r--src/webchannel/CMakeLists.txt64
-rw-r--r--src/webchannel/webchannel.pro3
-rw-r--r--tests/CMakeLists.txt13
-rw-r--r--tests/auto/CMakeLists.txt10
-rw-r--r--tests/auto/qml/CMakeLists.txt38
-rw-r--r--tests/auto/webchannel/CMakeLists.txt28
16 files changed, 322 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..ed69eb2
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.15.0)
+
+project(QtWebChannel
+ VERSION 6.0.0
+ DESCRIPTION "Qt WebChannel Libraries"
+ HOMEPAGE_URL "https://qt.io/"
+ LANGUAGES CXX C
+)
+
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
+find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Quick Test QuickTest WebSockets)
+
+qt_build_repo()
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
new file mode 100644
index 0000000..9f29e11
--- /dev/null
+++ b/coin/module_config.yaml
@@ -0,0 +1,13 @@
+version: 1
+accept_configuration:
+ condition: property
+ property: host.os
+ equals_property: target.os
+
+build_instructions:
+ - !include "{{qt/qtbase}}/prepare_building_env.yaml"
+ - !include "{{qt/qtbase}}/cmake_module_build_instructions.yaml"
+ - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml"
+
+test_instructions:
+ - !include "{{qt/qtbase}}/cmake_regular_test_instructions.yaml"
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..4138540
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Generated from examples.pro.
+
+qt_examples_build_begin()
+
+add_subdirectory(webchannel)
+
+qt_examples_build_end()
diff --git a/examples/webchannel/CMakeLists.txt b/examples/webchannel/CMakeLists.txt
new file mode 100644
index 0000000..78c2fb6
--- /dev/null
+++ b/examples/webchannel/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from webchannel.pro.
+
+# special case begin
+# These are all TEMPLATE = aux
+#add_subdirectory(nodejs)
+#add_subdirectory(qwclient)
+#add_subdirectory(chatclient-html)
+# special case end
+if(TARGET Qt::WebSockets)
+ add_subdirectory(chatserver-cpp)
+ # special case begin
+ # This one is TEMPLATE = aux too
+ #add_subdirectory(chatclient-qml)
+ # special case end
+endif()
+if(TARGET Qt::WebSockets AND TARGET Qt::Widgets)
+ add_subdirectory(standalone)
+endif()
diff --git a/examples/webchannel/chatserver-cpp/CMakeLists.txt b/examples/webchannel/chatserver-cpp/CMakeLists.txt
new file mode 100644
index 0000000..afca841
--- /dev/null
+++ b/examples/webchannel/chatserver-cpp/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Generated from chatserver-cpp.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(chatserver LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+set(INSTALL_EXAMPLEDIR "examples")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS WebSockets)
+find_package(Qt6 COMPONENTS WebChannel)
+
+add_executable(chatserver
+ ../shared/websocketclientwrapper.cpp ../shared/websocketclientwrapper.h
+ ../shared/websockettransport.cpp ../shared/websockettransport.h
+ chatserver.cpp chatserver.h
+ main.cpp
+)
+target_link_libraries(chatserver PUBLIC
+ Qt::Core
+ Qt::WebChannel
+ Qt::WebSockets
+)
+
+install(TARGETS chatserver
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/webchannel/standalone/CMakeLists.txt b/examples/webchannel/standalone/CMakeLists.txt
new file mode 100644
index 0000000..c915378
--- /dev/null
+++ b/examples/webchannel/standalone/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Generated from standalone.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(standalone LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+set(INSTALL_EXAMPLEDIR "examples")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS WebChannel)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS WebSockets)
+
+add_qt_gui_executable(standalone
+ ../shared/websocketclientwrapper.cpp ../shared/websocketclientwrapper.h
+ ../shared/websockettransport.cpp ../shared/websockettransport.h
+ core.h
+ dialog.cpp dialog.h dialog.ui
+ main.cpp
+)
+# special case begin
+# pro2cmake generates invalid cmake syntax here
+target_compile_definitions(standalone PUBLIC
+ "BUILD_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\""
+)
+# special case end
+target_link_libraries(standalone PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::WebChannel
+ Qt::WebSockets
+ Qt::Widgets
+)
+
+install(TARGETS standalone
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..a80a886
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Generated from src.pro.
+
+add_subdirectory(webchannel)
+if(TARGET Qt::Quick)
+ add_subdirectory(imports)
+endif()
diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt
new file mode 100644
index 0000000..6c0c9ae
--- /dev/null
+++ b/src/imports/CMakeLists.txt
@@ -0,0 +1,3 @@
+# Generated from imports.pro.
+
+add_subdirectory(webchannel)
diff --git a/src/imports/webchannel/CMakeLists.txt b/src/imports/webchannel/CMakeLists.txt
new file mode 100644
index 0000000..fa48b81
--- /dev/null
+++ b/src/imports/webchannel/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Generated from webchannel.pro.
+
+#####################################################################
+## webchannel Plugin:
+#####################################################################
+
+add_qml_module(declarative_webchannel # special case
+ URI "QtWebChannel"
+ VERSION "1.${CMAKE_PROJECT_VERSION_MINOR}"
+ CLASSNAME QWebChannelPlugin
+ SOURCES
+ plugin.cpp
+ INCLUDE_DIRECTORIES
+ ../../webchannel
+ LIBRARIES
+ Qt::WebChannelPrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Quick
+ Qt::WebChannel
+)
+
+#### Keys ignored in scope 1:.:.:webchannel.pro:<TRUE>:
+# IMPORT_VERSION = "1.$$QT_MINOR_VERSION"
+# TARGETPATH = "QtWebChannel"
+# _LOADED = "qml_plugin"
diff --git a/src/imports/webchannel/webchannel.pro b/src/imports/webchannel/webchannel.pro
index fd69605..2141cd8 100644
--- a/src/imports/webchannel/webchannel.pro
+++ b/src/imports/webchannel/webchannel.pro
@@ -4,6 +4,7 @@ INCLUDEPATH += ../../webchannel
VPATH += ../../webchannel
IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+TARGETPATH = QtWebChannel
SOURCES += \
plugin.cpp
diff --git a/src/webchannel/CMakeLists.txt b/src/webchannel/CMakeLists.txt
new file mode 100644
index 0000000..4f7f940
--- /dev/null
+++ b/src/webchannel/CMakeLists.txt
@@ -0,0 +1,64 @@
+# Generated from webchannel.pro.
+
+#####################################################################
+## WebChannel Module:
+#####################################################################
+
+add_qt_module(WebChannel
+ SOURCES
+ qmetaobjectpublisher.cpp qmetaobjectpublisher_p.h
+ qwebchannel.cpp qwebchannel.h qwebchannel_p.h
+ qwebchannelabstracttransport.cpp qwebchannelabstracttransport.h
+ signalhandler_p.h
+ variantargument_p.h
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+# Resources:
+set_source_files_properties("../../examples/webchannel/shared/qwebchannel.js"
+ PROPERTIES QT_RESOURCE_ALIAS "qwebchannel.js"
+)
+set(resources_resource_files
+ "../../examples/webchannel/shared/qwebchannel.js"
+)
+
+set_source_files_properties(${resources_resource_files} PROPERTIES QT_SKIP_QUICKCOMPILER 1)
+
+add_qt_resource(WebChannel "resources"
+ PREFIX
+ "/qtwebchannel/"
+ FILES
+ ${resources_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:webchannel.pro:<TRUE>:
+# OTHER_FILES = "qwebchannel.js"
+# _LOADED = "qt_module"
+
+## Scopes:
+#####################################################################
+
+extend_target(WebChannel CONDITION TARGET Qt::Qml
+ SOURCES
+ qqmlwebchannel.cpp
+ qqmlwebchannelattached.cpp
+ PUBLIC_LIBRARIES
+ Qt::Qml
+)
+
+#### Keys ignored in scope 2:.:.:webchannel.pro:TARGET Qt::Qml:
+# PRIVATE_HEADERS = "qqmlwebchannelattached_p.h"
+# PUBLIC_HEADERS = "qqmlwebchannel.h"
+
+extend_target(WebChannel CONDITION NOT TARGET Qt::Qml
+ DEFINES
+ QT_NO_JSVALUE
+)
+add_qt_docs(
+ doc/qtwebchannel.qdocconf
+)
+
diff --git a/src/webchannel/webchannel.pro b/src/webchannel/webchannel.pro
index 9c555e7..00e75f5 100644
--- a/src/webchannel/webchannel.pro
+++ b/src/webchannel/webchannel.pro
@@ -7,6 +7,9 @@ QMAKE_DOCS = $$PWD/doc/qtwebchannel.qdocconf
RESOURCES += \
resources.qrc
+QTQUICK_COMPILER_SKIPPED_RESOURCES += \
+ resources.qrc
+
OTHER_FILES = \
qwebchannel.js
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..6755718
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from tests.pro.
+
+# special case begin
+if(NOT TARGET Qt::Test)
+ cmake_minimum_required(VERSION 3.15.0)
+ project(QtWebChannelTests VERSION 6.0.0 LANGUAGES C CXX)
+ find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS BuildInternals Core Test WebChannel)
+ find_package(Qt6 ${PROJECT_VERSION} OPTIONAL_COMPONENTS Quick QuickTest)
+ qt_set_up_standalone_tests_build()
+endif()
+# special case end
+
+qt_build_tests()
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
new file mode 100644
index 0000000..716f70c
--- /dev/null
+++ b/tests/auto/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from auto.pro.
+
+# special case begin
+# Qt5 cmake tests
+#add_subdirectory(cmake)
+# special case end
+add_subdirectory(webchannel)
+if(TARGET Qt::Quick)
+ add_subdirectory(qml)
+endif()
diff --git a/tests/auto/qml/CMakeLists.txt b/tests/auto/qml/CMakeLists.txt
new file mode 100644
index 0000000..e49bd8c
--- /dev/null
+++ b/tests/auto/qml/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Generated from qml.pro.
+
+#####################################################################
+## qml Test:
+#####################################################################
+
+# Collect test data
+
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ "data/*")
+list(APPEND test_data ${test_data_glob})
+
+add_qt_test(qml
+ GUI
+ QMLTEST
+ QML_IMPORTPATH
+ "${CMAKE_CURRENT_BINARY_DIR}/../../../qml"
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ SOURCES
+ qml.cpp
+ testobject.cpp testobject.h
+ testtransport.cpp testtransport.h
+ testwebchannel.cpp testwebchannel.h
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebChannelPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::WebChannel
+ TESTDATA ${test_data}
+)
+
+#### Keys ignored in scope 1:.:.:qml.pro:<TRUE>:
+# DISTFILES = "tst_webchannelseparation.qml"
+# IMPORTPATH = "$$OUT_PWD/../../../qml" "$$PWD"
+# OTHER_FILES = "Client.qml" "WebChannelTest.qml" "tst_webchannel.qml" "tst_metaobjectpublisher.qml" "tst_bench.qml" "tst_multiclient.qml"
+# TEMPLATE = "app"
diff --git a/tests/auto/webchannel/CMakeLists.txt b/tests/auto/webchannel/CMakeLists.txt
new file mode 100644
index 0000000..aa040f8
--- /dev/null
+++ b/tests/auto/webchannel/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Generated from webchannel.pro.
+
+#####################################################################
+## tst_webchannel Test:
+#####################################################################
+
+add_qt_test(tst_webchannel
+ GUI
+ SOURCES
+ tst_webchannel.cpp tst_webchannel.h
+ INCLUDE_DIRECTORIES
+ ../../../src/webchannel
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebChannelPrivate
+ PUBLIC_LIBRARIES
+ Qt::WebChannel
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_webchannel CONDITION TARGET Qt::Qml
+ DEFINES
+ WEBCHANNEL_TESTS_CAN_USE_JS_ENGINE
+ PUBLIC_LIBRARIES
+ Qt::Qml
+)