cmake fuckery

main
Brett 2024-01-30 10:56:58 -05:00
parent d37b549025
commit c67d9294d2
1 changed files with 23 additions and 2 deletions

View File

@ -7,22 +7,43 @@ option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CARGO_WORKING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/bindings)
set(CARGO_TOML ${CARGO_WORKING_DIR}/Cargo.toml)
set(CARGO_CMD_PATH /home/brett/.cargo/bin/cargo)
set(CARGO_COMMAND ${CARGO_CMD_PATH} build --manifest-path ${CARGO_TOML} --release)
set(STATS_LIB_NAME libbindings)
set(STATS_LIB_DIR ${CMAKE_SOURCE_DIR}/extern/bindings/target/release)
message("Using cargo command '${CARGO_COMMAND}'")
add_custom_target(stats_lib_bindings_rust ALL
COMMENT "Compiling client module"
COMMAND ${CARGO_COMMAND}
COMMAND cp ${STATS_LIB_DIR}/${STATS_LIB_NAME}.so ${CMAKE_CURRENT_BINARY_DIR}
COMMAND cp ${STATS_LIB_DIR}/${STATS_LIB_NAME}.a ${CMAKE_CURRENT_BINARY_DIR}
WORKING_DIRECTORY ${CARGO_WORKING_DIR})
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/${STATS_LIB_NAME}.so)
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/${STATS_LIB_NAME}.a)
add_subdirectory(libraries/BLT-With-Graphics-Template) add_subdirectory(libraries/BLT-With-Graphics-Template)
include_directories(include/) include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_dependencies(BLT stats_lib_bindings_rust)
add_executable(gp_image_test ${PROJECT_BUILD_FILES}) add_executable(gp_image_test ${PROJECT_BUILD_FILES})
add_dependencies(gp_image_test stats_lib_bindings_rust)
target_compile_options(gp_image_test PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment -Wno-unused-parameter) target_compile_options(gp_image_test PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment -Wno-unused-parameter)
target_link_options(gp_image_test PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment -Wno-unused-parameter) target_link_options(gp_image_test PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment -Wno-unused-parameter)
target_link_libraries(gp_image_test BLT_WITH_GRAPHICS) target_link_libraries(gp_image_test BLT_WITH_GRAPHICS)
if (${BUILD_SHARED_LIBS}) if (${BUILD_SHARED_LIBS})
target_link_libraries(gp_image_test ${CMAKE_SOURCE_DIR}/extern/bindings/target/release/libbindings.so) target_link_libraries(gp_image_test ${CMAKE_CURRENT_BINARY_DIR}/libbindings.so)
else () else ()
target_link_libraries(gp_image_test ${CMAKE_SOURCE_DIR}/extern/bindings/target/release/libbindings.a) target_link_libraries(gp_image_test ${CMAKE_CURRENT_BINARY_DIR}/libbindings.a)
endif () endif ()
if (${ENABLE_ADDRSAN} MATCHES ON) if (${ENABLE_ADDRSAN} MATCHES ON)