cmake: furhter improvments

* Add support for one package
* Add support for JPEG as external package
* Use pre-generated style header
  * TODO write a script to generate them
This commit is contained in:
Christoph Junghans 2017-07-13 22:54:48 -06:00
parent 6b19016deb
commit bfb449cec9
22 changed files with 381 additions and 9 deletions

View File

@ -29,8 +29,8 @@ if(ENABLE_MPI)
include_directories(${MPI_C_INCLUDE_PATH})
set(MPI_SOURCES)
else()
file(GLOB MPI_SOURCES src/STUBS/mpi.c)
include_directories(src/STUBS)
file(GLOB MPI_SOURCES ${CMAKE_SOURCE_DIR}/../src/STUBS/mpi.c)
include_directories(${CMAKE_SOURCE_DIR}/../src/STUBS)
set(MPI_CXX_LIBRARIES)
endif()
@ -38,6 +38,19 @@ find_package(UnixCommands)
option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF)
set(PACKAGES ASPHERE)
foreach(PKG ${PACKAGES})
option(ENABLE_${PKG} "Build ${PKG} Package" OFF)
endforeach()
find_package(JPEG)
if(JPEG_FOUND)
add_definitions(-DLAMMPS_JPEG)
include_directories(${JPEG_INCLUDE_DIR})
else()
set(JPEG_LIBRARIES)
endif()
########################################################################
# Basic system tests (standard libraries, headers, functions, types) #
########################################################################
@ -66,16 +79,24 @@ endforeach(FUNC)
#Do NOT go into src to not conflict with old Makefile build system
#add_subdirectory(src)
file(GLOB LIB_SOURCES src/*.cpp)
file(GLOB LMP_SOURCES src/main.cpp)
file(GLOB LIB_SOURCES ${CMAKE_SOURCE_DIR}/../src/*.cpp)
file(GLOB LMP_SOURCES ${CMAKE_SOURCE_DIR}/../src/main.cpp)
list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES})
add_custom_target(style COMMAND ${BASH} Make.sh style WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
foreach(PKG ${PACKAGES})
if(ENABLE_${PKG})
file(GLOB ${PKG}_SOURCES ${CMAKE_SOURCE_DIR}/../src/${PKG}/*.cpp)
list(APPEND LIB_SOURCES ${${PKG}_SOURCES})
include_directories(${CMAKE_SOURCE_DIR}/../src/${PKG})
endif()
endforeach()
include_directories(${CMAKE_SOURCE_DIR}/../src)
include_directories(${CMAKE_SOURCE_DIR}/Headers)
configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h)
include_directories(${CMAKE_BINARY_DIR}/cmake)
add_library(lammps ${LIB_SOURCES} ${MPI_SOURCES})
add_dependencies(lammps style)
# better but slower
#add_custom_command(TARGET lammps PRE_BUILD COMMAND ${BASH} Make.sh style WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${MATH_LIBRARIES})
target_link_libraries(lammps ${MPI_CXX_LIBRARIES} ${JPEG_LIBRARIES} ${MATH_LIBRARIES})
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1 @@
#cmakedefine ENABLE_ASPHERE

View File

@ -0,0 +1,3 @@
#include "package.h"
#include "angle_hybrid.h"
#include "angle_zero.h"

View File

@ -0,0 +1,9 @@
#include "package.h"
#include "atom_vec_atomic.h"
#include "atom_vec_body.h"
#include "atom_vec_charge.h"
#include "atom_vec_ellipsoid.h"
#include "atom_vec_hybrid.h"
#include "atom_vec_line.h"
#include "atom_vec_sphere.h"
#include "atom_vec_tri.h"

View File

@ -0,0 +1 @@
#include "package.h"

View File

@ -0,0 +1,3 @@
#include "package.h"
#include "bond_hybrid.h"
#include "bond_zero.h"

View File

@ -0,0 +1,23 @@
#include "balance.h"
#include "change_box.h"
#include "create_atoms.h"
#include "create_bonds.h"
#include "create_box.h"
#include "delete_atoms.h"
#include "delete_bonds.h"
#include "displace_atoms.h"
#include "info.h"
#include "minimize.h"
#include "read_data.h"
#include "read_dump.h"
#include "read_restart.h"
#include "replicate.h"
#include "rerun.h"
#include "run.h"
#include "set.h"
#include "velocity.h"
#include "write_coeff.h"
#include "write_data.h"
#include "write_dump.h"
#include "package.h"
#include "write_restart.h"

View File

@ -0,0 +1,66 @@
#include "package.h"
#include "compute_angle.h"
#include "compute_angle_local.h"
#include "compute_angmom_chunk.h"
#include "compute_bond.h"
#include "compute_bond_local.h"
#include "compute_centro_atom.h"
#include "compute_chunk_atom.h"
#include "compute_cluster_atom.h"
#include "compute_cna_atom.h"
#include "compute_com.h"
#include "compute_com_chunk.h"
#include "compute_contact_atom.h"
#include "compute_coord_atom.h"
#include "compute_dihedral.h"
#include "compute_dihedral_local.h"
#include "compute_dipole_chunk.h"
#include "compute_displace_atom.h"
#ifdef ENABLE_ASPHERE
#include "compute_erotate_asphere.h"
#endif
#include "compute_erotate_sphere.h"
#include "compute_erotate_sphere_atom.h"
#include "compute_global_atom.h"
#include "compute_group_group.h"
#include "compute_gyration.h"
#include "compute_gyration_chunk.h"
#include "compute_heat_flux.h"
#include "compute_hexorder_atom.h"
#include "compute_improper.h"
#include "compute_improper_local.h"
#include "compute_inertia_chunk.h"
#include "compute_ke.h"
#include "compute_ke_atom.h"
#include "compute_msd.h"
#include "compute_msd_chunk.h"
#include "compute_omega_chunk.h"
#include "compute_orientorder_atom.h"
#include "compute_pair.h"
#include "compute_pair_local.h"
#include "compute_pe.h"
#include "compute_pe_atom.h"
#include "compute_pressure.h"
#include "compute_property_atom.h"
#include "compute_property_chunk.h"
#include "compute_property_local.h"
#include "compute_rdf.h"
#include "compute_reduce.h"
#include "compute_reduce_region.h"
#include "compute_slice.h"
#include "compute_stress_atom.h"
#include "compute_temp.h"
#ifdef ENABLE_ASPHERE
#include "compute_temp_asphere.h"
#endif
#include "compute_temp_chunk.h"
#include "compute_temp_com.h"
#include "compute_temp_deform.h"
#include "compute_temp_partial.h"
#include "compute_temp_profile.h"
#include "compute_temp_ramp.h"
#include "compute_temp_region.h"
#include "compute_temp_sphere.h"
#include "compute_torque_chunk.h"
#include "compute_vacf.h"
#include "compute_vcm_chunk.h"

View File

@ -0,0 +1,3 @@
#include "package.h"
#include "dihedral_hybrid.h"
#include "dihedral_zero.h"

View File

@ -0,0 +1,9 @@
#include "package.h"
#include "dump_atom.h"
#include "dump_cfg.h"
#include "dump_custom.h"
#include "dump_dcd.h"
#include "dump_image.h"
#include "dump_local.h"
#include "dump_movie.h"
#include "dump_xyz.h"

89
cmake/Headers/style_fix.h Normal file
View File

@ -0,0 +1,89 @@
#include "package.h"
#include "fix_adapt.h"
#include "fix_addforce.h"
#include "fix_ave_atom.h"
#include "fix_ave_chunk.h"
#include "fix_ave_correlate.h"
#include "fix_ave_histo.h"
#include "fix_ave_histo_weight.h"
#include "fix_ave_time.h"
#include "fix_aveforce.h"
#include "fix_balance.h"
#include "fix_box_relax.h"
#include "fix_controller.h"
#include "fix_deform.h"
#include "fix_deprecated.h"
#include "fix_drag.h"
#include "fix_dt_reset.h"
#include "fix_enforce2d.h"
#include "fix_external.h"
#include "fix_gravity.h"
#include "fix_group.h"
#include "fix_halt.h"
#include "fix_heat.h"
#include "fix_indent.h"
#include "fix_langevin.h"
#include "fix_lineforce.h"
#include "fix_minimize.h"
#include "fix_momentum.h"
#include "fix_move.h"
#include "fix_nph.h"
#ifdef ENABLE_ASPHERE
#include "fix_nph_asphere.h"
#endif
#include "fix_nph_sphere.h"
#include "fix_npt.h"
#ifdef ENABLE_ASPHERE
#include "fix_npt_asphere.h"
#endif
#include "fix_npt_sphere.h"
#include "fix_nve.h"
#ifdef ENABLE_ASPHERE
#include "fix_nve_asphere.h"
#include "fix_nve_asphere_noforce.h"
#endif
#include "fix_nve_limit.h"
#ifdef ENABLE_ASPHERE
#include "fix_nve_line.h"
#endif
#include "fix_nve_noforce.h"
#include "fix_nve_sphere.h"
#ifdef ENABLE_ASPHERE
#include "fix_nve_tri.h"
#endif
#include "fix_nvt.h"
#ifdef ENABLE_ASPHERE
#include "fix_nvt_asphere.h"
#endif
#include "fix_nvt_sllod.h"
#include "fix_nvt_sphere.h"
#include "fix_planeforce.h"
#include "fix_press_berendsen.h"
#include "fix_print.h"
#include "fix_property_atom.h"
#include "fix_read_restart.h"
#include "fix_recenter.h"
#include "fix_respa.h"
#include "fix_restrain.h"
#include "fix_setforce.h"
#include "fix_shear_history.h"
#include "fix_spring.h"
#include "fix_spring_chunk.h"
#include "fix_spring_rg.h"
#include "fix_spring_self.h"
#include "fix_store.h"
#include "fix_store_force.h"
#include "fix_store_state.h"
#include "fix_temp_berendsen.h"
#include "fix_temp_csld.h"
#include "fix_temp_csvr.h"
#include "fix_temp_rescale.h"
#include "fix_tmd.h"
#include "fix_vector.h"
#include "fix_viscous.h"
#include "fix_wall_harmonic.h"
#include "fix_wall_lj1043.h"
#include "fix_wall_lj126.h"
#include "fix_wall_lj93.h"
#include "fix_wall_reflect.h"
#include "fix_wall_region.h"

View File

@ -0,0 +1,3 @@
#include "package.h"
#include "improper_hybrid.h"
#include "improper_zero.h"

View File

@ -0,0 +1,3 @@
#include "package.h"
#include "respa.h"
#include "verlet.h"

View File

@ -0,0 +1 @@
#include "package.h"

View File

@ -0,0 +1,6 @@
#include "package.h"
#include "min_cg.h"
#include "min_fire.h"
#include "min_hftn.h"
#include "min_quickmin.h"
#include "min_sd.h"

View File

@ -0,0 +1,2 @@
#include "package.h"
#include "nbin_standard.h"

View File

@ -0,0 +1,36 @@
#include "package.h"
#include "npair_copy.h"
#include "npair_full_bin.h"
#include "npair_full_bin_atomonly.h"
#include "npair_full_bin_ghost.h"
#include "npair_full_multi.h"
#include "npair_full_nsq.h"
#include "npair_full_nsq_ghost.h"
#include "npair_half_bin_atomonly_newton.h"
#include "npair_half_bin_newtoff.h"
#include "npair_half_bin_newtoff_ghost.h"
#include "npair_half_bin_newton.h"
#include "npair_half_bin_newton_tri.h"
#include "npair_half_multi_newtoff.h"
#include "npair_half_multi_newton.h"
#include "npair_half_multi_newton_tri.h"
#include "npair_half_nsq_newtoff.h"
#include "npair_half_nsq_newtoff_ghost.h"
#include "npair_half_nsq_newton.h"
#include "npair_half_respa_bin_newtoff.h"
#include "npair_half_respa_bin_newton.h"
#include "npair_half_respa_bin_newton_tri.h"
#include "npair_half_respa_nsq_newtoff.h"
#include "npair_half_respa_nsq_newton.h"
#include "npair_half_size_bin_newtoff.h"
#include "npair_half_size_bin_newton.h"
#include "npair_half_size_bin_newton_tri.h"
#include "npair_half_size_nsq_newtoff.h"
#include "npair_half_size_nsq_newton.h"
#include "npair_halffull_newtoff.h"
#include "npair_halffull_newton.h"
#include "npair_skip.h"
#include "npair_skip_respa.h"
#include "npair_skip_size.h"
#include "npair_skip_size_off2on.h"
#include "npair_skip_size_off2on_oneside.h"

View File

@ -0,0 +1,21 @@
#include "package.h"
#include "nstencil_full_bin_2d.h"
#include "nstencil_full_bin_3d.h"
#include "nstencil_full_ghost_bin_2d.h"
#include "nstencil_full_ghost_bin_3d.h"
#include "nstencil_full_multi_2d.h"
#include "nstencil_full_multi_3d.h"
#include "nstencil_half_bin_2d_newtoff.h"
#include "nstencil_half_bin_2d_newton.h"
#include "nstencil_half_bin_2d_newton_tri.h"
#include "nstencil_half_bin_3d_newtoff.h"
#include "nstencil_half_bin_3d_newton.h"
#include "nstencil_half_bin_3d_newton_tri.h"
#include "nstencil_half_ghost_bin_2d_newtoff.h"
#include "nstencil_half_ghost_bin_3d_newtoff.h"
#include "nstencil_half_multi_2d_newtoff.h"
#include "nstencil_half_multi_2d_newton.h"
#include "nstencil_half_multi_2d_newton_tri.h"
#include "nstencil_half_multi_3d_newtoff.h"
#include "nstencil_half_multi_3d_newton.h"
#include "nstencil_half_multi_3d_newton_tri.h"

View File

@ -0,0 +1,13 @@
#include "package.h"
#include "ntopo_angle_all.h"
#include "ntopo_angle_partial.h"
#include "ntopo_angle_template.h"
#include "ntopo_bond_all.h"
#include "ntopo_bond_partial.h"
#include "ntopo_bond_template.h"
#include "ntopo_dihedral_all.h"
#include "ntopo_dihedral_partial.h"
#include "ntopo_dihedral_template.h"
#include "ntopo_improper_all.h"
#include "ntopo_improper_partial.h"
#include "ntopo_improper_template.h"

View File

@ -0,0 +1,47 @@
#include "package.h"
#include "pair_beck.h"
#include "pair_born.h"
#include "pair_born_coul_dsf.h"
#include "pair_born_coul_wolf.h"
#include "pair_buck.h"
#include "pair_buck_coul_cut.h"
#include "pair_coul_cut.h"
#include "pair_coul_debye.h"
#include "pair_coul_dsf.h"
#include "pair_coul_streitz.h"
#include "pair_coul_wolf.h"
#include "pair_dpd.h"
#include "pair_dpd_tstat.h"
#include "pair_gauss.h"
#ifdef ENABLE_ASPHERE
#include "pair_gayberne.h"
#endif
#include "pair_hybrid.h"
#include "pair_hybrid_overlay.h"
#ifdef ENABLE_ASPHERE
#include "pair_line_lj.h"
#endif
#include "pair_lj96_cut.h"
#include "pair_lj_cubic.h"
#include "pair_lj_cut.h"
#include "pair_lj_cut_coul_cut.h"
#include "pair_lj_cut_coul_debye.h"
#include "pair_lj_cut_coul_dsf.h"
#include "pair_lj_expand.h"
#include "pair_lj_gromacs.h"
#include "pair_lj_gromacs_coul_gromacs.h"
#include "pair_lj_smooth.h"
#include "pair_lj_smooth_linear.h"
#include "pair_mie_cut.h"
#include "pair_morse.h"
#ifdef ENABLE_ASPHERE
#include "pair_resquared.h"
#endif
#include "pair_soft.h"
#include "pair_table.h"
#ifdef ENABLE_ASPHERE
#include "pair_tri_lj.h"
#endif
#include "pair_yukawa.h"
#include "pair_zbl.h"
#include "pair_zero.h"

View File

@ -0,0 +1,3 @@
#include "package.h"
#include "reader_native.h"
#include "reader_xyz.h"

View File

@ -0,0 +1,9 @@
#include "package.h"
#include "region_block.h"
#include "region_cone.h"
#include "region_cylinder.h"
#include "region_intersect.h"
#include "region_plane.h"
#include "region_prism.h"
#include "region_sphere.h"
#include "region_union.h"