Skip to content

Commit

Permalink
Wrap MSVC-specific options with guards
Browse files Browse the repository at this point in the history
  • Loading branch information
janisozaur committed Nov 24, 2017
1 parent 43bf4bd commit 3a278db
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
34 changes: 18 additions & 16 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ file(GLOB_RECURSE ACL_UNIT_TEST_SOURCE_FILES ${PROJECT_SOURCE_DIR}/sources/*.cpp

add_executable(acl_unit_tests ${ACL_UNIT_TEST_SOURCE_FILES})

# Replace some default compiler switches and add new ones
STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Bump warnings to W4
target_compile_options(acl_unit_tests PRIVATE /Zi) # Add debug info
target_compile_options(acl_unit_tests PRIVATE /Oi) # Generate intrinsic functions

# Disable some warnings
target_compile_options(acl_unit_tests PRIVATE /wd4100) # unreferenced formal parameter
target_compile_options(acl_unit_tests PRIVATE /wd4324) # structure was padded due to alignment specified
target_compile_options(acl_unit_tests PRIVATE /wd4127) # conditional expression is constant

if(USE_AVX_INSTRUCTIONS)
target_compile_options(acl_unit_tests PRIVATE "/arch:AVX")
if(MSVC)
# Replace some default compiler switches and add new ones
STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Bump warnings to W4
target_compile_options(acl_unit_tests PRIVATE /Zi) # Add debug info
target_compile_options(acl_unit_tests PRIVATE /Oi) # Generate intrinsic functions

# Disable some warnings
target_compile_options(acl_unit_tests PRIVATE /wd4100) # unreferenced formal parameter
target_compile_options(acl_unit_tests PRIVATE /wd4324) # structure was padded due to alignment specified
target_compile_options(acl_unit_tests PRIVATE /wd4127) # conditional expression is constant

if(USE_AVX_INSTRUCTIONS)
target_compile_options(acl_unit_tests PRIVATE "/arch:AVX")
endif()

# Add linker flags
set(CMAKE_EXE_LINKER_FLAGS /DEBUG)
endif()

# Add linker flags
set(CMAKE_EXE_LINKER_FLAGS /DEBUG)

install(TARGETS acl_unit_tests RUNTIME DESTINATION bin)
34 changes: 18 additions & 16 deletions tools/acl_compressor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ file(GLOB_RECURSE ACL_COMPRESSOR_SOURCE_FILES

add_executable(acl_compressor ${ACL_COMPRESSOR_SOURCE_FILES})

# Replace some default compiler switches and add new ones
STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Bump warnings to W4
target_compile_options(acl_compressor PRIVATE /Zi) # Add debug info
target_compile_options(acl_compressor PRIVATE /Oi) # Generate intrinsic functions

# Disable some warnings
target_compile_options(acl_compressor PRIVATE /wd4100) # unreferenced formal parameter
target_compile_options(acl_compressor PRIVATE /wd4324) # structure was padded due to alignment specified
target_compile_options(acl_compressor PRIVATE /wd4127) # conditional expression is constant

if(USE_AVX_INSTRUCTIONS)
target_compile_options(acl_compressor PRIVATE "/arch:AVX")
if(MSVC)
# Replace some default compiler switches and add new ones
STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Bump warnings to W4
target_compile_options(acl_compressor PRIVATE /Zi) # Add debug info
target_compile_options(acl_compressor PRIVATE /Oi) # Generate intrinsic functions

# Disable some warnings
target_compile_options(acl_compressor PRIVATE /wd4100) # unreferenced formal parameter
target_compile_options(acl_compressor PRIVATE /wd4324) # structure was padded due to alignment specified
target_compile_options(acl_compressor PRIVATE /wd4127) # conditional expression is constant

if(USE_AVX_INSTRUCTIONS)
target_compile_options(acl_compressor PRIVATE "/arch:AVX")
endif()

# Add linker flags
set(CMAKE_EXE_LINKER_FLAGS /DEBUG)
endif()

# Add linker flags
set(CMAKE_EXE_LINKER_FLAGS /DEBUG)

install(TARGETS acl_compressor RUNTIME DESTINATION bin)

0 comments on commit 3a278db

Please sign in to comment.