Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setting of PDAF optimization flags #23

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions cmake/BuildPDAF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,48 @@ list(JOIN PDAF_LINK_LIBS " " PDAF_LINK_LIBS)

# Set PDAF_OPTIM for Makefile header
# ----------------------------------
list(APPEND PDAF_OPTIM "-O2")
list(APPEND PDAF_OPTIM "-xHost")
list(APPEND PDAF_OPTIM "-r8")

# For Gnu-compiler
# list(APPEND PDAF_OPTIM "-O2 -xHost -fbacktrace -fdefault-real-8 -falign-commons -fno-automatic -finit-local-zero -mcmodel=large")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")

# using Intel Compiler
if (CMAKE_BUILD_TYPE STREQUAL "RELEASE")
# Release optimization flags
list(APPEND PDAF_OPTIM "-O2")
elseif (CMAKE_BUILD_TYPE STREQUAL "DEBUG")
# Debug optimization flags
list(APPEND PDAF_OPTIM "-O0")
list(APPEND PDAF_OPTIM "-g")
list(APPEND PDAF_OPTIM "-traceback")
else()
message(FATAL_ERROR "Unsupported CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()

list(APPEND PDAF_OPTIM "-xHost")
list(APPEND PDAF_OPTIM "-r8")

elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

# using GCC (experimental)
if (CMAKE_BUILD_TYPE STREQUAL "RELEASE")
# Release optimization flags
list(APPEND PDAF_OPTIM "-O2")
elseif (CMAKE_BUILD_TYPE STREQUAL "DEBUG")
# Debug optimization flags
list(APPEND PDAF_OPTIM "-O0")
list(APPEND PDAF_OPTIM "-g")
list(APPEND PDAF_OPTIM "-fbacktrace")
else()
message(FATAL_ERROR "Unsupported CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()

list(APPEND PDAF_OPTIM "-fdefault-real-8")
list(APPEND PDAF_OPTIM "-falign-commons")
list(APPEND PDAF_OPTIM "-fno-automatic")
list(APPEND PDAF_OPTIM "-finit-local-zero")
list(APPEND PDAF_OPTIM "-mcmodel=large")

else()
message(FATAL_ERROR "Unsupported CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
endif()

# Join list
list(JOIN PDAF_OPTIM " " PDAF_OPTIM)
Expand Down