Skip to content

Commit ee6e299

Browse files
committed
Integrate Rust workspace targets compilation and installation into CMake/CPack
1 parent 2aa3e41 commit ee6e299

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,33 @@ add_custom_command(TARGET gpubench POST_BUILD
311311
COMMENT "Copying kernels directory to project root"
312312
)
313313

314+
# Build and package Rust GUI if Cargo is available
315+
find_program(CARGO_EXECUTABLE cargo)
316+
if(CARGO_EXECUTABLE)
317+
message(STATUS "Cargo found: ${CARGO_EXECUTABLE}. Configuring Rust GUI build.")
318+
319+
# Custom target to compile Rust workspace
320+
add_custom_target(gpubench_rust_gui ALL
321+
COMMAND ${CARGO_EXECUTABLE} build --release --workspace
322+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
323+
COMMENT "Building Rust GUI and core library"
324+
)
325+
326+
# Ensure C++ gpubench target depends on it
327+
add_dependencies(gpubench gpubench_rust_gui)
328+
329+
# Install the Rust GUI binary
330+
if(WIN32)
331+
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/target/release/gpubench-gui.exe"
332+
DESTINATION bin)
333+
else()
334+
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/target/release/gpubench-gui"
335+
DESTINATION bin)
336+
endif()
337+
else()
338+
message(WARNING "Cargo not found. Rust GUI will not be built and packaged.")
339+
endif()
340+
314341
# Install targets
315342
install(TARGETS gpubench DESTINATION bin)
316343

0 commit comments

Comments
 (0)