Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lammps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
multiscale
lammps
Commits
6b19016d
Commit
6b19016d
authored
7 years ago
by
Christoph Junghans
Browse files
Options
Downloads
Patches
Plain Diff
cmake: initial commit
parent
43393799
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+8
-0
8 additions, 0 deletions
.gitignore
CMakeLists.txt
+84
-0
84 additions, 0 deletions
CMakeLists.txt
with
92 additions
and
0 deletions
.gitignore
+
8
−
0
View file @
6b19016d
...
...
@@ -32,3 +32,11 @@ log.cite
.Trashes
ehthumbs.db
Thumbs.db
#cmake
/build*
/CMakeCache.txt
/CMakeFiles/
/Makefile
/cmake_install.cmake
/lmp
This diff is collapsed.
Click to expand it.
CMakeLists.txt
0 → 100644
+
84
−
0
View file @
6b19016d
cmake_minimum_required
(
VERSION 3.1
)
project
(
lammps
)
set
(
SOVERSION 0
)
if
(
NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS
)
#release comes with -O3 by default
set
(
CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
endif
(
NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS
)
enable_language
(
CXX
)
######################################################################
# compiler tests
# these need ot be done early (before further tests).
#####################################################################
include
(
CheckCCompilerFlag
)
########################################################################
# User input options #
########################################################################
option
(
BUILD_SHARED_LIBS
"Build shared libs"
OFF
)
include
(
GNUInstallDirs
)
option
(
ENABLE_MPI
"Build MPI version"
OFF
)
if
(
ENABLE_MPI
)
find_package
(
MPI
)
include_directories
(
${
MPI_C_INCLUDE_PATH
}
)
set
(
MPI_SOURCES
)
else
()
file
(
GLOB MPI_SOURCES src/STUBS/mpi.c
)
include_directories
(
src/STUBS
)
set
(
MPI_CXX_LIBRARIES
)
endif
()
find_package
(
UnixCommands
)
option
(
CMAKE_VERBOSE_MAKEFILE
"Verbose makefile"
OFF
)
########################################################################
# Basic system tests (standard libraries, headers, functions, types) #
########################################################################
include
(
CheckIncludeFile
)
foreach
(
HEADER math.h
)
check_include_file
(
${
HEADER
}
FOUND_
${
HEADER
}
)
if
(
NOT FOUND_
${
HEADER
}
)
message
(
FATAL_ERROR
"Could not find needed header -
${
HEADER
}
"
)
endif
(
NOT FOUND_
${
HEADER
}
)
endforeach
(
HEADER
)
set
(
MATH_LIBRARIES
"m"
CACHE STRING
"math library"
)
mark_as_advanced
(
MATH_LIBRARIES
)
include
(
CheckLibraryExists
)
foreach
(
FUNC sin cos
)
check_library_exists
(
${
MATH_LIBRARIES
}
${
FUNC
}
""
FOUND_
${
FUNC
}
_
${
MATH_LIBRARIES
}
)
if
(
NOT FOUND_
${
FUNC
}
_
${
MATH_LIBRARIES
}
)
message
(
FATAL_ERROR
"Could not find needed math function -
${
FUNC
}
"
)
endif
(
NOT FOUND_
${
FUNC
}
_
${
MATH_LIBRARIES
}
)
endforeach
(
FUNC
)
######################################
# Include the following subdirectory #
######################################
#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
)
list
(
REMOVE_ITEM LIB_SOURCES
${
LMP_SOURCES
}
)
add_custom_target
(
style COMMAND
${
BASH
}
Make.sh style WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/src
)
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
}
)
set_target_properties
(
lammps PROPERTIES SOVERSION
${
SOVERSION
}
)
install
(
TARGETS lammps LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
add_executable
(
lmp
${
LMP_SOURCES
}
)
target_link_libraries
(
lmp lammps
)
install
(
TARGETS lammps DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment