-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
178 lines (145 loc) · 5.58 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
cmake_minimum_required (VERSION 3.12)
cmake_policy(SET CMP0054 OLD)
cmake_policy(SET CMP0042 NEW)
set(CMAKE_MACOSX_RPATH 1)
project(tabipb)
#set(CMAKE_VERBOSE_MAKEFILE ON)
set(TABIPB_ROOT ${PROJECT_SOURCE_DIR})
set(TABIPB_BUILD ${PROJECT_BINARY_DIR})
set(EXECUTABLE_OUTPUT_PATH ${TABIPB_BUILD}/bin)
set(EXECUTABLE_INSTALL_PATH bin)
################################################
##### For APBS Sphinx
################################################
option(ENABLE_TABIPB_SPHINX "open boundary element method-tabipb SPHINX" OFF)
if(ENABLE_TABIPB_SPHINX)
if(APPLE)
list(APPEND CMAKE_MODULE_LINKER_FLAGS "-Wl,-undefined,dynamic_lookup")
endif()
if(WIN32)
list(APPEND CMAKE_MODULE_LINKER_FLAGS "/LIBPATH:C:\Python34\libs")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../cmake")
find_package(PythonInterp 3.4 REQUIRED)
find_package(PythonInclude REQUIRED)
find_package(Cython REQUIRED)
include_directories("${PYTHON_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/tabipb_py.c"
COMMAND "${PYTHON_EXECUTABLE}" -m cython
-o "${CMAKE_CURRENT_BINARY_DIR}/tabipb_py.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/tabipb_sph.pyx"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/src/tabipb_sph.pyx")
add_library(tabipb_sph MODULE
tabipb_py.c
src/array.h
src/d_sign.c
src/daxpy.c
src/dcopy.c
src/ddot.c
src/dgemv.c
src/dnrm2.c
src/drot.c
src/drotg.c
src/dscal.c
src/dtrsv.c
src/f2c.h
src/gl_variables.c
src/gl_variables.h
src/gmres.c
src/readin.c
src/tabipb.c
src/TABIPBstruct.h
src/TABIPBWrap.c
src/treecode.c
src/treecode.h
src/xmalloc.c
src/xmalloc.h)
set_target_properties(tabipb_sph PROPERTIES PREFIX "")
endif()
################################################
##### Make a directory for the executable
################################################
file(MAKE_DIRECTORY build/bin)
include_directories("/src")
# FFLAGS depend on the compiler
get_filename_component (C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME)
if (C_COMPILER_NAME MATCHES "gcc.*")
#set (CMAKE_C_FLAGS_RELEASE "-c -O3")
set (CMAKE_C_FLAGS_DEBUG "")
elseif (C_COMPILER_NAME MATCHES "icc.*")
set (CMAKE_C_FLAGS_RELEASE "-fast -c")
set (CMAKE_C_FLAGS_DEBUG "")
else ()
message ("CMAKE_C_COMPILER full path: " ${CMAKE_C_COMPILER})
message ("C compiler: " ${C_COMPILER_NAME})
endif ()
# C code for standalone; don't include pp_timer.c in Windows version
if(WIN32)
add_executable(tabipb
src/main.c src/tabipb.c src/gmres.c src/daxpy.c src/dcopy.c src/ddot.c
src/dgemv.c src/dnrm2.c src/drot.c src/drotg.c src/dscal.c src/d_sign.c
src/dtrsv.c src/readin.c src/treecode.c src/gl_variables.c
src/xmalloc.c)
else()
add_executable(tabipb
src/main.c src/tabipb.c src/gmres.c src/daxpy.c src/dcopy.c src/ddot.c
src/dgemv.c src/dnrm2.c src/drot.c src/drotg.c src/dscal.c src/d_sign.c
src/dtrsv.c src/readin.c src/pp_timer.c src/treecode.c src/gl_variables.c
src/xmalloc.c)
endif()
################################################
###### APBS components
################################################
option(ENABLE_TABIPB_APBS "TABIPB APBS" OFF)
if(ENABLE_TABIPB_APBS)
add_definitions(-DTABIPB_APBS)
include_directories(
../../src/
../../tools/windows/configuration\ headers/
../../externals/fetk/maloc/src/base
../../externals/fetk/maloc/src/vsys
../../externals/fetk/maloc/src/vsh
../../externals/fetk/maloc/src/psh
)
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
# make sure that the default is a RELEASE
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)
# FFLAGS depend on the compiler
get_filename_component (C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME)
if (C_COMPILER_NAME MATCHES "gcc.*")
#set (CMAKE_C_FLAGS_RELEASE "-c -O3")
set (CMAKE_C_FLAGS_DEBUG "")
elseif (C_COMPILER_NAME MATCHES "icc.*")
set (CMAKE_C_FLAGS_RELEASE "-fast -c")
set (CMAKE_C_FLAGS_DEBUG "")
else ()
message ("CMAKE_C_COMPILER full path: " ${CMAKE_C_COMPILER})
message ("C compiler: " ${C_COMPILER_NAME})
endif ()
set (LIBFILES
src/TABIPBWrap.c src/tabipb.c src/gmres.c src/daxpy.c src/dcopy.c src/ddot.c
src/dgemv.c src/dnrm2.c src/drot.c src/drotg.c src/dscal.c src/d_sign.c
src/dtrsv.c src/readin.c src/treecode.c src/gl_variables.c src/xmalloc.c)
message(***** ${CMAKE_INSTALL_PREFIX} *****)
if(NOT DEFINED ${CMAKE_INSTALL_PREFIX})
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
set(TABIPB_LIBNAME TABIPBlib)
add_library(${TABIPB_LIBNAME} ${LIBFILES})
endif()
#Math linking is unnecessary for Windows
if(NOT WIN32)
target_link_libraries(tabipb m)
endif()
################################################
###### Install
################################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
install(TARGETS tabipb RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/bin)