aboutsummaryrefslogtreecommitdiff
path: root/test/CMakeLists.txt
diff options
context:
space:
mode:
authorJózef Kucia <joseph.kucia@gmail.com>2018-02-02 23:37:14 +0100
committerDavid Neto <dneto@google.com>2018-02-07 10:43:32 -0500
commit30138975561d568010e39960401cccd815f55edd (patch)
tree8a86e131e6a91082445082c82221fed061b1d5bd /test/CMakeLists.txt
parentb1c9c4e8c0f41c4f76e2e1c6f938982b03bd35ee (diff)
downloadSPIRV-Tools-30138975561d568010e39960401cccd815f55edd.tar.gz
Build SPIRV-Tools as shared library
Add pkg-config file for shared libraries Properly build SPIRV-Tools DLL Test C interface with shared library Set PATH to shared library file for c_interface_shared test Otherwise, the test won't find SPIRV-Tools-shared.dll. Do not use private functions when testing with shared library Make all symbols hidden by default for shared library target
Diffstat (limited to 'test/CMakeLists.txt')
-rw-r--r--test/CMakeLists.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4ede989c..13889cdb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -31,7 +31,7 @@ endif()
function(add_spvtools_unittest)
if (NOT "${SPIRV_SKIP_TESTS}" AND TARGET gmock_main)
set(one_value_args TARGET)
- set(multi_value_args SRCS LIBS)
+ set(multi_value_args SRCS LIBS ENVIRONMENT)
cmake_parse_arguments(
ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN})
set(target test_${ARG_TARGET})
@@ -72,6 +72,9 @@ function(add_spvtools_unittest)
endif()
target_link_libraries(${target} PRIVATE gmock_main)
add_test(NAME spirv-tools-${target} COMMAND ${target})
+ if (DEFINED ARG_ENVIRONMENT)
+ set_tests_properties(spirv-tools-${target} PROPERTIES ENVIRONMENT ${ARG_ENVIRONMENT})
+ endif()
set_property(TARGET ${target} PROPERTY FOLDER "SPIRV-Tools tests")
endif()
endfunction()
@@ -154,6 +157,12 @@ add_spvtools_unittest(
LIBS ${SPIRV_TOOLS})
add_spvtools_unittest(
+ TARGET c_interface_shared
+ SRCS c_interface_test.cpp
+ LIBS ${SPIRV_TOOLS}-shared
+ ENVIRONMENT PATH=$<TARGET_FILE_DIR:${SPIRV_TOOLS}-shared>)
+
+add_spvtools_unittest(
TARGET cpp_interface
SRCS cpp_interface_test.cpp
LIBS SPIRV-Tools-opt)