Warning, /sdk/rust-qt-binding-generator/tests/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 
0002 set(GENERATOR "${RustQtBindingGenerator_EXECUTABLE}")
0003 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
0004 
0005 add_custom_target("clean-rust")
0006 
0007 function(rust_test NAME DIRECTORY)
0008     set(SRC "${CMAKE_CURRENT_SOURCE_DIR}")
0009     set(DIR "${SRC}/${DIRECTORY}")
0010     if (MSVC)
0011       SET(RUST_LIB "${DIR}/${RUST_TARGET_DIR}/rust.lib")
0012     else()
0013       SET(RUST_LIB "${DIR}/${RUST_TARGET_DIR}/librust.a")
0014     endif()
0015 
0016     set_property(SOURCE "${SRC}/${NAME}_rust.h" PROPERTY SKIP_AUTOGEN OFF)
0017     add_custom_command(
0018         OUTPUT "${DIR}/src/interface.rs"
0019                "${SRC}/${NAME}_rust.h"
0020                "${SRC}/${NAME}_rust.cpp"
0021         COMMAND "${GENERATOR}" "${SRC}/${NAME}.json"
0022         MAIN_DEPENDENCY "${NAME}.json"
0023         DEPENDS rust_qt_binding_generator
0024     )
0025     add_custom_command(
0026         OUTPUT "${RUST_LIB}"
0027         COMMAND ${Cargo_EXECUTABLE} build ${RUST_BUILD_FLAG}
0028         DEPENDS "${DIR}/src/lib.rs"
0029                 "${DIR}/src/implementation.rs"
0030                 "${DIR}/src/interface.rs"
0031         WORKING_DIRECTORY "${DIR}"
0032     )
0033     add_custom_target("test_${DIRECTORY}"
0034         DEPENDS "${RUST_LIB}")
0035 
0036     add_executable("${NAME}" "${NAME}.cpp" "${NAME}_rust.cpp" "${NAME}_rust.h")
0037     set_target_properties("${NAME}" PROPERTIES
0038         CXX_STANDARD 11
0039         CXX_STANDARD_REQUIRED ON
0040     )
0041     add_dependencies("${NAME}" "test_${DIRECTORY}")
0042     target_link_libraries("${NAME}"
0043         Qt5::Core
0044         Qt5::Test
0045         "${RUST_LIB}"
0046         Threads::Threads ${DL_LIBRARY}
0047     )
0048 
0049     add_test("build_${NAME}"
0050             "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target "${NAME}")
0051     add_test("${NAME}" "${NAME}")
0052     set_tests_properties("${NAME}" PROPERTIES DEPENDS "build_${NAME}")
0053 
0054     add_custom_command(
0055         OUTPUT "clean_${NAME}"
0056         COMMAND ${Cargo_EXECUTABLE} clean
0057         WORKING_DIRECTORY "${DIR}"
0058     )
0059     add_custom_target("clean-${NAME}" DEPENDS "clean_${NAME}")
0060     add_dependencies("clean-rust" "clean-${NAME}")
0061 
0062 
0063 endfunction(rust_test)
0064 
0065 rust_test(test_object rust_object)
0066 rust_test(test_object_types rust_object_types)
0067 rust_test(test_list rust_list)
0068 rust_test(test_list_types rust_list_types)
0069 rust_test(test_tree rust_tree)
0070 rust_test(test_objects rust_objects)
0071 rust_test(test_functions rust_functions)