2024-01-14 13:39:15 -05:00
|
|
|
cmake_minimum_required(VERSION 3.25)
|
|
|
|
project(gp_image_test)
|
|
|
|
|
|
|
|
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
|
|
|
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
|
|
|
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
2024-01-30 10:56:58 -05:00
|
|
|
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)
|
|
|
|
|
2024-01-14 13:39:15 -05:00
|
|
|
add_subdirectory(libraries/BLT-With-Graphics-Template)
|
|
|
|
|
|
|
|
include_directories(include/)
|
|
|
|
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
|
|
|
|
2024-02-04 18:54:38 -05:00
|
|
|
#set(META_LIBS common/pdqhashtypes.cpp io/hashio.cpp common/pdqhamming.cpp hashing/pdqhashing.cpp downscaling/downscaling.cpp hashing/torben.cpp)
|
|
|
|
#include_directories(libraries/ThreatExchange)
|
|
|
|
#
|
|
|
|
#list(TRANSFORM META_LIBS PREPEND ${CMAKE_SOURCE_DIR}/libraries/ThreatExchange/pdq/cpp/)
|
2024-01-30 10:56:58 -05:00
|
|
|
|
2024-01-14 13:39:15 -05:00
|
|
|
add_executable(gp_image_test ${PROJECT_BUILD_FILES})
|
|
|
|
|
2024-01-30 10:56:58 -05:00
|
|
|
add_dependencies(gp_image_test stats_lib_bindings_rust)
|
|
|
|
|
2024-03-24 17:45:27 -04:00
|
|
|
target_compile_options(gp_image_test PRIVATE -Wall -Wextra -Wpedantic -Wno-comment -Wno-unused-parameter)
|
|
|
|
target_link_options(gp_image_test PRIVATE -Wall -Wextra -Wpedantic -Wno-comment -Wno-unused-parameter)
|
2024-01-14 13:39:15 -05:00
|
|
|
|
|
|
|
target_link_libraries(gp_image_test BLT_WITH_GRAPHICS)
|
|
|
|
|
2024-01-29 15:55:28 -05:00
|
|
|
if (${BUILD_SHARED_LIBS})
|
2024-01-30 10:56:58 -05:00
|
|
|
target_link_libraries(gp_image_test ${CMAKE_CURRENT_BINARY_DIR}/libbindings.so)
|
2024-01-29 15:55:28 -05:00
|
|
|
else ()
|
2024-01-30 10:56:58 -05:00
|
|
|
target_link_libraries(gp_image_test ${CMAKE_CURRENT_BINARY_DIR}/libbindings.a)
|
2024-01-29 15:55:28 -05:00
|
|
|
endif ()
|
2024-01-29 11:00:53 -05:00
|
|
|
|
2024-01-14 13:39:15 -05:00
|
|
|
if (${ENABLE_ADDRSAN} MATCHES ON)
|
|
|
|
target_compile_options(gp_image_test PRIVATE -fsanitize=address)
|
|
|
|
target_link_options(gp_image_test PRIVATE -fsanitize=address)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${ENABLE_UBSAN} MATCHES ON)
|
|
|
|
target_compile_options(gp_image_test PRIVATE -fsanitize=undefined)
|
|
|
|
target_link_options(gp_image_test PRIVATE -fsanitize=undefined)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${ENABLE_TSAN} MATCHES ON)
|
|
|
|
target_compile_options(gp_image_test PRIVATE -fsanitize=thread)
|
|
|
|
target_link_options(gp_image_test PRIVATE -fsanitize=thread)
|
|
|
|
endif ()
|