Files
CMake/Tests/ISPC/DynamicLibrary/CMakeLists.txt
Robert Maynard 8de145cae1 ISPC: DynamicLibrary test now passes on windows.
The MSVC linker needs to know what MSVC runtime a shared library
needs. ISPC objects don't have a '/DIRECTIVE' entry for the
MSVC runtime as they have no dependency on it. Therefore
we need to add a C or C++ source to each shared library so
the MSVC linker knows what runtime to embed
2020-09-10 16:15:55 -04:00

23 lines
740 B
CMake

cmake_minimum_required(VERSION 3.18)
project(ISPCDynamicLibrary CXX ISPC)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_ISPC_FLAGS "--arch=x86")
endif()
add_library(ispc_objects1 STATIC extra.ispc extra.cxx)
add_library(ispc_objects2 SHARED simple.ispc)
target_sources(ispc_objects2 PRIVATE simple.cxx)
set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4")
target_link_libraries(ispc_objects2 PUBLIC ispc_objects1)
add_executable(ISPCDynamicLibrary main.cxx)
target_link_libraries(ISPCDynamicLibrary PUBLIC ispc_objects2)