Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Qt UI Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Design Studio
QML Viewer Projects
Qt UI Viewer
Commits
cd52da75
Verified
Commit
cd52da75
authored
4 months ago
by
Burak Hançerli
Browse files
Options
Downloads
Patches
Plain Diff
add: get rid of dummy import
parent
0f9400c0
No related branches found
No related tags found
1 merge request
!71
Remove importdummy dependency
Pipeline
#78719
passed
4 months ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/CMakeLists.txt
+74
-1
74 additions, 1 deletion
src/CMakeLists.txt
src/backend/importdummy.qml
+0
-45
0 additions, 45 deletions
src/backend/importdummy.qml
with
74 additions
and
46 deletions
src/CMakeLists.txt
+
74
−
1
View file @
cd52da75
...
...
@@ -6,8 +6,81 @@ find_package(
find_package
(
QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network WebSockets
)
set
(
imports
""
)
# Get all imported targets.
get_property
(
imported_targets DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
PROPERTY IMPORTED_TARGETS
)
# Horrible hack for shared qt builds, to ensure we bundle all known shared library qml plugins.
# Do that by finding all qml modules, their plugins, the location of the plugins, then finding the
# path to the qmldir files of the plugins, extract the module name, and adding it as an import
# statement into a dynamically generated qml file.
foreach
(
imported_target IN LISTS imported_targets
)
# Get all qml module targets, they would have the _qt_qml_module_installed_plugin_target
# property set.
get_target_property
(
qml_plugin_target
"
${
imported_target
}
"
_qt_qml_module_installed_plugin_target
)
if
(
qml_plugin_target
)
message
(
STATUS
"Imported target:
${
imported_target
}
->
${
qml_plugin_target
}
"
)
# Get location of the plugin file.
get_target_property
(
imported_location
"
${
qml_plugin_target
}
"
IMPORTED_LOCATION
)
if
(
NOT EXISTS
"
${
imported_location
}
"
)
continue
()
endif
()
# Get parent dir of the plugin file.
get_filename_component
(
imported_location_dir
"
${
imported_location
}
"
DIRECTORY
)
# Build path to qmldir in the same directory. We assume the qmldir is always next
# to the plugin file. That's at least usually the case for Qt qml plugins.
set
(
qmldir_path
"
${
imported_location_dir
}
/qmldir"
)
if
(
NOT EXISTS
"
${
qmldir_path
}
"
)
continue
()
endif
()
# Read qmldir file contents.
file
(
READ
"
${
qmldir_path
}
"
qmldir_content
)
if
(
qmldir_content STREQUAL
""
)
continue
()
endif
()
# Find the module name in the qmldir file
string
(
REGEX MATCH
"module ([^
\n
]+)"
module_match
"
${
qmldir_content
}
"
)
if
(
CMAKE_MATCH_1
)
# Add the module name as an import to the imports list
list
(
APPEND imports
"import
${
CMAKE_MATCH_1
}
"
)
endif
()
endif
()
endforeach
()
set
(
imports_file_path
"
${
CMAKE_CURRENT_BINARY_DIR
}
/dynamic_imports.qml"
)
# Needed to stop __qt_get_relative_resource_path_for_file from erroring out.
set_source_files_properties
(
"
${
imports_file_path
}
"
PROPERTIES QT_RESOURCE_ALIAS
"dynamic_imports.qml"
)
if
(
imports
)
list
(
REMOVE_DUPLICATES imports
)
string
(
REPLACE
";"
"
\n
"
imports
"
${
imports
}
"
)
endif
()
# Use file(GENERATE) to prevent touching the file if the contents hasn't changed.
set
(
dummy_valid_content
"ApplicationWindow {
visible: true
width: 640
height: 480
}"
)
file
(
GENERATE OUTPUT
"
${
imports_file_path
}
"
CONTENT
"
${
imports
}
${
dummy_valid_content
}
"
)
qt_add_executable
(
${
PROJECT_NAME
}
backend/importdummy.qml
# backend/importdummy.qml
"
${
imports_file_path
}
"
backend/main.cpp
backend/logger.h
backend/backend.cpp backend/backend.h
...
...
This diff is collapsed.
Click to expand it.
src/backend/importdummy.qml
deleted
100644 → 0
+
0
−
45
View file @
0f9400c0
// Hack to force the qml plugins to be linked statically
import
QtQuick
import
QtQuick
.
Controls
import
QtQml
import
QtQml
.
Models
import
QtQml
.
StateMachine
import
QtQuick3D
import
QtQuick3D
.
AssetUtils
import
QtQuick3D
.
Effects
import
QtQuick3D
.
Helpers
import
QtQuick3D
.
ParticleEffects
import
QtQuick3D
.
Particles3D
import
QtQuick
.
VirtualKeyboard
import
QtQuick
.
Studio
.
Application
import
QtQuick
.
Studio
.
Components
import
QtQuick
.
Studio
.
Effects
import
QtQuick
.
Studio
.
EventSimulator
import
QtQuick
.
Studio
.
EventSystem
import
QtQuick
.
Studio
.
LogicHelper
import
QtQuick
.
Studio
.
MultiText
import
QtQuick
.
Studio
.
Utils
import
QtQuick
.
Studio
.
DesignEffects
import
QtQuick
.
Timeline
import
QtQuick
.
Timeline
.
BlendTrees
import
QtQuickUltralite
.
Extras
import
QtQuickUltralite
.
Layers
import
QtCharts
import
FlowView
import
Qt
.
labs
.
folderlistmodel
import
QtWebSockets
ApplicationWindow
{
visible
:
true
width
:
640
height
:
480
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment