-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
98 lines (82 loc) · 3.97 KB
/
CMakeLists.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.19)
project(LIBLDSC)
# Get the date
MACRO(TODAY RESULT YEAR MONTH DAY)
IF(WIN32)
EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
#string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3" ${YEAR} ${${RESULT}})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\2" ${MONTH} ${${RESULT}})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\1" ${DAY} ${${RESULT}})
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
#string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3" ${YEAR} ${${RESULT}})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\2" ${MONTH} ${${RESULT}})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\1" ${DAY} ${${RESULT}})
ELSE(WIN32)
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} 000000)
SET(${YEAR} 9999)
SET(${MONTH} 99)
SET(${DAY} 99)
ENDIF(WIN32)
ENDMACRO(TODAY)
TODAY(RESULT YEAR MONTH DAY)
message(STATUS "Compilation date = ${RESULT}")
# The version number.
set(${PROJECT_NAME}_VERSION_MAJOR ${YEAR})
set(${PROJECT_NAME}_VERSION_MINOR ${MONTH})
set(${PROJECT_NAME}_PATCH_LEVEL ${DAY})
# Detecting C++11 support
#if(CMAKE_COMPILER_IS_GNUCXX)
# execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
# if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
# message(STATUS "C++11 activated.")
# add_definitions("-std=gnu++11")
# elseif(GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3)
# message(WARNING "C++0x activated. If you get any errors update to a compiler which fully supports C++11")
# add_definitions("-std=gnu++0x")
# else ()
# message(FATAL_ERROR "C++11 needed. Therefore a gcc compiler with a version higher than 4.3 is needed.")
# endif()
#else(CMAKE_COMPILER_IS_GNUCXX)
# add_definitions("-std=c++0x")
#endif(CMAKE_COMPILER_IS_GNUCXX)
FIND_PACKAGE( OpenMP REQUIRED)
if(UNIX) # True for UNIX and UNIX like operating systems.
# set(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=gnu++11 -D__LINUX__ -D__INTEL__ -D__X11__ -D__MESA__ -D_GNU_SOURCE -std=gnu++11 -fopenmp -lgomp")
## Com otimização nivel O2 saida de switch (modelo=3) usando cout aparece M1 embora crie M3!
## set(CMAKE_CXX_FLAGS_RELEASE "-O2 -D_GNU_SOURCE -std=gnu++11 -fopenmp -lgomp")
set(CMAKE_CXX_FLAGS_RELEASE "-D_GNU_SOURCE -std=gnu++20 -fopenmp -lgomp")
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -D_GNU_SOURCE -std=gnu++20 -fopenmp -lgomp")
endif()
#else()
if(WIN32) # True on windows systems, including win64
# set(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=gnu++11 -fopenmp -lgomp")
set(CMAKE_CXX_FLAGS_RELEASE "-std=gnu++11 -fopenmp -lgomp")
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -D_GNU_SOURCE -std=gnu++20 -fopenmp -lgomp")
set(CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS}")
#set_target_properties(ldsc PROPERTIES LINK_FLAGS_RELEASE "-O2 -fopenmp -lgomp")
endif()
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_BUILD_TYPE Release)
#set(CMAKE_BUILD_TYPE Debug)
#set(PATH_LIB_LDSC "/home/puerari/desenv/libldsc/src/")
#file(MAKE_DIRECTORY lib)
#set(LIBRARY_OUTPUT_DIRECTORY lib)
#include_directories (${PATH_LIB_LDSC})
include_directories(${LIBLDSC_SOURCE_DIR}/src/)
link_directories(${LIBLDSC_SOURCE_DIR}/)
#message(FATAL_ERROR \${CMAKE_BUILD_TYPE}=${CMAKE_BUILD_TYPE})
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(demo)
if(WIN32) # True on windows systems, including win64
#set_target_properties(ldsc PROPERTIES LINK_FLAGS_RELEASE "-O2 -fopenmp -lgomp")
set_target_properties(ldsc PROPERTIES LINK_FLAGS_RELEASE "-fopenmp -lgomp")
set_target_properties(ldsc PROPERTIES LINK_FLAGS_DEBUG "-s -fopenmp -lgomp")
#set_target_properties(ldsc PROPERTIES LINK_FLAGS "-O2 -fopenmp -lgomp")
endif()
message(STATUS "BUILD TYPE = ${CMAKE_BUILD_TYPE}")