-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from vanderhe/condaForgePreparations
Prepare infrastructure for conda-forge packaging
- Loading branch information
Showing
16 changed files
with
300 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project(TestFortnetBuild LANGUAGES Fortran) | ||
|
||
find_package(Fortnet REQUIRED) | ||
|
||
add_executable(test_build test_build.f90) | ||
target_link_libraries(test_build Fortnet::Fortnet) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Tests whether the installed Fortnet library can be used within a CMake project. | ||
# | ||
# Arguments: | ||
# | ||
# - building directory (will be created, should not exist) | ||
# | ||
# Requirements: | ||
# | ||
# - Environment variables FC & CC contain the same compiler as used for Fortnet | ||
# | ||
# - Environment variable CMAKE_PREFIX_PATH contains the Fortnet install root. | ||
# | ||
SCRIPTDIR=$(dirname $0) | ||
SCRIPTNAME=$(basename $0) | ||
BUILDDIR=$1 | ||
shift | ||
|
||
if [ -d ${BUILDDIR} ]; then | ||
echo "${SCRIPTNAME}: Test build directory '${BUILDDIR}' already exists." >&2 | ||
exit 1 | ||
fi | ||
|
||
FC=$FC CC=$CC cmake -B ${BUILDDIR} ${SCRIPTDIR} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} "$@" \ | ||
|| { echo "Configuration step failed" >&2; exit 1; } | ||
cmake --build ${BUILDDIR} -- VERBOSE=1 || { echo "Build step failed" >&2; exit 1; } | ||
echo "CMake build succeeded!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
program test_build | ||
use fortnet | ||
implicit none | ||
|
||
end program test_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Tests whether the installed Fortnet library can be used with pkg-config based builds. | ||
# | ||
# Arguments: | ||
# | ||
# - building directory (will be created if it does not exist) | ||
# | ||
# Requirements: | ||
# | ||
# - Environment variables FC and CC contain the same Fortran and C compilers as used for Fortnet | ||
# | ||
# - Environment variable PKG_CONFIG_PATH contains the lib/pkgconfig folder within | ||
# the installed Fortnet tree. | ||
# | ||
# - You pass all linker options as arguments, which are needed to link an MPI-binary | ||
# with your compiler. Alternatively, you can specify the name of the MPI-wrappers | ||
# as your compilers in FC and CC. | ||
# | ||
SCRIPTDIR=$(dirname $0) | ||
SCRIPTNAME=$(basename $0) | ||
BUILDDIR=$1 | ||
shift | ||
CUSTOMLIBS=$* | ||
|
||
if [ ! -d ${BUILDDIR} ]; then | ||
mkdir ${BUILDDIR} || { echo "Could not create build dir '${BUILDDIR}'" >&2; exit 1; } | ||
fi | ||
|
||
# Make sure scriptdir is absolute | ||
cd ${SCRIPTDIR} | ||
SCRIPTDIR=${PWD} | ||
cd - | ||
|
||
cd ${BUILDDIR} || { echo "Could not change to build dir '${BUILDDIR}'" >&2; exit 1; } | ||
pkg-config --exists fortnet || { echo "No PKG-CONFIG found for Fortnet" >&2; exit 1; } | ||
|
||
cflags=$(pkg-config --cflags fortnet) | ||
libs=$(pkg-config --libs fortnet) | ||
|
||
cmd="${FC} ${cflags} ${SCRIPTDIR}/test_build.f90 ${libs} ${CUSTOMLIBS}" | ||
|
||
echo "Build command: ${cmd}" | ||
${cmd} || { echo "Build command failed" >&2; exit 1; } | ||
echo "PKG-CONFIG build succeeded." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
program test_build | ||
use fortnet | ||
implicit none | ||
|
||
end program test_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@PACKAGE_INIT@ | ||
|
||
# Global Fortnet config options | ||
set(Fortnet_WITH_MPI @WITH_MPI@) | ||
set(Fortnet_WITH_SOCKETS @WITH_SOCKETS@) | ||
|
||
include(CMakeFindDependencyMacro) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/Modules) | ||
|
||
if(NOT TARGET Fortnet::Fortnet) | ||
|
||
if(NOT TARGET BLAS::BLAS) | ||
find_dependency(CustomBlas) | ||
endif() | ||
|
||
if(NOT TARGET LAPACK::LAPACK) | ||
find_dependency(CustomLapack) | ||
endif() | ||
|
||
if(Fortnet_WITH_MPI AND NOT TARGET MpiFx::MpiFx) | ||
find_dependency(MpiFx) | ||
endif() | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/fortnet-targets.cmake") | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Name: Fortnet | ||
Description: Library interface to Fortnet, a software package for training Behler-Parrinello neural networks | ||
Version: @PROJECT_VERSION@ | ||
URL: https://github.com/vanderhe/fortnet | ||
|
||
Requires: @PKGCONFIG_REQUIRES@ | ||
Libs: @PKGCONFIG_LIBS@ | ||
Libs.private: @PKGCONFIG_LIBS_PRIVATE@ | ||
Cflags: @PKGCONFIG_C_FLAGS@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Build external components first and uses them as external dependencies during build | ||
# | ||
# Expects following env-vars: | ||
# | ||
# WITH_MPI ("false"/"true"), SOURCE_DIR, BUILD_DIR, INSTALL_DIR | ||
# | ||
set -ex | ||
|
||
if [ "${WITH_MPI}" == "true" ]; then | ||
|
||
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ | ||
-DBUILD_EXPORTED_TARGETS_ONLY=True -DCMAKE_BUILD_TYPE=Debug \ | ||
-B ${BUILD_DIR}/mpifx ${SOURCE_DIR}/external/mpifx/origin | ||
cmake --build ${BUILD_DIR}/mpifx -- -j | ||
cmake --install ${BUILD_DIR}/mpifx | ||
|
||
cmake -DWITH_MPI=True \ | ||
-DHYBRID_CONFIG_METHODS='Find' \ | ||
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-B ${BUILD_DIR}/fortnet ${SOURCE_DIR} | ||
cmake --build ${BUILD_DIR}/fortnet -- VERBOSE=1 fnet | ||
|
||
else | ||
|
||
cmake -DWITH_MPI=False \ | ||
-DHYBRID_CONFIG_METHODS='Find' \ | ||
-DBUILD_SHARED_LIBS=False \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ | ||
-B ${BUILD_DIR}/fortnet ${SOURCE_DIR} | ||
cmake --build ${BUILD_DIR}/fortnet -- VERBOSE=1 fnet | ||
|
||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Must be called, after Fortnet had been installed | ||
# | ||
# Expects following env-vars: | ||
# | ||
# FC, CC, ("false"/"true") | ||
# SOURCE_DIR (Fortnet source dir), BUILD_DIR, | ||
# INSTALL_DIR (Fortnet install dir with already installed Fortnet) | ||
# | ||
set -ex | ||
|
||
# Integration test for CMake builds | ||
CMAKE_PREFIX_PATH="${INSTALL_DIR}:${CMAKE_PREFIX_PATH}" \ | ||
${SOURCE_DIR}/test/prog/fortnet/integration/cmake/runtest.sh ${BUILD_DIR}/cmake | ||
|
||
# Integration test for PKG-CONFIG builds | ||
PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH" \ | ||
${SOURCE_DIR}/test/prog/fortnet/integration/pkgconfig/runtest.sh ${BUILD_DIR}/pkgconfig |
Oops, something went wrong.