-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists-cflags.txt
38 lines (32 loc) · 2.07 KB
/
CMakeLists-cflags.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# cmake -G "Unix Makefiles" -B ./build -DCMAKE_BUILD_TYPE=Release
SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
SET( CMAKE_VERBOSE_MAKEFILE TRUE )
SET( BUILD_EXECUTABLE true )
SET( BUILD_SHARED true )
# /Gd Uses the __cdecl calling convention (x86 only).
# /Gr Uses the __fastcall calling convention (x86 only).
# /Gv Uses the __vectorcall calling convention. (x86 and x64 only)
# /Gz Uses the __stdcall calling convention (x86 only).
SET( CXX_WARN "-Wall -Wno-float-equal -Wno-padded")
SET( CLANG_WARN "-Wall -Wno-float-equal -Wno-padded")
SET( VS_WARN "")
IF( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
SET( CMAKE_CXX_FLAGS "-std=c++11 " )
SET( CMAKE_CXX_FLAGS_RELEASE "-fPIC -fopenmp -O3 -g -floop-interchange -floop-block -funroll-loops ${CXX_WARN}" )
SET( CMAKE_CXX_FLAGS_DEBUG "-fPIC -fopenmp -O0 -ggdb -DDEBUG ${CXX_WARN}" )
ELSEIF( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
SET( CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ " )
SET( CMAKE_CXX_FLAGS_RELEASE "-fPIC -O3 -g -finline-functions -finline-hint-functions -funroll-loops -fcolor-diagnostics ${CLANG_WARN}" )
SET( CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -gfull -fcolor-diagnostics -DDEBUG ${CLANG_WARN}" )
ELSEIF( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
SET( CMAKE_CXX_FLAGS "" )
SET( CMAKE_CXX_FLAGS_RELEASE "/nologo /GS /W3 /WX- /EHsc /bigobj /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /O2 /MD ${VS_WARN}" )
SET( CMAKE_CXX_FLAGS_DEBUG "/nologo /GS /W3 /WX- /EHsc /bigobj /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /Od /Ob0 /MDd /RTC1 /guard:cf /Zi /D_DEBUG /DMECHATRONIX_DEBUG ${VS_WARN}" )
ELSE()
MESSAGE( FATAL_ERROR "Unsupported compiler ${CMAKE_CXX_COMPILER_ID}")
ENDIF()
MESSAGE( STATUS "Compiler used: ${CMAKE_CXX_COMPILER_ID}")
SET( CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} )
SET( CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} )
SET( CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )
SET( EIGEN3_INCLUDE_DIR /usr/local/include/eigen3/ )