File tree Expand file tree Collapse file tree 3 files changed +19
-15
lines changed Expand file tree Collapse file tree 3 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,9 @@ include(CMakePackageConfigHelpers)
9
9
include (GNUInstallDirs)
10
10
include (QmluicMacros)
11
11
12
- find_program (CARGO_COMMAND cargo DOC "cargo command" REQUIRED)
13
- set (CARGO_BUILD_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR} /target" CACHE PATH "cargo build directory" )
12
+ set (CARGO_BUILD_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR} /target" )
14
13
15
- # Use the up-to-date version of the qmluic command.
16
- set (QMLUIC_COMMAND ${CARGO_COMMAND} run $<$<CONFIG:Release>:--release> --)
14
+ set (QMLUIC_COMMAND "${CARGO_BUILD_TARGET_DIR} /$<IF:$<CONFIG:Release>,release,debug>/qmluic" )
17
15
18
16
# Help Qt Creator find our type stub
19
17
set (QML_IMPORT_PATH "${CMAKE_CURRENT_BINARY_DIR} /imports" CACHE STRING "" FORCE)
@@ -34,14 +32,6 @@ endif()
34
32
35
33
add_subdirectory (uiviewer)
36
34
37
- add_custom_target (qmluic ALL
38
- COMMAND
39
- ${CARGO_COMMAND} build --workspace $<$<CONFIG:Release>:--release>
40
- --target -dir "${CARGO_BUILD_TARGET_DIR} "
41
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
42
- USES_TERMINAL
43
- )
44
-
45
35
qmluic_add_qmldir(qmluic.QtWidgets Qt${QT_VERSION_MAJOR} ::Widgets)
46
36
47
37
configure_package_config_file(cmake/QmluicConfig.cmake.in
Original file line number Diff line number Diff line change @@ -12,9 +12,16 @@ BUILD_TYPE = Debug
12
12
DESTDIR =
13
13
PREFIX = /usr/local
14
14
15
+ CARGO_BUILD_FLAGS =
16
+ CMAKE_FLAGS =
17
+
15
18
DEB_VERSION = 0.1~$(shell date +"% Y% m% d") .git$(shell git rev-parse --short HEAD)
16
19
QT_VERSION_MAJOR = $(word 1,$(subst ., ,$(shell $(QMAKE ) -query QT_VERSION) ) )
17
20
21
+ ifeq ($(BUILD_TYPE ) ,Release)
22
+ override CARGO_BUILD_FLAGS += --release
23
+ endif
24
+
18
25
ifneq ($(shell command -v $(NINJA ) 2>/dev/null) ,)
19
26
CMAKE_FLAGS += -GNinja
20
27
endif
36
43
@echo ' build-examples - generate .ui from example .qml files and build them'
37
44
@echo
38
45
@echo ' Make variables:'
46
+ @echo ' BUILD_TYPE=$(BUILD_TYPE)'
47
+ @echo ' CARGO_BUILD_FLAGS=$(CARGO_BUILD_FLAGS)'
39
48
@echo ' CMAKE_FLAGS=$(CMAKE_FLAGS)'
40
49
@echo ' QT_VERSION_MAJOR=$(QT_VERSION_MAJOR)'
41
50
@@ -50,6 +59,7 @@ release:
50
59
.PHONY : build
51
60
build :
52
61
mkdir -p $(BUILD_DIR )
62
+ $(CARGO ) build $(CARGO_BUILD_FLAGS ) --workspace
53
63
cd $(BUILD_DIR ) && $(CMAKE ) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE ) \
54
64
-DCMAKE_INSTALL_PREFIX=$(PREFIX ) $(CMAKE_FLAGS ) $(CURDIR )
55
65
$(CMAKE ) --build $(BUILD_DIR ) --config $(BUILD_TYPE )
@@ -78,7 +88,7 @@ format:
78
88
.PHONY : tests
79
89
tests :
80
90
$(CARGO ) clippy
81
- $(CARGO ) test --workspace
91
+ $(CARGO ) test $( CARGO_BUILD_FLAGS ) --workspace
82
92
83
93
.PHONY : build-examples
84
94
build-examples : BUILD_DIR = target/build-examples
Original file line number Diff line number Diff line change @@ -126,8 +126,12 @@ Optional requirements for previewer and type stubs:
126
126
- CMake
127
127
- Qt 5.15 or 6.2+
128
128
129
- If you have all requirements installed, use CMake (or GNU Make) to build
130
- and install everything.
129
+ If you have all requirements installed, use Cargo and CMake to build/install
130
+ the binaries and data. There's a GNU Make wrapper to automate the build steps.
131
+
132
+ ```
133
+ $ make release install
134
+ ```
131
135
132
136
If you just need to build the ` qmluic ` frontend, simply run
133
137
` cargo build --release --workspace ` .
You can’t perform that action at this time.
0 commit comments