ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/CMakeLists.txt
Revision: 1500
Committed: Thu Sep 9 16:03:47 2010 UTC (14 years, 8 months ago) by chuckv
Content type: text/plain
File size: 4758 byte(s)
Log Message:
More fixes for cmake.

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 include_directories(${QHULL_INCLUDE_DIR})
45 LINK_LIBRARIES(${QHULL_LIBRARIES})
46 ENDIF(QHULL_FOUND)
47
48 #Figure out MPI stuff
49 find_package(MPI)
50 if(MPI_FOUND)
51 SET(IS_MPI 1)
52 #add_definitions(-DIS_MPI)
53 endif(MPI_FOUND)
54
55 #Add subversion Information
56 find_package(Subversion)
57 if(Subversion_FOUND)
58 Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} ER)
59 set(SUBVERSION_REVISION ${ER_WC_REVISION})
60 endif(Subversion_FOUND)
61 set(CPACK_PACKAGE_VERSION_PATCH "${SUBVERSION_REVISION}")
62
63 # zlib stuff
64 find_package(ZLIB)
65 if(ZLIB_FOUND)
66 SET(HAVE_LIBZ 1)
67 add_definitions(-DHAVE_LIBZ)
68 include_directories(${ZLIB_INCLUDE_DIR})
69 LINK_LIBRARIES(${ZLIB_LIBRARIES})
70 endif(ZLIB_FOUND)
71
72 #FFTW
73 INCLUDE(${CMAKE_MODULE_PATH}/FindFFTW.cmake)
74 IF(FFTW_FOUND)
75 SET(HAVE_LIBFFTW 1)
76 SET(HAVE_FFTW3_H)
77 INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIR})
78 LINK_LIBRARIES(${FFTW_LIBRARIES})
79 ENDIF(FFTW_FOUND)
80
81
82 #include checks
83 include(CheckIncludeFile)
84 CHECK_INCLUDE_FILE(fftw3.h HAVE_FFTW3_H)
85 CHECK_INCLUDE_FILE(fftw.h HAVE_FFWT_H)
86 CHECK_INCLUDE_FILE(dfftw.h HAVE_DFFTW_H)
87 CHECK_INCLUDE_FILE(cmath.h HAVE_CMATH_H)
88 check_include_file (errno.h HAVE_ERRNO_H)
89 check_include_file (inttypes.h HAVE_INTTYPES_H)
90 check_include_file (limits.h HAVE_LIMITS_H)
91 check_include_file (math.h HAVE_MATH_H)
92 check_include_file (memory.h HAVE_MEMORY_H)
93 check_include_file (stdint.h HAVE_STDINT_H)
94 check_include_file (stdio.h HAVE_STDIO_H)
95 check_include_file (stdlib.h HAVE_STDLIB_H)
96 check_include_file (strings.h HAVE_STRINGS_H)
97 check_include_file (string.h HAVE_STRING_H)
98 check_include_file ("sys/param.h" HAVE_SYS_PARAM_H)
99 check_include_file ("sys/pstat.h" HAVE_SYS_PSTAT_H)
100 check_include_file ("sys/select.h" HAVE_SYS_SELECT_H)
101 check_include_file ("sys/socket.h" HAVE_SYS_SOCKET_H)
102 check_include_file ("sys/stat.h" HAVE_SYS_STAT_H)
103 check_include_file ("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
104 check_include_file ("sys/sysinfo.h" HAVE_SYS_SYSINFO_H)
105 check_include_file ("sys/param.h" HAVE_SYS_PARAM_H)
106 check_include_file ("sys/sysmp.h" HAVE_SYS_SYSMP_H)
107 check_include_file ("sys/systemcfg.h" HAVE_SYS_SYSTEMCFG_H)
108 check_include_file ("sys/table.h" HAVE_SYS_TABLE_H)
109
110
111
112 find_path (HAVE_SYS_STAT_H stat.h
113 PATHS ${include_locations}
114 PATH_SUFFIXES sys
115 )
116
117 find_path (HAVE_SYS_TYPES_H types.h
118 PATHS ${include_locations}
119 PATH_SUFFIXES sys
120 )
121 find_path (HAVE_UNISTD_H unistd.h ${include_locations})
122
123 #symbol checks
124 include(CheckSymbolExists)
125
126
127 #function checks
128 include(CheckFunctionExists)
129 check_function_exists(floor HAVE_FLOOR)
130 check_function_exists (memset HAVE_MEMSET)
131 check_function_exists (pow HAVE_POW)
132 check_function_exists (sqrt HAVE_SQRT)
133 check_function_exists (strchr HAVE_STRCHR)
134 check_function_exists (strstr HAVE_STRSTR)
135 check_function_exists (sysmp HAVE_SYSMP)
136 check_function_exists (table HAVE_TABLE)
137
138
139
140 include(CMakePrintSystemInformation)
141
142 configure_file (
143 "${PROJECT_SOURCE_DIR}/src/config.h.cmake"
144 "${PROJECT_SOURCE_DIR}/src/config.h"
145 )
146 include_directories (${PROJECT_SOURCE_DIR}/src)
147
148 #CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
149
150
151
152 #Add executables for build
153 set (PROGRAMS openmd Dump2XYZ simpleBuilder StaticProps DynamicProps
154 randomBuilder nanoparticleBuilder thermalizer atom2md Hydro)
155 # Example of how to set core libraries
156 #set(CORELIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} m)
157
158 #foreach(program ${PROGRAMS})
159 # add_executable(${program} ${program}.cpp)
160 # target_link_libraries(${program} ${CORELIBS})
161 #endforeach(program)
162
163 #add_subdirectory(src/lattice)
164 #add_subdirectory(src/brains)
165 #add_subdirectory(src/UseTheForce)
166
167
168 #Add subirectories for build
169
170
171 #add_subdirectory(src)
172 add_subdirectory(lib)
173 add_subdirectory(bin)