This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62e2a06
commit 430283a
Showing
10 changed files
with
650 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
language: c | ||
|
||
sudo: required | ||
|
||
before_install: | ||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
- sudo apt-get update -qq | ||
|
||
install: | ||
# Install gfortran | ||
- sudo apt-get install -qq gfortran-7 | ||
- sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 90 | ||
|
||
# Install git | ||
- sudo apt install git | ||
|
||
# Use the default version of CMake to build a newer version | ||
- sudo apt install cmake | ||
|
||
# Download and install a newer version of CMake | ||
- sudo git clone https://github.com/Kitware/CMake.git | ||
- pushd CMake | ||
- sudo mkdir build | ||
- pushd build | ||
- sudo cmake -DCMAKE_INSTALL_LIBDIR=$HOME/.local/CMake .. | ||
- sudo cmake | ||
- sudo make | ||
- sudo make install | ||
- popd | ||
- popd | ||
|
||
# # Download and install LAPACK | ||
# - sudo git clone https://github.com/Reference-LAPACK/lapack.git | ||
# - pushd lapack | ||
# - sudo mkdir build | ||
# - pushd build | ||
# - sudo cmake -DCMAKE_INSTALL_LIBDIR=$HOME/.local/lapack .. | ||
# - sudo cmake | ||
# - sudo make | ||
# - sudo make install | ||
# - popd | ||
# - popd | ||
|
||
# Download and install FERROR | ||
- sudo git clone https://github.com/jchristopherson/ferror.git | ||
- pushd ferror | ||
- sudo mkdir build | ||
- pushd build | ||
- sudo cmake -DCMAKE_INSTALL_LIBDIR=$HOME/.local/ferror .. | ||
- sudo cmake | ||
- sudo make | ||
- sudo make install | ||
- popd | ||
- popd | ||
|
||
# # Download and install LINALG | ||
# - sudo git clone https://github.com/jchristopherson/linalg.git | ||
# - pushd linalg | ||
# - sudo mkdir build | ||
# - pushd build | ||
# - sudo cmake -DCMAKE_INSTALL_LIBDIR=$HOME/.local/linalg .. | ||
# - sudo cmake | ||
# - sudo make | ||
# - sudo make install | ||
# - popd | ||
# - popd | ||
|
||
# # Download and install NONLIN | ||
# - sudo git clone https://github.com/jchristopherson/nonlin.git | ||
# - pushd nonlin | ||
# - sudo mkdir build | ||
# - pushd build | ||
# - sudo cmake -DCMAKE_INSTALL_LIBDIR=$HOME/.local/nonlin .. | ||
# - sudo cmake | ||
# - sudo make | ||
# - sudo make install | ||
# - popd | ||
# - popd | ||
|
||
before_script: | ||
- mkdir build | ||
- cd build | ||
- cmake .. | ||
|
||
script: make |
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,131 @@ | ||
# Master CMAKE Build Script | ||
cmake_minimum_required(VERSION 3.7) | ||
project(fcore C CXX Fortran) | ||
|
||
# Define version information | ||
set(FCORE_MAJOR_VERSION 1) | ||
set(FCORE_MINOR_VERSION 0) | ||
set(FCORE_PATCH_VERSION 0) | ||
set(FCORE_VERSION ${FCORE_MAJOR_VERSION}.${FCORE_MINOR_VERSION}.${FCORE_PATCH_VERSION}) | ||
|
||
# Set a default build type if none was specified | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message(STATUS "Setting build type to 'Debug' as none was specified.") | ||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) | ||
# Set the possible values of build type for cmake-gui | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") | ||
endif() | ||
|
||
# By default, shared library | ||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF) | ||
|
||
# Get compiler info | ||
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) | ||
|
||
# Export all symbols on Windows when building shared libraries | ||
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | ||
|
||
# Locate the module files | ||
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_SOURCE_DIR}/include) | ||
|
||
# Define output directories, if undefined | ||
if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) | ||
message(STATUS "MEASUREMENTS library output directories undefined. Using default directories.") | ||
if (CMAKE_BUILD_TYPE MATCHES Debug) | ||
# Debug Build | ||
if (BUILD_SHARED_LIBS) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Debug) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Debug) | ||
else() | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Debug) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Debug) | ||
endif() | ||
elseif (CMAKE_BUILD_TYPE MATCHES Release) | ||
# Release Build | ||
if (BUILD_SHARED_LIBS) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Release) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Release) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Release) | ||
else() | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Release) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Release) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Release) | ||
endif() | ||
else() | ||
# Default Condition | ||
if (BUILD_SHARED_LIBS) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Debug) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/Debug) | ||
else() | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Debug) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/Debug) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
if (Fortran_COMPILER_NAME MATCHES "gfortran.*") | ||
# gfortran | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3 -Wl,--allow-multiple-definition") | ||
set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g -Wall -Wno-c-binding-type -Wl,--allow-multiple-definition") | ||
elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") | ||
# ifort (untested) | ||
set (CMAKE_Fortran_FLAGS_RELEASE "-f77rtl -O3") | ||
set (CMAKE_Fortran_FLAGS_DEBUG "-f77rtl -O0 -g") | ||
else (Fortran_COMPILER_NAME MATCHES "gfortran.*") | ||
message ("CMAKE_Fortran_COMPILER full path: " ${CMAKE_Fortran_COMPILER}) | ||
message ("Fortran compiler: " ${Fortran_COMPILER_NAME}) | ||
message ("No optimized Fortran compiler flags are known, we just try -O2...") | ||
set (CMAKE_Fortran_FLAGS_RELEASE "-O2 -Wl,--allow-multiple-definition") | ||
set (CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -Wall -Wl,--allow-multiple-definition") | ||
endif () | ||
|
||
# Locate Dependencies | ||
find_package(ferror 1.3.0) | ||
# find_package(linalg 1.6.0) | ||
# find_package(nonlin 1.4.0) | ||
|
||
if (ferror_FOUND) | ||
message(STATUS "FERROR library found.") | ||
set(ferror_LIBRARIES ferror) | ||
endif() | ||
|
||
# if (linalg_FOUND) | ||
# message(STATUS "LINALG library found.") | ||
# set(linalg_LIBRARIES linalg) | ||
# endif() | ||
|
||
# if (nonlin_FOUND) | ||
# message(STATUS "NONLIN library found.") | ||
# set(nonlin_LIBRARIES nonlin) | ||
# endif() | ||
|
||
# Locate the source directory | ||
add_subdirectory(src) | ||
|
||
# ------------------------------------------------------------------------------ | ||
# EXAMPLES | ||
# ------------------------------------------------------------------------------ | ||
option(BUILD_FCORE_EXAMPLES "Build FCORE examples?" OFF) | ||
if (BUILD_FCORE_EXAMPLES) | ||
# Inform the user we're building the examples | ||
message(STATUS "Building FCORE examples.") | ||
|
||
# Build the examples | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
# ------------------------------------------------------------------------------ | ||
# TESTS | ||
# ------------------------------------------------------------------------------ | ||
option(BUILD_FCORE_TESTS "Build FCORE tests?" OFF) | ||
if (BUILD_FCORE_TESTS) | ||
# Inform the user we're building the tests | ||
message(STATUS "Building FCORE tests.") | ||
|
||
# Build the tests | ||
add_subdirectory(tests) | ||
endif() |
Empty file.
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 @@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/fcoreTargets.cmake") |
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,76 @@ | ||
# Define the FCORE source files | ||
set(fcore_sources | ||
strings.f90 | ||
strings_string_builder.f90 | ||
strings_ops.f90 | ||
) | ||
|
||
# Build the library | ||
add_library(fcore ${fcore_sources}) | ||
target_link_libraries(fcore | ||
${ferror_LIBRARIES} | ||
) | ||
|
||
# ------------------------------------------------------------------------------ | ||
# INSTALLATION INSTRUCTIONS | ||
# ------------------------------------------------------------------------------ | ||
# Define target information | ||
set_property(TARGET fcore PROPERTY VERSION ${FCORE_VERSION}) | ||
set_property(TARGET fcore PROPERTY SOVERSION ${FCORE_MAJOR_VERSION}) | ||
set_property(TARGET fcore PROPERTY INTERFACE_fcore_MAJOR_VERSION ${FCORE_MAJOR_VERSION}) | ||
set_property(TARGET fcore APPEND PROPERTY COMPATIBLE_INTERFACE_STRING fcore_MAJOR_VERSION) | ||
|
||
# Locate the "include" directories | ||
set(fcore_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include) | ||
|
||
# Define the installation instructions | ||
install(TARGETS fcore EXPORT fcoreTargets | ||
RUNTIME DESTINATION fcore/bin | ||
LIBRARY DESTINATION fcore/lib | ||
ARCHIVE DESTINATION fcore/lib | ||
CONFIGURATIONS Release | ||
INCLUDES DESTINATION fcore/include | ||
) | ||
install( | ||
DIRECTORY ${PROJECT_SOURCE_DIR}/include | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/fcore | ||
COMPONENT Devel | ||
) | ||
|
||
# Include the documentation | ||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/doc/html DESTINATION fcore/doc) | ||
|
||
# Define the version file | ||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file( | ||
"${CMAKE_BINARY_DIR}/fcoreConfigVersion.cmake" | ||
VERSION ${FCORE_VERSION} | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
|
||
export(EXPORT fcoreTargets | ||
FILE "${CMAKE_BINARY_DIR}/fcoreTargets.cmake" | ||
) | ||
|
||
# Define the configuration file | ||
configure_file( | ||
"${PROJECT_SOURCE_DIR}/fcoreConfig.cmake.in" | ||
"${CMAKE_BINARY_DIR}/fcoreConfig.cmake" | ||
COPYONLY | ||
) | ||
|
||
set(ConfigPackageLocation fcore/lib/cmake/fcore) | ||
install( | ||
EXPORT fcoreTargets | ||
FILE fcoreTargets.cmake | ||
DESTINATION ${ConfigPackageLocation} | ||
) | ||
install( | ||
FILES | ||
"${CMAKE_BINARY_DIR}/fcoreConfig.cmake" | ||
"${CMAKE_BINARY_DIR}/fcoreConfigVersion.cmake" | ||
DESTINATION | ||
${ConfigPackageLocation} | ||
COMPONENT | ||
Devel | ||
) |
Oops, something went wrong.