1 |
chuckv |
1466 |
# Top level cmake script for OpenMD. |
2 |
|
|
|
3 |
|
|
cmake_minimum_required (VERSION 2.6) |
4 |
|
|
project(OpenMD) |
5 |
|
|
|
6 |
|
|
|
7 |
|
|
# OpenMD version number. |
8 |
chuckv |
1496 |
set (VERSION_MAJOR "2") |
9 |
|
|
set (VERSION_MINOR "0") |
10 |
|
|
set (VERSION_TINY "0") |
11 |
chuckv |
1466 |
|
12 |
|
|
# cmake modules that are needed to build oopse |
13 |
|
|
set (CMAKE_MODULE_PATH ${OpenMD_SOURCE_DIR}/cmake/modules) |
14 |
|
|
|
15 |
gezelter |
1626 |
enable_language(CXX C) |
16 |
chuckv |
1466 |
|
17 |
|
|
|
18 |
|
|
# Optional libraries: If we can find these, we will build with them |
19 |
|
|
# Look for OpenBabel libraries |
20 |
chuckv |
1496 |
find_package(OpenBabel2) |
21 |
|
|
IF(OPENBABEL2_FOUND) |
22 |
|
|
SET(USE_OPENBABEL) |
23 |
|
|
include_directories(${OPENBABEL2_INCLUDE_DIR}) |
24 |
|
|
message(STATUS "Openbabel libs: " ${OPENBABEL2_LIBRARIES}) |
25 |
|
|
# TARGET_LINK_LIBRARIES(${OPENBABEL2_LIBRARIES}) |
26 |
|
|
ENDIF(OPENBABEL2_FOUND) |
27 |
|
|
|
28 |
chuckv |
1466 |
#Look for QHULL Libraries |
29 |
|
|
find_package(QHULL) |
30 |
chuckv |
1496 |
IF(QHULL_FOUND) |
31 |
|
|
SET(HAVE_QHULL 1) |
32 |
chuckv |
1500 |
include_directories(${QHULL_INCLUDE_DIR}) |
33 |
chuckv |
1496 |
LINK_LIBRARIES(${QHULL_LIBRARIES}) |
34 |
|
|
ENDIF(QHULL_FOUND) |
35 |
chuckv |
1466 |
|
36 |
|
|
#Figure out MPI stuff |
37 |
chuckv |
1496 |
find_package(MPI) |
38 |
|
|
if(MPI_FOUND) |
39 |
|
|
SET(IS_MPI 1) |
40 |
|
|
#add_definitions(-DIS_MPI) |
41 |
|
|
endif(MPI_FOUND) |
42 |
chuckv |
1466 |
|
43 |
chuckv |
1496 |
#Add subversion Information |
44 |
|
|
find_package(Subversion) |
45 |
|
|
if(Subversion_FOUND) |
46 |
|
|
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} ER) |
47 |
|
|
set(SUBVERSION_REVISION ${ER_WC_REVISION}) |
48 |
|
|
endif(Subversion_FOUND) |
49 |
|
|
set(CPACK_PACKAGE_VERSION_PATCH "${SUBVERSION_REVISION}") |
50 |
chuckv |
1466 |
|
51 |
chuckv |
1496 |
# zlib stuff |
52 |
|
|
find_package(ZLIB) |
53 |
|
|
if(ZLIB_FOUND) |
54 |
|
|
SET(HAVE_LIBZ 1) |
55 |
|
|
add_definitions(-DHAVE_LIBZ) |
56 |
|
|
include_directories(${ZLIB_INCLUDE_DIR}) |
57 |
|
|
LINK_LIBRARIES(${ZLIB_LIBRARIES}) |
58 |
|
|
endif(ZLIB_FOUND) |
59 |
|
|
|
60 |
|
|
#FFTW |
61 |
|
|
INCLUDE(${CMAKE_MODULE_PATH}/FindFFTW.cmake) |
62 |
|
|
IF(FFTW_FOUND) |
63 |
|
|
SET(HAVE_LIBFFTW 1) |
64 |
|
|
SET(HAVE_FFTW3_H) |
65 |
|
|
INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIR}) |
66 |
|
|
LINK_LIBRARIES(${FFTW_LIBRARIES}) |
67 |
|
|
ENDIF(FFTW_FOUND) |
68 |
|
|
|
69 |
|
|
|
70 |
|
|
#include checks |
71 |
|
|
include(CheckIncludeFile) |
72 |
|
|
CHECK_INCLUDE_FILE(fftw3.h HAVE_FFTW3_H) |
73 |
|
|
CHECK_INCLUDE_FILE(fftw.h HAVE_FFWT_H) |
74 |
|
|
CHECK_INCLUDE_FILE(dfftw.h HAVE_DFFTW_H) |
75 |
|
|
CHECK_INCLUDE_FILE(cmath.h HAVE_CMATH_H) |
76 |
|
|
check_include_file (errno.h HAVE_ERRNO_H) |
77 |
|
|
check_include_file (inttypes.h HAVE_INTTYPES_H) |
78 |
|
|
check_include_file (limits.h HAVE_LIMITS_H) |
79 |
|
|
check_include_file (math.h HAVE_MATH_H) |
80 |
|
|
check_include_file (memory.h HAVE_MEMORY_H) |
81 |
|
|
check_include_file (stdint.h HAVE_STDINT_H) |
82 |
|
|
check_include_file (stdio.h HAVE_STDIO_H) |
83 |
|
|
check_include_file (stdlib.h HAVE_STDLIB_H) |
84 |
|
|
check_include_file (strings.h HAVE_STRINGS_H) |
85 |
|
|
check_include_file (string.h HAVE_STRING_H) |
86 |
|
|
check_include_file ("sys/param.h" HAVE_SYS_PARAM_H) |
87 |
|
|
check_include_file ("sys/pstat.h" HAVE_SYS_PSTAT_H) |
88 |
|
|
check_include_file ("sys/select.h" HAVE_SYS_SELECT_H) |
89 |
|
|
check_include_file ("sys/socket.h" HAVE_SYS_SOCKET_H) |
90 |
|
|
check_include_file ("sys/stat.h" HAVE_SYS_STAT_H) |
91 |
|
|
check_include_file ("sys/sysctl.h" HAVE_SYS_SYSCTL_H) |
92 |
|
|
check_include_file ("sys/sysinfo.h" HAVE_SYS_SYSINFO_H) |
93 |
|
|
check_include_file ("sys/param.h" HAVE_SYS_PARAM_H) |
94 |
|
|
check_include_file ("sys/sysmp.h" HAVE_SYS_SYSMP_H) |
95 |
|
|
check_include_file ("sys/systemcfg.h" HAVE_SYS_SYSTEMCFG_H) |
96 |
|
|
check_include_file ("sys/table.h" HAVE_SYS_TABLE_H) |
97 |
|
|
|
98 |
|
|
find_path (HAVE_SYS_STAT_H stat.h |
99 |
|
|
PATHS ${include_locations} |
100 |
|
|
PATH_SUFFIXES sys |
101 |
|
|
) |
102 |
|
|
|
103 |
|
|
find_path (HAVE_SYS_TYPES_H types.h |
104 |
|
|
PATHS ${include_locations} |
105 |
|
|
PATH_SUFFIXES sys |
106 |
|
|
) |
107 |
|
|
find_path (HAVE_UNISTD_H unistd.h ${include_locations}) |
108 |
|
|
|
109 |
|
|
#symbol checks |
110 |
|
|
include(CheckSymbolExists) |
111 |
|
|
|
112 |
|
|
|
113 |
|
|
#function checks |
114 |
|
|
include(CheckFunctionExists) |
115 |
|
|
check_function_exists(floor HAVE_FLOOR) |
116 |
|
|
check_function_exists (memset HAVE_MEMSET) |
117 |
|
|
check_function_exists (pow HAVE_POW) |
118 |
|
|
check_function_exists (sqrt HAVE_SQRT) |
119 |
|
|
check_function_exists (strchr HAVE_STRCHR) |
120 |
|
|
check_function_exists (strstr HAVE_STRSTR) |
121 |
|
|
check_function_exists (sysmp HAVE_SYSMP) |
122 |
|
|
check_function_exists (table HAVE_TABLE) |
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
include(CMakePrintSystemInformation) |
127 |
|
|
|
128 |
|
|
configure_file ( |
129 |
|
|
"${PROJECT_SOURCE_DIR}/src/config.h.cmake" |
130 |
|
|
"${PROJECT_SOURCE_DIR}/src/config.h" |
131 |
|
|
) |
132 |
|
|
include_directories (${PROJECT_SOURCE_DIR}/src) |
133 |
|
|
|
134 |
|
|
#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) |
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
chuckv |
1466 |
#Add executables for build |
139 |
|
|
set (PROGRAMS openmd Dump2XYZ simpleBuilder StaticProps DynamicProps |
140 |
|
|
randomBuilder nanoparticleBuilder thermalizer atom2md Hydro) |
141 |
|
|
# Example of how to set core libraries |
142 |
|
|
#set(CORELIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} m) |
143 |
|
|
|
144 |
chuckv |
1496 |
#foreach(program ${PROGRAMS}) |
145 |
|
|
# add_executable(${program} ${program}.cpp) |
146 |
|
|
# target_link_libraries(${program} ${CORELIBS}) |
147 |
|
|
#endforeach(program) |
148 |
chuckv |
1466 |
|
149 |
chuckv |
1496 |
#add_subdirectory(src/lattice) |
150 |
|
|
#add_subdirectory(src/brains) |
151 |
|
|
#add_subdirectory(src/UseTheForce) |
152 |
chuckv |
1466 |
|
153 |
|
|
|
154 |
|
|
#Add subirectories for build |
155 |
|
|
|
156 |
|
|
|
157 |
chuckv |
1496 |
#add_subdirectory(src) |
158 |
|
|
add_subdirectory(lib) |
159 |
|
|
add_subdirectory(bin) |