Commit ed8f4111 authored by Robert Maynard's avatar Robert Maynard

Update all the code to work with CMake 3.3

Obviously this does mean that CUDA is not supported with 3.3.
parent 3ded5548
......@@ -43,6 +43,7 @@ endif()
if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
enable_language(CUDA)
add_library(vtkm::cuda UNKNOWN IMPORTED)
......
......@@ -48,7 +48,11 @@ endif()
add_library(vtkm_compiler_flags INTERFACE)
# setup that we need C++11 support
target_compile_features(vtkm_compiler_flags INTERFACE cxx_std_11)
if(CMAKE_VERSION VERSION_LESS 3.8)
target_compile_features(vtkm_compiler_flags INTERFACE cxx_nullptr)
else()
target_compile_features(vtkm_compiler_flags INTERFACE cxx_std_11)
endif()
# Enable large object support so we can have 2^32 addressable sections
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
......
......@@ -32,7 +32,7 @@
# implicitly linked to by `vtkm` if cuda is enabled
#
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
@PACKAGE_INIT@
......
......@@ -229,7 +229,7 @@ function(vtkm_unit_tests)
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
)
target_link_libraries(${test_prog} PRIVATE vtkm ${VTKm_UT_LIBRARIES})
target_link_libraries(${test_prog} PRIVATE vtkm_cont ${VTKm_UT_LIBRARIES})
if(NOT VTKm_UT_NO_TESTS)
return()
......
......@@ -26,7 +26,7 @@
# - Support for usage requirements
#
# We require CMake 3.9 for CUDA support
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.3)
project (VTKm)
# Update module path
......
......@@ -19,7 +19,7 @@
## this software.
##
##=============================================================================
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(Clipping CXX)
#Find the VTK-m package
......@@ -29,14 +29,14 @@ find_package(VTKm REQUIRED QUIET)
add_executable(Clipping_SERIAL Clipping.cxx)
target_compile_definitions(Clipping_SERIAL PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL")
target_link_libraries(Clipping_SERIAL PRIVATE vtkm)
target_link_libraries(Clipping_SERIAL PRIVATE vtkm_cont)
if(TARGET vtkm::tbb)
add_executable(Clipping_TBB Clipping.cxx)
target_compile_definitions(Clipping_TBB PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB")
target_link_libraries(Clipping_TBB PRIVATE vtkm)
target_link_libraries(Clipping_TBB PRIVATE vtkm_cont)
endif()
if(TARGET vtkm::cuda)
......@@ -47,5 +47,5 @@ if(TARGET vtkm::cuda)
target_compile_definitions(Clipping_CUDA PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA")
target_link_libraries(Clipping_CUDA PRIVATE vtkm)
target_link_libraries(Clipping_CUDA PRIVATE vtkm_cont)
endif()
......@@ -19,7 +19,7 @@
## this software.
##
##=============================================================================
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(VTKmDemo CXX)
#Find the VTK-m package
......
......@@ -19,7 +19,7 @@
## this software.
##
##=============================================================================
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(GameOfLife CXX)
#Find the VTK-m package
......@@ -35,6 +35,6 @@ if(TARGET OpenGL::GL AND
endif()
add_executable(GameOfLife GameOfLife.cxx LoadShaders.h)
target_link_libraries(GameOfLife PRIVATE vtkm OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(GameOfLife PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
endif()
......@@ -19,7 +19,7 @@
## this software.
##
##=============================================================================
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(HelloWorld CXX)
#Find the VTK-m package
......@@ -32,17 +32,17 @@ if(TARGET OpenGL::GL AND
add_executable(HelloWorld_SERIAL HelloWorld.cxx LoadShaders.h)
target_link_libraries(HelloWorld_SERIAL
PRIVATE vtkm OpenGL::GL GLEW::GLEW GLUT::GLUT)
PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
if(TARGET vtkm::tbb)
add_executable(HelloWorld_TBB HelloWorldTBB.cxx LoadShaders.h)
target_link_libraries(HelloWorld_TBB
PRIVATE vtkm OpenGL::GL GLEW::GLEW GLUT::GLUT)
PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
endif()
if(TARGET vtkm::cuda)
add_executable(HelloWorld_CUDA HelloWorld.cu LoadShaders.h)
target_link_libraries(HelloWorld_CUDA
PRIVATE vtkm OpenGL::GL GLEW::GLEW GLUT::GLUT)
PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
endif()
endif()
......@@ -19,7 +19,7 @@
## this software.
##
##=============================================================================
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(MultiBackend CXX)
#Find the VTK-m package
......@@ -30,4 +30,4 @@ if(TARGET vtkm::cuda)
endif()
add_executable(MultiBackend MultiBackend.cxx)
target_link_libraries(MultiBackend PRIVATE vtkm)
target_link_libraries(MultiBackend PRIVATE vtkm_cont)
......@@ -118,28 +118,28 @@ set(device_sources
add_subdirectory(internal)
add_subdirectory(arg)
vtkm_library( NAME vtkm
SOURCES ${sources}
TEMPLATE_SOURCES ${template_sources}
HEADERS ${headers}
WRAP_FOR_CUDA ${device_sources}
)
set(backends )
add_subdirectory(serial)
target_sources(vtkm PRIVATE $<TARGET_OBJECTS:vtkm_cont_serial>)
list(APPEND sources $<TARGET_OBJECTS:vtkm_cont_serial>)
add_subdirectory(tbb)
if (VTKm_ENABLE_TBB)
target_sources(vtkm PRIVATE $<TARGET_OBJECTS:vtkm_cont_tbb>)
target_link_libraries(vtkm PUBLIC vtkm::tbb)
list(APPEND sources $<TARGET_OBJECTS:vtkm_cont_tbb>)
list(APPEND backends vtkm::tbb)
endif()
add_subdirectory(cuda)
if (VTKm_ENABLE_CUDA)
target_sources(vtkm PRIVATE $<TARGET_OBJECTS:vtkm_cont_cuda>)
target_link_libraries(vtkm PUBLIC vtkm::cuda)
list(APPEND sources $<TARGET_OBJECTS:vtkm_cont_cuda>)
list(APPEND backends vtkm::cuda)
endif()
target_link_libraries(vtkm PUBLIC vtkm_compiler_flags)
vtkm_library( NAME vtkm_cont
SOURCES ${sources}
TEMPLATE_SOURCES ${template_sources}
HEADERS ${headers}
WRAP_FOR_CUDA ${device_sources}
)
target_link_libraries(vtkm_cont PUBLIC vtkm_compiler_flags ${backends})
#-----------------------------------------------------------------------------
add_subdirectory(testing)
......@@ -42,10 +42,10 @@ add_library(vtkm_cont_cuda OBJECT
CudaAllocator.cu
)
target_compile_options(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_options(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_INCLUDE_DIRECTORIES>)
if(BUILD_SHARED_LIBS)
set_property(TARGET vtkm_cont_cuda PROPERTY POSITION_INDEPENDENT_CODE ON)
......
......@@ -31,11 +31,10 @@ add_library(vtkm_cont_serial OBJECT
DeviceAdapterAlgorithmSerial.cxx
)
target_compile_options(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_options(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_INCLUDE_DIRECTORIES>)
if(BUILD_SHARED_LIBS)
set_property(TARGET vtkm_cont_serial PROPERTY POSITION_INDEPENDENT_CODE ON)
......
......@@ -47,10 +47,10 @@ add_library(vtkm_cont_tbb OBJECT
DeviceAdapterAlgorithmTBB.cxx
)
target_compile_options(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_options(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm_cont,INTERFACE_INCLUDE_DIRECTORIES>)
if(BUILD_SHARED_LIBS)
set_property(TARGET vtkm_cont_tbb PROPERTY POSITION_INDEPENDENT_CODE ON)
......
......@@ -187,7 +187,7 @@ elseif(VTKm_RENDERING_BACKEND STREQUAL "EGL")
endif()
#-----------------------------------------------------------------------------
target_link_libraries(vtkm_rendering PUBLIC vtkm)
target_link_libraries(vtkm_rendering PUBLIC vtkm_cont)
if(UNIX AND NOT APPLE)
target_link_libraries(vtkm_rendering PRIVATE rt )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment