Skip to content
Snippets Groups Projects
Commit e0bc68d2 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

Use SetTargetCPU from aocommon

parent 9f9fb200
No related branches found
No related tags found
1 merge request!127Use SetTargetCPU from aocommon
Pipeline #85477 passed
......@@ -6,7 +6,8 @@ include(ExternalProject)
# When Radler is compiled as an ExternalProject inside another project, set this
# option to On. See, e.g., the wsclean CMake file for an example.
option(COMPILE_AS_EXTERNAL_PROJECT OFF)
option(PORTABLE "Generate portable code" OFF)
option(PORTABLE "Build portable binaries (with slightly decreased performance)"
OFF)
option(BUILD_PYTHON_BINDINGS "Build python bindings" OFF)
option(BUILD_DOCUMENTATION "Build documentation" OFF)
option(BUILD_DOCSTRINGS "Build docstrings (implies BUILD_DOCUMENTATION)" OFF)
......@@ -47,15 +48,6 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-DNDEBUG)
endif()
include(CheckCXXCompilerFlag)
if(PORTABLE)
if(DEFINED TARGET_CPU)
message(WARNING "You have selected to build PORTABLE binaries. "
"TARGET_CPU settings will be ignored.")
unset(TARGET_CPU CACHE)
endif()
endif()
if(NOT COMPILE_AS_EXTERNAL_PROJECT)
# Include submodules
set(ExternalSubmoduleDirectories aocommon pybind11 schaapcommon)
......@@ -93,6 +85,9 @@ if(NOT COMPILE_AS_EXTERNAL_PROJECT)
endif()
endif()
# User may optionally set `TARGET_CPU` if `PORTABLE=OFF`
include(external/aocommon/CMake/SetTargetCPU.cmake)
if(COMPILE_AS_EXTERNAL_PROJECT)
message(
STATUS "Radler is compiled as an external project within another project.")
......
......@@ -69,20 +69,6 @@ target_include_directories(
target_compile_options(radler PRIVATE -O3 -Wall -Wzero-as-null-pointer-constant)
if(NOT PORTABLE)
if(DEFINED TARGET_CPU)
target_compile_options(radler BEFORE PRIVATE -march=${TARGET_CPU})
else()
check_cxx_compiler_flag("-march=native" COMPILER_HAS_MARCH_NATIVE)
if(COMPILER_HAS_MARCH_NATIVE)
target_compile_options(radler BEFORE PRIVATE -march=native)
else()
message(
WARNING "The compiler doesn't support -march=native for your CPU.")
endif()
endif()
endif()
if(NOT COMPILE_AS_EXTERNAL_PROJECT)
include(GNUInstallDirs)
install(TARGETS radler ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
......
Subproject commit d2d64c1abfcc7c98963f50868e34e80a020d9244
Subproject commit 2363df2242671d1835ca67952c16e3bde4a12148
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment