diff --git a/CMakeLists.txt b/CMakeLists.txt index dac5c66507c166df71bc06cc1938c69b1b18e335..7135cc169c1b3f8363f7cfdc0515dad6225a05fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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.") diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index acdd28a96459496161ad610295eaeef7bde94291..be91bd70cde483029254bbf6bcde6b0cb1c76dd0 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -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}) diff --git a/external/aocommon b/external/aocommon index d2d64c1abfcc7c98963f50868e34e80a020d9244..2363df2242671d1835ca67952c16e3bde4a12148 160000 --- a/external/aocommon +++ b/external/aocommon @@ -1 +1 @@ -Subproject commit d2d64c1abfcc7c98963f50868e34e80a020d9244 +Subproject commit 2363df2242671d1835ca67952c16e3bde4a12148