ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/CMakeLists.txt
Revision: 1636
Committed: Thu Sep 15 19:08:55 2011 UTC (13 years, 8 months ago) by gezelter
Content type: text/plain
File size: 3632 byte(s)
Log Message:
fixed cmake build system for single and parallel targets

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 enable_language(CXX C)
16
17
18 if ( APPLE )
19 set(MPI_COMPILER /opt/local/lib/openmpi/bin/mpic++)
20 set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" )
21 endif( APPLE )
22 FIND_PACKAGE(MPI)
23 IF ( MPI_FOUND )
24 SET(CMAKE_REQUIRED_INCLUDES "${MPI_INCLUDE_PATH};${CMAKE_REQUIRED_INCLUDES}")
25 INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
26 ENDIF()
27
28 FIND_PACKAGE(Subversion)
29 IF ( Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn )
30 Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
31 MESSAGE("Current revision is ${Project_WC_REVISION}")
32 Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
33 SET(SVN_REV ${Project_WC_REVISION})
34 ADD_DEFINITIONS( -DSVN_REV=${Project_WC_REVISION} )
35 ENDIF()
36
37 # Optional libraries: If we can find these, we will build with them
38 # Look for OpenBabel libraries
39 find_package(OpenBabel2)
40 IF(OPENBABEL2_FOUND)
41 SET(USE_OPENBABEL)
42 include_directories(${OPENBABEL2_INCLUDE_DIR})
43 message(STATUS "Openbabel libs: " ${OPENBABEL2_LIBRARIES})
44 # TARGET_LINK_LIBRARIES(${OPENBABEL2_LIBRARIES})
45 ENDIF(OPENBABEL2_FOUND)
46
47 #Look for QHULL Libraries
48 find_package(QHULL)
49 IF(QHULL_FOUND)
50 SET(HAVE_QHULL 1)
51 include_directories(${QHULL_INCLUDE_DIR})
52 LINK_LIBRARIES(${QHULL_LIBRARIES})
53 ENDIF(QHULL_FOUND)
54
55
56 # zlib stuff
57 find_package(ZLIB)
58 if(ZLIB_FOUND)
59 SET(HAVE_LIBZ 1)
60 add_definitions(-DHAVE_LIBZ)
61 include_directories(${ZLIB_INCLUDE_DIR})
62 LINK_LIBRARIES(${ZLIB_LIBRARIES})
63 endif(ZLIB_FOUND)
64
65 #FFTW
66 INCLUDE(${CMAKE_MODULE_PATH}/FindFFTW.cmake)
67 IF(FFTW_FOUND)
68 SET(HAVE_LIBFFTW 1)
69 SET(HAVE_FFTW3_H)
70 INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIR})
71 LINK_LIBRARIES(${FFTW_LIBRARIES})
72 ENDIF(FFTW_FOUND)
73
74
75 #include checks
76 include(CheckIncludeFile)
77 CHECK_INCLUDE_FILE(fftw3.h HAVE_FFTW3_H)
78 CHECK_INCLUDE_FILE(fftw.h HAVE_FFWT_H)
79 CHECK_INCLUDE_FILE(dfftw.h HAVE_DFFTW_H)
80 CHECK_INCLUDE_FILE(cmath.h HAVE_CMATH_H)
81 check_include_file(limits.h HAVE_LIMITS_H)
82 check_include_file(stdlib.h HAVE_STDLIB_H)
83 check_include_file(string.h HAVE_STRING_H)
84 check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
85 check_include_file(unistd.h HAVE_UNISTD_H)
86
87 #symbol checks
88 include(CheckSymbolExists)
89
90 #function checks
91 include(CheckFunctionExists)
92 check_function_exists(atexit HAVE_ATEXIT)
93 check_function_exists(floor HAVE_FLOOR)
94 check_function_exists(pow HAVE_POW)
95 check_function_exists(select HAVE_SELECT)
96 check_function_exists(sqrt HAVE_SQRT)
97 check_function_exists(strcasecmp HAVE_STRCASECMP)
98 check_function_exists(strchr HAVE_STRCHR)
99 check_function_exists(strdup HAVE_STRDUP)
100 check_function_exists(strncasecmp HAVE_STRNCASECMP)
101 check_function_exists(strstr HAVE_STRSTR)
102 check_function_exists(strtol HAVE_STRTOL)
103 check_function_exists(strtoull HAVE_STRTOULL)
104 check_function_exists(sysmp HAVE_SYSMP)
105 check_function_exists(table HAVE_TABLE)
106
107
108 include(CMakePrintSystemInformation)
109
110 configure_file (
111 "${PROJECT_SOURCE_DIR}/src/config.h.cmake"
112 "${PROJECT_SOURCE_DIR}/src/config.h"
113 )
114 include_directories (${PROJECT_SOURCE_DIR}/src)
115
116 #CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
117
118
119 #Add executables for build
120 set (PROGRAMS openmd openmd_MPI Dump2XYZ simpleBuilder StaticProps DynamicProps
121 randomBuilder nanoparticleBuilder thermalizer atom2md Hydro)
122 # Example of how to set core libraries
123 #set(CORELIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} m)
124
125 #Add subirectories for build
126
127 add_subdirectory(lib)
128 add_subdirectory(bin)