From 1b5f726899b5b09f3bccfe45a3adaad4092656a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 16 Oct 2017 11:47:29 +0200 Subject: [PATCH 1/3] CMake: Drop support for OPT_FLAGS 1. Adding -march=native flag by default is bad idea, because this makes the library not portable. 2. If you want to optimize with -march=native just do cmake -DCMAKE_CXX_FLAGS='-march=native -mtune=native' --- CMakeLists.txt | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b531dab0..5cc524e9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,14 +81,6 @@ option( ON ) -set( - OPT_FLAGS - "" - CACHE - STRING - "Override C++ compiler optimization flags" -) - if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # Common compilation flags and warning configuration set( @@ -98,20 +90,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if("${MULTICORE}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") endif() - # Default optimizations flags (to override, use -DOPT_FLAGS=...) - if("${OPT_FLAGS}" STREQUAL "") - set( - OPT_FLAGS - "-ggdb3 -O2 -march=native -mtune=native" - ) - endif() endif() -set( - CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} ${OPT_FLAGS}" -) - find_path(GMP_INCLUDE_DIR NAMES gmp.h) find_library(GMP_LIBRARY gmp) if(GMP_LIBRARY MATCHES ${CMAKE_SHARED_LIBRARY_SUFFIX}) From 059d951b44e3d3383814a98fde460de3d6e932e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 16 Oct 2017 12:29:41 +0200 Subject: [PATCH 2/3] CMake: Include FindPkgConfig only if needed --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cc524e9..7f491653 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,9 +107,8 @@ set_target_properties( INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE_DIR} ) -include(FindPkgConfig) - if("${WITH_PROCPS}") + include(FindPkgConfig) pkg_check_modules( PROCPS REQUIRED From 4a6ad21c8971a0b141db13c4bab5f6b966fec504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 16 Oct 2017 12:29:57 +0200 Subject: [PATCH 3/3] CMake: Set default build type to RelWithDebInfo --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f491653..fbe563aa 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 2.8) project (libff) +# Default to RelWithDebInfo configuration if no configuration is explicitly specified. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type on single-configuration generators" FORCE) +endif() + set( CURVE "BN128"