2017-08-12 06:17:24 -07:00
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
|
2017-08-31 10:20:25 -07:00
|
|
|
# generate c++ and rust code from bindings.json
|
2017-08-13 11:01:53 -07:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/rust/src/interface.rs"
|
2017-08-31 10:20:25 -07:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/Bindings.h"
|
2017-08-21 15:51:48 -07:00
|
|
|
# if the cpp file is marked GENERATED, CMake will not check it for moc
|
2017-08-31 10:20:25 -07:00
|
|
|
# "${CMAKE_CURRENT_SOURCE_DIR}/src/Bindings.cpp"
|
2018-09-26 07:05:37 -07:00
|
|
|
COMMAND ${RustQtBindingGenerator_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/bindings.json"
|
|
|
|
DEPENDS ${RustQtBindingGenerator_EXECUTABLE} bindings.json
|
2017-08-21 15:51:48 -07:00
|
|
|
)
|
|
|
|
|
2017-08-20 14:36:33 -07:00
|
|
|
# compile the rust code into a static library
|
2017-08-12 06:17:24 -07:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a"
|
2017-09-01 10:15:13 -07:00
|
|
|
COMMAND ${Cargo_EXECUTABLE} build ${RUST_BUILD_FLAG}
|
2017-08-12 06:17:24 -07:00
|
|
|
DEPENDS rust/src/lib.rs
|
2017-08-31 10:20:25 -07:00
|
|
|
rust/src/implementation/mod.rs
|
|
|
|
rust/src/implementation/time_series.rs
|
|
|
|
rust/src/implementation/fibonacci.rs
|
|
|
|
rust/src/implementation/processes.rs
|
2017-08-12 06:17:24 -07:00
|
|
|
rust/src/interface.rs
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/rust"
|
|
|
|
)
|
|
|
|
add_custom_target(rust_target DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a")
|
|
|
|
|
2017-08-21 15:51:48 -07:00
|
|
|
list(APPEND DemoLibs "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a")
|
2017-09-03 07:24:23 -07:00
|
|
|
list(APPEND DemoLibs Qt5::Widgets Qt5::Svg Threads::Threads ${DL_LIBRARY})
|
2017-08-21 15:51:48 -07:00
|
|
|
if (Qt5Quick_FOUND)
|
|
|
|
list(APPEND DemoLibs Qt5::Quick)
|
2017-08-20 14:36:33 -07:00
|
|
|
endif()
|
2017-08-21 15:51:48 -07:00
|
|
|
if (Qt5QuickControls2_FOUND)
|
2017-08-20 15:37:00 -07:00
|
|
|
add_definitions(-DQTQUICKCONTROLS2)
|
2017-09-07 05:25:13 -07:00
|
|
|
list(APPEND DemoLibs Qt5::QuickControls2)
|
2017-08-21 15:51:48 -07:00
|
|
|
endif()
|
|
|
|
if (Qt5Charts_FOUND)
|
|
|
|
list(APPEND DemoLibs Qt5::Charts)
|
2017-08-20 15:37:00 -07:00
|
|
|
endif()
|
2017-09-05 09:16:25 -07:00
|
|
|
if (KF5Kirigami2_FOUND)
|
|
|
|
add_definitions(-DKIRIGAMI2)
|
|
|
|
endif()
|
2017-08-20 14:36:33 -07:00
|
|
|
|
2017-12-21 06:49:04 -08:00
|
|
|
if (ECM_FOUND)
|
|
|
|
ecm_create_qm_loader(Demo_QM_LOADER rqbgdemo_qt)
|
|
|
|
endif()
|
2017-09-02 14:47:00 -07:00
|
|
|
|
2017-08-31 10:20:25 -07:00
|
|
|
set(Demo_SRCS src/main.cpp src/Bindings.cpp src/SortedModel.cpp
|
2017-09-02 14:47:00 -07:00
|
|
|
resource_file.qrc ${Demo_QM_LOADER})
|
2017-08-12 06:17:24 -07:00
|
|
|
|
|
|
|
add_executable(Demo ${Demo_SRCS})
|
|
|
|
add_dependencies(Demo rust_target)
|
|
|
|
|
2017-08-21 15:51:48 -07:00
|
|
|
target_link_libraries(Demo ${DemoLibs})
|
2017-08-12 06:17:24 -07:00
|
|
|
|
|
|
|
set_target_properties(Demo PROPERTIES
|
|
|
|
CXX_STANDARD 11
|
|
|
|
CXX_STANDARD_REQUIRED ON
|
|
|
|
)
|