Changeset View
Changeset View
Standalone View
Standalone View
examples/todos/CMakeLists.txt
Show All 19 Lines | |||||
20 | include(FeatureSummary) | 20 | include(FeatureSummary) | ||
21 | find_package(Cargo REQUIRED) | 21 | find_package(Cargo REQUIRED) | ||
22 | find_package(Rust REQUIRED) | 22 | find_package(Rust REQUIRED) | ||
23 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE) | 23 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE) | ||
24 | find_package(Threads REQUIRED) | 24 | find_package(Threads REQUIRED) | ||
25 | 25 | | |||
26 | set(QT_MIN_VERSION "5.6.0") | 26 | set(QT_MIN_VERSION "5.6.0") | ||
27 | find_package(Qt5 ${QT_MIN_VERSION} CONFIG | 27 | find_package(Qt5 ${QT_MIN_VERSION} CONFIG | ||
28 | REQUIRED COMPONENTS Core Quick Widgets | 28 | REQUIRED COMPONENTS Core Quick | ||
29 | ) | 29 | ) | ||
30 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | 30 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
31 | set(CMAKE_AUTOMOC ON) | 31 | set(CMAKE_AUTOMOC ON) | ||
32 | set(CMAKE_AUTOUIC ON) | | |||
33 | set(CMAKE_AUTORCC ON) | 32 | set(CMAKE_AUTORCC ON) | ||
34 | find_package(RustQtBindingGenerator REQUIRED) | 33 | find_package(RustQtBindingGenerator REQUIRED) | ||
35 | 34 | | |||
36 | feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) | 35 | feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) | ||
37 | 36 | | |||
38 | ### build commands ### | 37 | ### build commands ### | ||
39 | 38 | | |||
40 | SET(RUST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rust") | 39 | SET(RUST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rust") | ||
Show All 16 Lines | 53 | add_custom_command( | |||
57 | DEPENDS rust/src/lib.rs | 56 | DEPENDS rust/src/lib.rs | ||
58 | rust/src/implementation.rs | 57 | rust/src/implementation.rs | ||
59 | rust/src/interface.rs | 58 | rust/src/interface.rs | ||
60 | WORKING_DIRECTORY "${RUST_DIR}" | 59 | WORKING_DIRECTORY "${RUST_DIR}" | ||
61 | ) | 60 | ) | ||
62 | add_custom_target(rust_target DEPENDS "${RUST_LIB}") | 61 | add_custom_target(rust_target DEPENDS "${RUST_LIB}") | ||
63 | 62 | | |||
64 | list(APPEND Libs "${RUST_LIB}") | 63 | list(APPEND Libs "${RUST_LIB}") | ||
65 | list(APPEND Libs Qt5::Core Qt5::Quick Qt5::Widgets Threads::Threads ${CMAKE_DL_LIBS}) | 64 | list(APPEND Libs Qt5::Core Qt5::Quick Threads::Threads ${CMAKE_DL_LIBS}) | ||
66 | set(SRCS src/main.cpp src/Bindings.cpp "qml.qrc") | 65 | set(SRCS src/main.cpp src/Bindings.cpp "qml.qrc") | ||
67 | add_executable(todos ${SRCS}) | 66 | add_executable(todos ${SRCS}) | ||
68 | add_dependencies(todos rust_target) | 67 | add_dependencies(todos rust_target) | ||
69 | target_link_libraries(todos ${Libs}) | 68 | target_link_libraries(todos ${Libs}) | ||
70 | set_target_properties(todos PROPERTIES | 69 | set_target_properties(todos PROPERTIES | ||
71 | CXX_STANDARD 11 | 70 | CXX_STANDARD 11 | ||
72 | CXX_STANDARD_REQUIRED ON | 71 | CXX_STANDARD_REQUIRED ON | ||
73 | ) | 72 | ) |