From fe06dc2bbb637ef608f5465d910acf4eb9a191bb Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 14 Apr 2010 13:49:11 +0000 Subject: [PATCH] Set up cmake for physpack (do not build by default) --- fastlib/branches/fastlib-cmake/CMakeLists.txt | 1 + .../fastlib-cmake/physpack/CMakeLists.txt | 49 +++++++++++++++++++ .../physpack/mol_dynamics/CMakeLists.txt | 36 ++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 fastlib/branches/fastlib-cmake/physpack/CMakeLists.txt create mode 100644 fastlib/branches/fastlib-cmake/physpack/mol_dynamics/CMakeLists.txt diff --git a/fastlib/branches/fastlib-cmake/CMakeLists.txt b/fastlib/branches/fastlib-cmake/CMakeLists.txt index fae0797625..17ad70d400 100644 --- a/fastlib/branches/fastlib-cmake/CMakeLists.txt +++ b/fastlib/branches/fastlib-cmake/CMakeLists.txt @@ -32,3 +32,4 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/) add_subdirectory(src) # fastlib add_subdirectory(mlpack) # mlpack add_subdirectory(contrib) # mlpack_contrib +#add_subdirectory(physpack) # physpack ## do not build by default diff --git a/fastlib/branches/fastlib-cmake/physpack/CMakeLists.txt b/fastlib/branches/fastlib-cmake/physpack/CMakeLists.txt new file mode 100644 index 0000000000..8ed908ef5c --- /dev/null +++ b/fastlib/branches/fastlib-cmake/physpack/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 2.8) +project(MLPACK_CONTRIB C CXX Fortran) + +# compiler flags +set(CMAKE_CXX_FLAGS "-g -Wall") +add_definitions(-DDISABLE_DISK_MATRIX) + +# include directories +include_directories(..) +include_directories(../include) + +set(PHYSPACK_SRCS) + +# now we need to recurse into each of the contrib methods +set(DIRS + mol_dynamics +) + +foreach(dir ${DIRS}) + add_subdirectory(${dir}) +endforeach() + +# PHYSPACK_SRCS is set in the subdirectories above +add_library(physpack ${PHYSPACK_SRCS}) +add_dependencies(physpack fastlib) + +# move header files to the right directory +file(GLOB_RECURSE INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) +add_custom_command(TARGET physpack POST_BUILD + COMMENT "Moving header files to include/physpack/" + COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/include/physpack/) +foreach(incl_file ${INCLUDE_FILES}) + add_custom_command(TARGET mlpack_contrib POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${incl_file} ${CMAKE_BINARY_DIR}/include/physpack/${incl_file}) +endforeach() + +# set installation rules for include files +#install(FILES ${CMAKE_BINARY_DIR}/include/physpack/ +# DESTINATION include/physpack) + +# set installation rules for mlpack_contrib programs +#install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/ +# DESTINATION bin) + +install(TARGETS physpack + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/fastlib/branches/fastlib-cmake/physpack/mol_dynamics/CMakeLists.txt b/fastlib/branches/fastlib-cmake/physpack/mol_dynamics/CMakeLists.txt new file mode 100644 index 0000000000..9cbbd3de1b --- /dev/null +++ b/fastlib/branches/fastlib-cmake/physpack/mol_dynamics/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 2.8) + +# Define the files we need to compile +# Anything not in this list will not be compiled into the output library +# Do not include test programs here +set(SOURCES + atom_tree.h + lennard_jones.h +# test_lennard_jones.h ## exists in build.py but does not actually exist +) + +# add directory name to sources +set(DIR_SRCS) +foreach(file ${SOURCES}) + set(DIR_SRCS ${DIR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/${file}) +endforeach() +# append sources (with directory name) to list of all PHYSPACK sources (used at the parent scope) +set(PHYSPACK_SRCS ${PHYSPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE) +message("mol: ${PHYSPACK_SRCS}") + +add_executable(lennard_jones + LennardJones_main.cc +) +target_link_libraries(lennard_jones + physpack + fastlib +) + +# Exists in build.py but does not actually exist +#add_executable(lennard_jones_test +# test_lennard_jones.cc +#) +#target_link_libraries(lennard_jones_test +# physpack +# fastlib +#)