diff --git a/CMake/VTKmConfig.cmake.in b/CMake/VTKmConfig.cmake.in index bd498d4dd..2f8fcc196 100755 --- a/CMake/VTKmConfig.cmake.in +++ b/CMake/VTKmConfig.cmake.in @@ -63,6 +63,7 @@ else() set_and_check(VTKm_CMAKE_MODULE_PATH "@VTKm_SOURCE_DIR@/CMake") endif() +set(VTKm_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@") set(VTKm_ENABLE_CUDA "@VTKm_ENABLE_CUDA@") set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@") set(VTKm_ENABLE_OPENGL_INTEROP "@VTKm_ENABLE_OPENGL_INTEROP@") diff --git a/CMake/VTKmMacros.cmake b/CMake/VTKmMacros.cmake index 2c4c2ba97..741eade9b 100755 --- a/CMake/VTKmMacros.cmake +++ b/CMake/VTKmMacros.cmake @@ -627,6 +627,14 @@ function(vtkm_library) target_compile_options(${lib_name} PRIVATE ${VTKm_COMPILE_OPTIONS}) + # Make sure libraries go to lib directory and dll go to bin directory. + # Mostly important on Windows. + set_target_properties(${lib_name} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} + LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} + RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} + ) + if(MSVC) vtkm_setup_msvc_properties(${lib_name}) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index a1ab49faf..8b5ea450c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,9 @@ option(VTKm_USE_DOUBLE_PRECISION ) option(VTKm_USE_64BIT_IDS "Use 64-bit indices." ON) +option(BUILD_SHARED_LIBS "Build VTK-m with shared libraries" ON) +set(VTKm_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + if (VTKm_ENABLE_TESTING) enable_testing() include(CTest) diff --git a/vtkm/internal/Configure.h.in b/vtkm/internal/Configure.h.in index 1ec1e67e5..296d22f1f 100644 --- a/vtkm/internal/Configure.h.in +++ b/vtkm/internal/Configure.h.in @@ -119,6 +119,8 @@ # endif #endif +#cmakedefine VTKm_BUILD_SHARED_LIBS + // Define a pair of macros, VTKM_THIRDPARTY_PRE_INCLUDE and VTKM_THIRDPARTY_POST_INCLUDE, // that should be wrapped around any #include for a boost or thrust header file. Mostly // this is used to set pragmas that dissable warnings that VTK-m checks for