Skip to content

Commit fcda698

Browse files
committed
Merge branch 'cmake'
2 parents 47bf51b + bf07959 commit fcda698

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
project(libdftd3 VERSION 0.9.2 LANGUAGES Fortran)
4+
5+
option(BUILD_SHARED_LIBS "Whether the library should be a shared one" FALSE)
6+
7+
option(INSTALL_INCLUDE_FILES "Whether include / module files should be installed" TRUE)
8+
9+
set(INSTALL_MODDIR "dftd3/modfiles" CACHE PATH
10+
"Installation directory for Fortran module files (within standard include folder)")
11+
12+
add_subdirectory(lib)
13+
if(NOT LIBRARY_ONLY)
14+
add_subdirectory(prg)
15+
endif()

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ DFTD3
33
=====
44

55
This is a repackaged version of the `DFTD3 program
6-
<https://www.chemie.uni-bonn.de/pctc/mulliken-center/software/dft-d3/get-the-current-version-of-dft-d3>`_
6+
<http://www.thch.uni-bonn.de/tc/index.php?section=downloads&subsection=getd3>`_
77
by S. Grimme and his coworkers.
88

99
The original program (V3.1 Rev 1) was downloaded at 2016-04-03. It has been
@@ -21,7 +21,6 @@ split into two parts:
2121
versions of Sherrill and coworkers (-bjm and -zerom)
2222
(Functionality corresponds to V3.2 Rev0)
2323

24-
2524
Compilation
2625
===========
2726

lib/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
set(sources
2+
api.f90
3+
common.f90
4+
core.f90
5+
pars.f90
6+
sizes.f90)
7+
8+
add_library(dftd3 ${sources})
9+
10+
set(includedir ${CMAKE_CURRENT_BINARY_DIR}/include)
11+
12+
set_target_properties(dftd3 PROPERTIES Fortran_MODULE_DIRECTORY ${includedir})
13+
14+
target_include_directories(dftd3 PUBLIC
15+
$<BUILD_INTERFACE:${includedir}>
16+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${INSTALL_MODDIR}>)
17+
18+
install(TARGETS dftd3
19+
EXPORT ${INSTALL_EXPORT_NAME}
20+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
21+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
22+
23+
if(INSTALL_INCLUDE_FILES)
24+
install(DIRECTORY ${includedir}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${INSTALL_MODDIR})
25+
endif()
26+

prg/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(sources
2+
extras.f90
3+
main.f90)
4+
5+
add_executable(dftd3_standalone ${sources})
6+
7+
target_link_libraries(dftd3_standalone dftd3)
8+
9+
set_target_properties(dftd3_standalone PROPERTIES OUTPUT_NAME "dftd3")
10+
11+
install(TARGETS dftd3_standalone
12+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

0 commit comments

Comments
 (0)