Skip to content

Commit

Permalink
Use cmake avx helper from core
Browse files Browse the repository at this point in the history
  • Loading branch information
alxvth committed Oct 29, 2024
1 parent 547eb0d commit bb0b57b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 57 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ set(CMAKE_AUTOUIC ON)
# macros for linking both prebuilt artifactory libraries and locally built ones
include(CMakeLinkUtilities)

# Test hardware avx capabilities
include(CMakeSetOptimizationAndAVX)
# set optimization in release mode
include(CMakeSetOptimizationLevel)

if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32 /EHsc /MP /permissive- /Zc:__cplusplus")
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeHsneProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ set_HDILib_project_link_libraries(${HSNE_PLUGIN})
set_lz4_project_link_libraries(${HSNE_PLUGIN})

set_optimization_level(${HSNE_PLUGIN} ${MV_SNE_OPTIMIZATION_LEVEL})
check_and_set_AVX(${HSNE_PLUGIN} ${MV_SNE_USE_AVX})
mv_check_and_set_AVX(${HSNE_PLUGIN} ${MV_SNE_USE_AVX})

silence_opengl_deprecation(${HSNE_PLUGIN})

Expand Down
53 changes: 0 additions & 53 deletions cmake/CMakeSetOptimizationAndAVX.cmake

This file was deleted.

20 changes: 20 additions & 0 deletions cmake/CMakeSetOptimizationLevel.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -----------------------------------------------------------------------------
# Sets the optimization level
# -----------------------------------------------------------------------------
macro(set_optimization_level target level)
message(STATUS "Set optimization level in release for ${target} to ${level}")

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
set(OPTIMIZATION_LEVEL_FLAG "-O${level}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(${level} EQUAL 0)
set(OPTIMIZATION_LEVEL_FLAG "/Od")
else()
set(OPTIMIZATION_LEVEL_FLAG "/O${level}")
endif()
endif()

target_compile_options(${target} PRIVATE "$<$<CONFIG:Release>:${OPTIMIZATION_LEVEL_FLAG}>")

message( STATUS "Optimization level for ${target} (release) is ${OPTIMIZATION_LEVEL_FLAG}")
endmacro()
2 changes: 1 addition & 1 deletion cmake/CMakeTsneProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ set_HDILib_project_link_libraries(${TSNE_PLUGIN})
set_lz4_project_link_libraries(${TSNE_PLUGIN})

set_optimization_level(${TSNE_PLUGIN} ${MV_SNE_OPTIMIZATION_LEVEL})
check_and_set_AVX(${TSNE_PLUGIN} ${MV_SNE_USE_AVX})
mv_check_and_set_AVX(${TSNE_PLUGIN} ${MV_SNE_USE_AVX})

silence_opengl_deprecation(${TSNE_PLUGIN})

Expand Down

0 comments on commit bb0b57b

Please sign in to comment.