Set up cmake for physpack (do not build by default)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -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
|
||||
#)
|
||||
Reference in New Issue
Block a user