diff --git a/CMake/VTKmMacros.cmake b/CMake/VTKmMacros.cmake index 1056cb7ac..c39183739 100755 --- a/CMake/VTKmMacros.cmake +++ b/CMake/VTKmMacros.cmake @@ -135,9 +135,9 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda) # Send the libraries created for test builds to their own directory so as to # not polute the directory with useful libraries. set_target_properties(TestBuild_${name} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/testbuilds - LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/testbuilds - RUNTIME_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/testbuilds + ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds + LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds + RUNTIME_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds ) endfunction(vtkm_add_header_build_test) @@ -287,6 +287,12 @@ function(vtkm_unit_tests) add_executable(${test_prog} ${TestSources}) endif (VTKm_UT_CUDA) + set_target_properties(${test_prog} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH} + ) + #do it as a property value so we don't pollute the include_directories #for any other targets target_include_directories(${test_prog} PRIVATE ${VTKm_INCLUDE_DIRS}) @@ -420,6 +426,12 @@ function(vtkm_worklet_unit_tests device_adapter) else() add_executable(${test_prog} ${unit_test_drivers} ${unit_test_srcs}) endif() + + set_target_properties(${test_prog} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH} + ) target_include_directories(${test_prog} PRIVATE ${VTKm_INCLUDE_DIRS}) target_link_libraries(${test_prog} PRIVATE vtkm_cont ${VTKm_LIBRARIES}) @@ -549,6 +561,12 @@ function(vtkm_benchmarks device_adapter) add_executable(${benchmark_prog} ${file} ${benchmark_headers}) endif() + set_target_properties(${benchmark_prog} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH} + ) + set_source_files_properties(${benchmark_headers} PROPERTIES HEADER_FILE_ONLY TRUE) @@ -686,9 +704,9 @@ function(vtkm_library) # 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} + ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} + RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH} ) if(MSVC) @@ -725,7 +743,7 @@ function(vtkm_library) configure_file( ${VTKm_SOURCE_DIR}/CMake/VTKmExportHeaderTemplate.h.in - ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h + ${VTKm_BINARY_DIR}/include/${dir_prefix}/${lib_name}_export.h @ONLY) unset(EXPORT_MACRO_NAME) @@ -739,7 +757,7 @@ function(vtkm_library) RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR} ) vtkm_install_headers("${dir_prefix}" - ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h + ${VTKm_BINARY_DIR}/include/${dir_prefix}/${lib_name}_export.h ${VTKm_LIB_HEADERS} ) endfunction(vtkm_library) diff --git a/CMakeLists.txt b/CMakeLists.txt index 227f1161d..11d52c201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,11 +27,21 @@ cmake_minimum_required(VERSION 3.3) project (VTKm) -set(VTKm_INSTALL_INCLUDE_DIR "include") -set(VTKm_INSTALL_CONFIG_DIR "lib") -set(VTKm_INSTALL_LIB_DIR "lib") -set(VTKm_INSTALL_BIN_DIR "bin") -set(VTKm_INSTALL_CMAKE_MODULE_DIR "share/vtkm/cmake") +if (NOT DEFINED VTKm_INSTALL_INCLUDE_DIR) + set(VTKm_INSTALL_INCLUDE_DIR "include") +endif() +if (NOT DEFINED VTKm_INSTALL_CONFIG_DIR) + set(VTKm_INSTALL_CONFIG_DIR "lib") +endif() +if (NOT DEFINED VTKm_INSTALL_LIB_DIR) + set(VTKm_INSTALL_LIB_DIR "lib") +endif() +if (NOT DEFINED VTKm_INSTALL_BIN_DIR) + set(VTKm_INSTALL_BIN_DIR "bin") +endif() +if (NOT DEFINED VTKm_INSTALL_CMAKE_MODULE_DIR) + set(VTKm_INSTALL_CMAKE_MODULE_DIR "share/vtkm/cmake") +endif() set(VTKm_EXPORT_NAME "VTKmTargets") @@ -147,21 +157,21 @@ endif (VTKm_ENABLE_CUDA) #----------------------------------------------------------------------------- ## Set the directory where the binaries will be stored -set( EXECUTABLE_OUTPUT_PATH +set( VTKm_EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory where all executable will be stored" ) ## Set the directory where the libraries will be stored -set( LIBRARY_OUTPUT_PATH +set( VTKm_LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib CACHE PATH "Directory where all the libraries will be stored" ) mark_as_advanced( - EXECUTABLE_OUTPUT_PATH - LIBRARY_OUTPUT_PATH) + VTKm_EXECUTABLE_OUTPUT_PATH + VTKm_LIBRARY_OUTPUT_PATH) #----------------------------------------------------------------------------- # Add "meta" tests that check the state of the repository diff --git a/vtkm/CMakeLists.txt b/vtkm/CMakeLists.txt index d405c0d1b..4744fd471 100644 --- a/vtkm/CMakeLists.txt +++ b/vtkm/CMakeLists.txt @@ -21,10 +21,10 @@ # Configure version file. (Other configuration in internal/Configure.h) vtkm_get_kit_name(kit_name kit_dir) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in - ${CMAKE_BINARY_DIR}/include/${kit_dir}/Version.h + ${VTKm_BINARY_DIR}/include/${kit_dir}/Version.h @ONLY) vtkm_install_headers( - vtkm ${CMAKE_BINARY_DIR}/include/${kit_dir}/Version.h) + vtkm ${VTKm_BINARY_DIR}/include/${kit_dir}/Version.h) set(headers Assert.h diff --git a/vtkm/internal/CMakeLists.txt b/vtkm/internal/CMakeLists.txt index a3398e91c..3a0e6e06c 100755 --- a/vtkm/internal/CMakeLists.txt +++ b/vtkm/internal/CMakeLists.txt @@ -33,10 +33,10 @@ set(VTKM_ENABLE_OPENGL_INTEROP ${VTKm_ENABLE_OPENGL_INTEROP}) vtkm_get_kit_name(kit_name kit_dir) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in - ${CMAKE_BINARY_DIR}/include/${kit_dir}/Configure.h + ${VTKm_BINARY_DIR}/include/${kit_dir}/Configure.h @ONLY) vtkm_install_headers( - vtkm/internal ${CMAKE_BINARY_DIR}/include/${kit_dir}/Configure.h) + vtkm/internal ${VTKm_BINARY_DIR}/include/${kit_dir}/Configure.h) unset(VTKM_ENABLE_OPENGL_INTEROP)