ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/CMakeLists.txt
Revision: 1496
Committed: Wed Sep 8 20:42:24 2010 UTC (14 years, 9 months ago) by chuckv
Content type: text/plain
File size: 4714 byte(s)
Log Message:
Somewhat working cmake build system now. Does not yet build a parallel target. Builds all non-mpi programs.

File Contents

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