Skip to content

Commit

Permalink
[cmake] Use different build flags for MSVC and GCC
Browse files Browse the repository at this point in the history
- MSVC: bigobj is needed even in release mode
- Some flags are gcc specific and should not be added when using MSVC
- Add _USE_MATH_DEFINES for MSVC (needed for M_PI)
  • Loading branch information
fabiencastan committed Oct 24, 2018
1 parent a2ba31c commit b04efd5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
27 changes: 14 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,32 @@ ELSE()
ENDIF()

IF(MSVC)
add_compile_options(/wd4514 /wd4267 $<$<CONFIG:DEBUG>:/bigobj>)
add_compile_options(/wd4514 /wd4267 /bigobj)
add_definitions(-D_USE_MATH_DEFINES)
ELSE()
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)|(ARM64)|(aarch64)|(AARCH64)")
add_definitions (-Wall -march=armv8-a -O3)
add_definitions (-march=armv8-a)
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES
"(arm)|(ARM)|(armhf)|(ARMHF)|(armel)|(ARMEL)")
add_definitions (-Wall -march=armv7-a -O3)
add_definitions (-march=armv7-a)
ELSE ()
add_definitions (-Wall -march=native -O3) #TODO use correct c++11 def once everybody has moved to gcc 4.7 # for now I even removed std=gnu++0x
add_definitions (-march=native) #TODO use correct c++11 def once everybody has moved to gcc 4.7 # for now I even removed std=gnu++0x
ENDIF()
add_definitions (
-O3
-Wall
-Wextra
#-Werror
-Wwrite-strings
-Wno-unused-parameter
-fno-strict-aliasing
)
ENDIF()

IF(BUILD_POSITION_INDEPENDENT_CODE)
add_definitions( -fPIC )
ENDIF()

ADD_DEFINITIONS (
-Wall
-Wextra
#-Werror
-Wwrite-strings
-Wno-unused-parameter
-fno-strict-aliasing
)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")
find_package(Eigen REQUIRED)
set(ADDITIONAL_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIR}/unsupported)
Expand Down
1 change: 1 addition & 0 deletions src/math/roots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <opengv/math/roots.hpp>
#include <complex>
#include <math.h>

std::vector<double>
opengv::math::o3_roots( const std::vector<double> & p )
Expand Down

0 comments on commit b04efd5

Please sign in to comment.