diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d8960b..e348e4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR) project( ViennaRay LANGUAGES CXX - VERSION 2.0.1) + VERSION 2.0.3) # -------------------------------------------------------------------------------------------------------- # Library switches @@ -11,11 +11,20 @@ project( option(EMBREE_ISPC_SUPPORT "Enable Intel's SPMD Compiler" OFF) option(EMBREE_RAY_MASK "Enable Embree Ray Masking" OFF) -option(VIENNARAY_USE_WDIST "Enable weighted distribution of ray weights" OFF) option(VIENNARAY_DISABLE_COPY "Disable Embree Environment setup" OFF) +option(VIENNARAY_LEGACY_OPENMP "Use legacy OpenMP flags" OFF) + +option(VIENNARAY_USE_WDIST "Enable weighted distribution of ray weights" OFF) option(VIENNARAY_BUILD_EXAMPLES "Build examples" OFF) option(VIENNARAY_BUILD_TESTS "Build tests" OFF) +if (VIENNARAY_LEGACY_OPENMP) + message(STATUS "[ViennaRay] Using legacy OpenMP flags") + + find_package(OpenMP REQUIRED) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +endif() + # -------------------------------------------------------------------------------------------------------- # Library options # -------------------------------------------------------------------------------------------------------- @@ -124,8 +133,12 @@ CPMFindPackage( GIT_REPOSITORY "https://github.com/embree/embree" OPTIONS "EMBREE_TUTORIALS OFF") -find_package(OpenMP REQUIRED) -target_link_libraries(${PROJECT_NAME} INTERFACE OpenMP::OpenMP_CXX embree) +if (NOT VIENNARAY_LEGACY_OPENMP) + find_package(OpenMP REQUIRED) + target_link_libraries(${PROJECT_NAME} INTERFACE OpenMP::OpenMP_CXX) +endif() + +target_link_libraries(${PROJECT_NAME} INTERFACE embree) # -------------------------------------------------------------------------------------------------------- # Setup Examples diff --git a/cmake/openmp.cmake b/cmake/openmp.cmake index 0695112..c76155a 100644 --- a/cmake/openmp.cmake +++ b/cmake/openmp.cmake @@ -12,3 +12,7 @@ if(APPLE) set(OpenMP_omp_LIBRARY ${HOMEBREW_LIBOMP_PREFIX}/lib/libomp.dylib) endif() endif() + +if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp:llvm /bigobj") +endif()