Warning, /sdk/rust-qt-binding-generator/demo/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 set(CMAKE_AUTORCC ON)
0002
0003 # generate c++ and rust code from bindings.json
0004 add_custom_command(
0005 OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/rust/src/interface.rs"
0006 "${CMAKE_CURRENT_SOURCE_DIR}/src/Bindings.h"
0007 # if the cpp file is marked GENERATED, CMake will not check it for moc
0008 # "${CMAKE_CURRENT_SOURCE_DIR}/src/Bindings.cpp"
0009 COMMAND ${RustQtBindingGenerator_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/bindings.json"
0010 DEPENDS rust_qt_binding_generator bindings.json
0011 )
0012
0013 SET(RUST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rust")
0014 if (MSVC)
0015 SET(RUST_LIB "${RUST_DIR}/${RUST_TARGET_DIR}/rust.lib")
0016 else()
0017 SET(RUST_LIB "${RUST_DIR}/${RUST_TARGET_DIR}/librust.a")
0018 endif()
0019
0020 # compile the rust code into a static library
0021 add_custom_command(
0022 OUTPUT "${RUST_LIB}"
0023 COMMAND ${Cargo_EXECUTABLE} build ${RUST_BUILD_FLAG}
0024 DEPENDS rust/src/lib.rs
0025 rust/src/implementation/mod.rs
0026 rust/src/implementation/time_series.rs
0027 rust/src/implementation/fibonacci.rs
0028 rust/src/implementation/processes.rs
0029 rust/src/interface.rs
0030 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/rust"
0031 )
0032 add_custom_target(rust_target DEPENDS "${RUST_LIB}")
0033
0034 list(APPEND DemoLibs "${RUST_LIB}")
0035 list(APPEND DemoLibs Qt5::Widgets Qt5::Svg Threads::Threads ${DL_LIBRARY})
0036 if (Qt5Quick_FOUND)
0037 list(APPEND DemoLibs Qt5::Quick)
0038 endif()
0039 if (Qt5QuickControls2_FOUND)
0040 add_definitions(-DQTQUICKCONTROLS2)
0041 list(APPEND DemoLibs Qt5::QuickControls2)
0042 endif()
0043 if (Qt5Charts_FOUND)
0044 list(APPEND DemoLibs Qt5::Charts)
0045 endif()
0046 if (KF5Kirigami2_FOUND)
0047 add_definitions(-DKIRIGAMI2)
0048 endif()
0049
0050 if (ECM_FOUND)
0051 ecm_create_qm_loader(Demo_QM_LOADER rqbgdemo_qt)
0052 endif()
0053
0054 set(Demo_SRCS src/main.cpp src/Bindings.cpp src/SortedModel.cpp
0055 resource_file.qrc ${Demo_QM_LOADER})
0056
0057 add_executable(Demo ${Demo_SRCS})
0058 add_dependencies(Demo rust_target)
0059
0060 target_link_libraries(Demo ${DemoLibs})
0061
0062 set_target_properties(Demo PROPERTIES
0063 CXX_STANDARD 11
0064 CXX_STANDARD_REQUIRED ON
0065 )