]> git.treefish.org Git - phys/latlib.git/blobdiff - CMakeLists.txt
...
[phys/latlib.git] / CMakeLists.txt
index 4506e8d4966ce3959a581787625a23c87132742b..39c0dc277a5cd6baf17619dfe114183594e98933 100644 (file)
@@ -5,8 +5,22 @@ project(latlib)
 #set(CMAKE_EXE_LINKER_FLAGS -pg)
 #set(CMAKE_SHARED_LINKER_FLAGS -pg)
 
 #set(CMAKE_EXE_LINKER_FLAGS -pg)
 #set(CMAKE_SHARED_LINKER_FLAGS -pg)
 
+cmake_minimum_required(VERSION 2.8)
+
+find_package(Boost 1.49 COMPONENTS iostreams REQUIRED)
+include_directories(${Boost_INCLUDE_DIRS}) 
+
+if(NOT DEFINED ENV{MPI_DISABLED})
+  find_package(MPI REQUIRED)
+  set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
+  set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})
+  include_directories(${MPI_INCLUDE_PATH})
+else()
+  message("LATLIB: MPI support is disabled!")
+endif()
+
 add_library(lat_configcache configcache.cpp)
 add_library(lat_configcache configcache.cpp)
-target_link_libraries(lat_configcache boost_iostreams lat_writeout)
+target_link_libraries(lat_configcache ${Boost_LIBRARIES} lat_writeout)
 
 add_library(lat_hypercache hypercache.cpp)
 target_link_libraries(lat_hypercache lat_configcache lat_writeout)
 
 add_library(lat_hypercache hypercache.cpp)
 target_link_libraries(lat_hypercache lat_configcache lat_writeout)
@@ -14,21 +28,25 @@ target_link_libraries(lat_hypercache lat_configcache lat_writeout)
 add_library(lat_neigh neigh.cpp)
 
 add_library(lat_writeout writeout.cpp)
 add_library(lat_neigh neigh.cpp)
 
 add_library(lat_writeout writeout.cpp)
+if(DEFINED ENV{MPI_DISABLED})
+  set_target_properties(lat_writeout PROPERTIES COMPILE_DEFINITIONS "MPI_DISABLED")
+endif()
 
 add_library(lat_paraq paraq.cpp)
 
 add_library(lat_progress progress.cpp)
 
 
 add_library(lat_paraq paraq.cpp)
 
 add_library(lat_progress progress.cpp)
 
-find_package(OpenGL REQUIRED)
-find_package(GLUT REQUIRED)
-include_directories( ${OPENGL_INCLUDE_DIRS}  ${GLUT_INCLUDE_DIRS} ../ )
-add_library(lat_culooks culooks.cpp culooks_cube.cpp culooks_drawing.cpp)
-target_link_libraries(lat_culooks ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} pthread)
+find_package(OpenGL)
+find_package(GLUT)
+if (OPENGL_FOUND AND GLUT_FOUND)
+    include_directories( ${OPENGL_INCLUDE_DIRS}  ${GLUT_INCLUDE_DIRS} ../ )
+    add_library(lat_culooks culooks.cpp culooks_cube.cpp culooks_drawing.cpp)
+    target_link_libraries(lat_culooks ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} pthread)
+    add_executable(culooks_test culooks_test.cpp)
+    target_link_libraries(culooks_test lat_culooks)
+endif ()
 
 add_executable(neigh_test neigh_test.cpp)
 target_link_libraries(neigh_test lat_neigh)
 
 
 add_executable(neigh_test neigh_test.cpp)
 target_link_libraries(neigh_test lat_neigh)
 
-add_executable(culooks_test culooks_test.cpp)
-target_link_libraries(culooks_test lat_culooks)
-
 add_subdirectory(o815)
 add_subdirectory(o815)