-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
230 lines (192 loc) · 7.37 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
cmake_minimum_required(VERSION 3.16)
project(bipart
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
message(STATUS "Detecting environment variable $ENV{ACT_HOME}...")
if (DEFINED ENV{ACT_HOME})
message(STATUS "Environment variable ACT_HOME detected: " $ENV{ACT_HOME})
else ()
message(FATAL_ERROR "Environment variable $ENV{ACT_HOME} not found")
endif ()
include_directories($ENV{ACT_HOME}/include)
link_directories($ENV{ACT_HOME}/lib)
find_library(PHYDB_LIBRARY
NAMES phydb
PATHS $ENV{ACT_HOME}/lib
REQUIRED)
if (NOT PHYDB_LIBRARY)
link_directories($ENV{ACT_HOME}/lib)
set(PHYDB_LIBRARY $ENV{ACT_HOME}/lib)
#message(FATAL_ERROR "libphydb.a is not found")
else ()
message(STATUS "libphydb.a found")
endif()
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
message(STATUS "Detecting environment variable LEF_ROOT...")
set(LEF_ROOT "")
if (DEFINED ENV{LEF_ROOT})
message(STATUS "Environment variable LEF_ROOT detected: " $ENV{LEF_ROOT})
include_directories($ENV{LEF_ROOT}/include)
link_directories($ENV{LEF_ROOT}/lib)
set(LEF_ROOT $ENV{LEF_ROOT})
else ()
message(STATUS "Environment variable LEF_ROOT not found, using ACT_HOME instead")
include_directories($ENV{ACT_HOME}/include)
link_directories($ENV{ACT_HOME}/lib)
set(LEF_ROOT $ENV{ACT_HOME})
endif ()
#include_directories($ENV{LEF_ROOT}/include)
#link_directories($ENV{LEF_ROOT}/lib)
find_library(LEF_LIBRARY
NAMES lef
PATHS $ENV{LEF_ROOT}/lib
REQUIRED)
if (NOT LEF_LIBRARY)
message(FATAL_ERROR "liblef.a is not found")
else ()
message(STATUS "liblef.a found")
endif()
message(STATUS "Detecting environment variable DEF_ROOT...")
set(DEF_ROOT "")
if (DEFINED ENV{DEF_ROOT})
message(STATUS "Environment variable DEF_ROOT detected: " $ENV{DEF_ROOT})
include_directories($ENV{DEF_ROOT}/include)
link_directories($ENV{DEF_ROOT}/lib)
set(DEF_ROOT $ENV{DEF_ROOT})
else ()
message(STATUS "Environment variable DEF_ROOT not found, using ACT_HOME instead")
include_directories($ENV{ACT_HOME}/include)
link_directories($ENV{ACT_HOME}/lib)
set(DEF_ROOT $ENV{ACT_HOME})
endif ()
find_library(DEF_LIBRARY
NAMES def
PATHS $ENV{DEF_ROOT}/lib
REQUIRED)
if (NOT DEF_LIBRARY)
message(FATAL_ERROR "libdef.a is not found")
else ()
message(STATUS "libdef.a found")
endif()
message(STATUS "Detecting environment variable $ENV{GALOIS_INCLUDE}...")
if (DEFINED ENV{GALOIS_INCLUDE})
message(STATUS "Environment variable GALOIS_INCLUDE detected: " $ENV{GALOIS_INCLUDE})
else ()
message(FATAL_ERROR "Environment variable $ENV{GALOIS_INCLUDE} not found")
endif ()
message(STATUS "Detecting Galois libraries...")
set(Galois_FOUND TRUE)
find_library(
GALOIS_EDA_LIBRARY
NAMES galois_eda
PATHS $ENV{ACT_HOME}/lib
)
if (GALOIS_EDA_LIBRARY)
set(Galois_LIBRARIES ${GALOIS_EDA_LIBRARY})
message(STATUS "Found libgalois_eda.a: " ${GALOIS_EDA_LIBRARY})
else()
message(STATUS "Cannot find libgalois_eda.a")
set(Galois_FOUND FALSE)
endif()
find_library(
GALOIS_SHMEM_LIBRARY
NAMES galois_shmem
PATHS $ENV{ACT_HOME}/lib
)
if (GALOIS_SHMEM_LIBRARY)
set(Galois_LIBRARIES ${Galois_LIBRARIES} ${GALOIS_SHMEM_LIBRARY})
message(STATUS "Found libgalois_shmem.a: " ${GALOIS_SHMEM_LIBRARY})
else()
message(STATUS "Cannot find libgalois_shmem.a")
set(Galois_FOUND FALSE)
endif()
if (UNIX AND (NOT APPLE))
find_library(
NUMA_LIBRARY
NAMES numa
)
if (NUMA_LIBRARY)
set(Galois_LIBRARIES ${Galois_LIBRARIES} ${NUMA_LIBRARY})
message(STATUS "Found libnuma: " ${NUMA_LIBRARY})
else()
message(STATUS "Cannot find libnuma")
set(Galois_FOUND FALSE)
endif()
endif()
include_directories($ENV{GALOIS_INCLUDE})
#include_directories($ENV{PHYDB_INCLUDE})
#include_directories("/net/ohm/export/iss/sepideh/act/install/include")
#include_directories("/net/ohm/export/cdgc/michael/GaloisCpp-github/Galois/lonestar/liblonestar/include")
#include_directories("/net/ohm/export/iss/sepideh/Galois/libgalois/include")
#include_directories("/net/ohm/export/iss/sepideh/Galois/build/libgalois/include")
#include_directories("/net/ohm/export/iss/sepideh/Galois/lonestar/liblonestar/include")
#include_directories("/org/centers/cdgc/sw/llvm-10.0.0/include")
link_directories($ENV{GALOIS_LIB})
find_library(GALOIS_LIB
NAMES galois_shmem
PATHS $ENV{GALOIS_LIB}
REQUIRED)
if (NOT GALOIS_LIB)
message(FATAL_ERROR "libgalois_shmem.a is not found")
else ()
message(STATUS "libgalois_shmem.a found")
endif()
find_package(Boost 1.69.0 REQUIRED)
message(STATUS "Boost library path: ${Boost_LIBRARY_DIRS}")
message(STATUS "Boost include path: ${Boost_INCLUDE_DIR}")
message(STATUS "Boost libs: ${Boost_LIBRARIES}")
include_directories(${Boost_INCLUDE_DIRS})
# Set a default build type if none was specified
set(default_build_type "RELEASE")
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}")
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"DEBUG" "RELEASE")
endif ()
#add_compile_options(-Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic)
#set(CMAKE_CXX_FLAGS_DEBUG "-g -Wno-unused-variable -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-unused-function -Wno-shadow -Wno-unused-parameter")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG -Wno-unused-variable -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-unused-function -Wno-shadow -Wno-unused-parameter")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -DNDEBUG -Wno-unused-variable -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-unused-function -Wno-shadow -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
# Set the output directory of static libraries
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
# Set the output directory of executables
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
include_directories(include)
FILE(GLOB SOURCES "src/*.cpp")
#list(FILTER CPP_SOURCES EXCLUDE REGEX main)
#FILE(GLOB C_SOURCES "src/*.c")
add_subdirectory(test)
add_library(bipart
STATIC
${SOURCES})
target_link_libraries(bipart
lef def phydb ${Galois_LIBRARIES} pthread)
#add_executable(bipart_test
# test/main.cpp)
#target_link_libraries(bipart_test
# lef def galois_shmem galois_eda numa bipart phydb pthread)
######################################
# specify the installation directory: ${ACT_HOME}
######################################
message(STATUS "Detecting environment variable ACT_HOME...")
if (DEFINED ENV{ACT_HOME})
message(STATUS "Environment variable ACT_HOME detected: " $ENV{ACT_HOME})
else ()
message(FATAL_ERROR "Environment variable ACT_HOME not found")
endif ()
message(STATUS "Changing Installation directory to ACT_HOME")
set(CMAKE_INSTALL_PREFIX $ENV{ACT_HOME} CACHE PATH "installation path" FORCE)
message(STATUS "Current installation directory: " ${CMAKE_INSTALL_PREFIX})
######################################
# Install header files
######################################
install(DIRECTORY include/ DESTINATION include/bipart COMPONENT Development FILES_MATCHING PATTERN "*.h")
######################################
# Install library
######################################
install(TARGETS bipart
DESTINATION lib)