mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 10:59:18 -06:00
Add options for AVX, AVX2, AVX512 compilation options
Compile fix for scene.cpp
This commit is contained in:
@@ -110,6 +110,30 @@ endif()
|
||||
|
||||
option(OPENSPACE_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
|
||||
|
||||
if (MSVC)
|
||||
option(OPENSPACE_OPTIMIZATION_ENABLE_AVX "Enable AVX instruction set for compilation" OFF)
|
||||
option(OPENSPACE_OPTIMIZATION_ENABLE_AVX2 "Enable AVX2 instruction set for compilation" OFF)
|
||||
option(OPENSPACE_OPTIMIZATION_ENABLE_AVX512 "Enable AVX2 instruction set for compilation" OFF)
|
||||
option(OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS "Enable other optimizations, like LTCG, intrinsics, etc")
|
||||
|
||||
if (OPENSPACE_OPTIMIZATION_ENABLE_AVX AND OPENSPACE_OPTIMIZATION_ENABLE_AVX2)
|
||||
message(FATAL_ERROR "Cannot enable AVX and AVX2 instructions simultaneously")
|
||||
endif ()
|
||||
|
||||
if (OPENSPACE_OPTIMIZATION_ENABLE_AVX AND OPENSPACE_OPTIMIZATION_ENABLE_AVX512)
|
||||
message(FATAL_ERROR "Cannot enable AVX and AVX512 instructions simultaneously")
|
||||
endif()
|
||||
|
||||
if (OPENSPACE_OPTIMIZATION_ENABLE_AVX2 AND OPENSPACE_OPTIMIZATION_ENABLE_AVX512)
|
||||
message(FATAL_ERROR "Cannot enable AVX2 and AVX512 instructions simultaneously")
|
||||
endif()
|
||||
|
||||
set(GHOUL_OPTIMIZATION_ENABLE_AVX ${OPENSPACE_OPTIMIZATION_ENABLE_AVX} CACHE BOOL "" FORCE)
|
||||
set(GHOUL_OPTIMIZATION_ENABLE_AVX2 ${OPENSPACE_OPTIMIZATION_ENABLE_AVX2} CACHE BOOL "" FORCE)
|
||||
set(GHOUL_OPTIMIZATION_ENABLE_AVX512 ${OPENSPACE_OPTIMIZATION_ENABLE_AVX512} CACHE BOOL "" FORCE)
|
||||
set(GHOUL_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS ${OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS} CACHE BOOL "" FORCE)
|
||||
endif ()
|
||||
|
||||
include(src/CMakeLists.txt)
|
||||
|
||||
##########################################################################################
|
||||
@@ -132,6 +156,7 @@ endif()
|
||||
# Ghoul
|
||||
add_subdirectory(${OPENSPACE_EXT_DIR}/ghoul)
|
||||
target_link_libraries(openspace-core Ghoul)
|
||||
set_openspace_compile_settings(Ghoul)
|
||||
set_folder_location(Lua "External")
|
||||
set_folder_location(lz4 "External")
|
||||
set_folder_location(GhoulTest "Unit Tests")
|
||||
@@ -204,7 +229,6 @@ if (MSVC)
|
||||
target_include_directories(openspace-core PUBLIC "${OPENSPACE_NVTOOLS_PATH}/include")
|
||||
end_dependency()
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
|
||||
begin_header("Configuring Modules")
|
||||
|
||||
Submodule ext/ghoul updated: ab9b4d1763...dae112a3a0
@@ -34,6 +34,7 @@
|
||||
#include <openspace/scene/sceneinitializer.h>
|
||||
#include <openspace/scripting/lualibrary.h>
|
||||
#include <openspace/util/camera.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
|
||||
@@ -30,7 +30,6 @@ function (set_openspace_compile_settings project)
|
||||
target_compile_options(
|
||||
${project}
|
||||
PRIVATE
|
||||
"/ZI" # Edit and continue support
|
||||
"/MP" # Multi-threading support
|
||||
"/W4" # Highest warning level
|
||||
"/w44062" # enumerator 'identifier' in a switch of enum 'enumeration' is not handled
|
||||
@@ -81,8 +80,28 @@ function (set_openspace_compile_settings project)
|
||||
|
||||
# Boost as of 1.64 still uses unary_function unless we define this
|
||||
target_compile_definitions(${project} PRIVATE "_HAS_AUTO_PTR_ETC")
|
||||
|
||||
target_compile_definitions(${project} PRIVATE "NOMINMAX")
|
||||
|
||||
if (OPENSPACE_OPTIMIZATION_ENABLE_AVX)
|
||||
target_compile_options(${project} PRIVATE "/arch:AVX")
|
||||
endif ()
|
||||
if (OPENSPACE_OPTIMIZATION_ENABLE_AVX2)
|
||||
target_compile_options(${project} PRIVATE "/arch:AVX2")
|
||||
endif ()
|
||||
if (OPENSPACE_OPTIMIZATION_ENABLE_AVX512)
|
||||
target_compile_options(${project} PRIVATE "/arch:AVX512")
|
||||
endif ()
|
||||
|
||||
if (OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS)
|
||||
target_compile_options(${project} PRIVATE
|
||||
"/Oi" # usage of intrinsic functions
|
||||
"/GL" # Whole program optimization
|
||||
)
|
||||
else ()
|
||||
target_compile_options(${project} PRIVATE
|
||||
"/ZI" # Edit and continue support
|
||||
)
|
||||
endif ()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if (OPENSPACE_WARNINGS_AS_ERRORS)
|
||||
target_compile_options(${project} PRIVATE "-Werror")
|
||||
|
||||
Reference in New Issue
Block a user