Skip to content

Commit 40ff3a5

Browse files
Merge pull request #28 from jchristopherson/v1.8.1
2 parents eeb248b + 82145c9 commit 40ff3a5

File tree

18 files changed

+234
-333
lines changed

18 files changed

+234
-333
lines changed

.github/workflows/fpm.yml

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -28,105 +28,18 @@ jobs:
2828
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
2929
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
3030
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
31-
32-
- name: Install BLAS & LAPACK
33-
if: contains(matrix.os, 'ubuntu')
34-
run: |
35-
sudo apt-get update
36-
sudo apt-get install libopenblas-dev liblapack-dev
37-
31+
3832
- name: Install fpm
3933
uses: fortran-lang/setup-fpm@v5
4034
with:
4135
fpm-version: 'v0.10.1'
4236

43-
- name: Build LINALG
37+
- name: Build FPLOT
4438
run: |
4539
gfortran --version
4640
fpm build
4741
4842
- name: Run tests
4943
run: |
5044
gfortran --version
51-
fpm test
52-
53-
msys2-build:
54-
runs-on: windows-latest
55-
defaults:
56-
run:
57-
shell: msys2 {0}
58-
59-
steps:
60-
- uses: actions/checkout@v2
61-
- uses: msys2/setup-msys2@v2
62-
with:
63-
msystem: MINGW64
64-
update: true
65-
path-type: inherit
66-
install: |
67-
mingw-w64-x86_64-gcc-fortran
68-
mingw-w64-x86_64-fpm
69-
mingw-w64-x86_64-openblas
70-
mingw-w64-x86_64-lapack
71-
72-
- name: fpm build
73-
run: |
74-
gfortran --version
75-
fpm --version
76-
fpm build
77-
78-
- name: fpm test
79-
run: |
80-
fpm test
81-
82-
# intel-build:
83-
# runs-on: ubuntu-latest
84-
# strategy:
85-
# fail-fast: false
86-
87-
# env:
88-
# FPM_FC: ifx
89-
# FC: ifx
90-
91-
# steps:
92-
# - name: Checkout code
93-
# uses: actions/checkout@v3
94-
95-
# - name: Add Intel repository (Linux)
96-
# run: |
97-
# wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
98-
# sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
99-
# rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
100-
# echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
101-
# sudo apt-get update
102-
103-
# - name: Install Intel oneAPI compiler (Linux)
104-
# run: |
105-
# sudo apt-get install intel-oneapi-compiler-fortran
106-
107-
# - name: Setup Intel oneAPI environment
108-
# run: |
109-
# source /opt/intel/oneapi/setvars.sh
110-
# printenv >> $GITHUB_ENV
111-
112-
# - name: Install MKL
113-
# run: |
114-
# sudo apt-get update
115-
# sudo apt-get -y install intel-mkl
116-
# sudo apt update
117-
# sudo apt -y install intel-mkl
118-
119-
# - name: Install fpm
120-
# uses: fortran-lang/setup-fpm@v3
121-
# with:
122-
# fpm-version: 'v0.8.2'
123-
124-
# - name: fpm build
125-
# run: |
126-
# ifx --version
127-
# fpm --version
128-
# fpm build --profile debug --flag "-warn nointerfaces"
129-
130-
# - name: fpm test
131-
# run: |
132-
# fpm test --profile debug --flag "-warn nointerfaces"
45+
fpm test

CMakeLists.txt

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,34 @@ cmake_minimum_required(VERSION 3.24)
33
project(
44
fplot
55
LANGUAGES Fortran
6-
VERSION 1.8.0
6+
VERSION 1.8.1
77
)
88

9-
# Get helper macros and functions
10-
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
11-
129
# Confgiure everything
1310
add_subdirectory(configure)
1411

15-
# Locate Dependencies
16-
add_subdirectory(dependencies)
17-
1812
# Source
1913
add_subdirectory(src)
20-
add_fortran_library(
21-
${PROJECT_NAME}
22-
${PROJECT_INCLUDE_DIR}
23-
${CMAKE_INSTALL_INCLUDEDIR}
24-
${PROJECT_VERSION}
25-
${PROJECT_VERSION_MAJOR}
26-
${FPLOT_SOURCES}
27-
)
28-
link_library(${PROJECT_NAME} ${ferror_LIBRARY} ${ferror_INCLUDE_DIR})
29-
link_library(${PROJECT_NAME} ${fstring_LIBRARY} ${fstring_INCLUDE_DIR})
30-
link_library(${PROJECT_NAME} ${collections_LIBRARY} ${collections_INCLUDE_DIR})
31-
link_library(${PROJECT_NAME} ${geompack_LIBRARY} ${geompack_INCLUDE_DIR})
32-
link_library(${PROJECT_NAME} ${forcolormap_LIBRARY} ${forcolormap_INCLUDE_DIR})
3314

34-
# ------------------------------------------------------------------------------
35-
# EXAMPLES
36-
# ------------------------------------------------------------------------------
37-
option(BUILD_FPLOT_EXAMPLES "Build FPLOT examples?" OFF)
38-
if (BUILD_FPLOT_EXAMPLES)
39-
# Inform the user we're building the examples
40-
message(STATUS "Building FPLOT examples.")
41-
42-
# Build the examples
43-
add_subdirectory(examples)
44-
endif()
15+
# Install
16+
install(
17+
EXPORT ${PROJECT_NAME}-targets
18+
NAMESPACE ${PROJECT_NAME}::
19+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
20+
)
4521

46-
# ------------------------------------------------------------------------------
47-
# TESTING
48-
# ------------------------------------------------------------------------------
22+
# Testing
4923
option(BUILD_TESTING "Build tests")
5024
include(CTest)
51-
message(STATUS "Build tests: ${BUILD_TESTING}")
25+
message(STATUS "Build FPLOT tests: ${BUILD_TESTING}")
5226
if (BUILD_TESTING)
5327
enable_testing()
5428
add_subdirectory(test)
29+
endif()
30+
31+
# Examples
32+
option(BUILD_FPLOT_EXAMPLES "Build FPLOT examples")
33+
message(STATUS "Build FPLOT examples: ${BUILD_FPLOT_EXAMPLES}")
34+
if (BUILD_FPLOT_EXAMPLES)
35+
add_subdirectory(examples)
5536
endif()

cmake/helper.cmake

Lines changed: 0 additions & 75 deletions
This file was deleted.

configure/CMakeLists.txt

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Get the macros and functions we'll need
2-
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
3-
41
# Set a default build type if none was specified
52
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
63
message(STATUS "Setting build type to 'Release' as none was specified.")
@@ -13,11 +10,64 @@ endif()
1310
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
1411

1512
# Export all symbols on Windows when building libraries
16-
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
13+
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
1714

1815
# Utilize the GNU installation structure
1916
include(GNUInstallDirs)
2017

21-
# Locate the local include directory
22-
set(PROJECT_INCLUDE_DIR ${PROJECT_BINARY_DIR}/include)
23-
set(PROJECT_INCLUDE_DIR ${PROJECT_INCLUDE_DIR} PARENT_SCOPE)
18+
# Module directory
19+
if(NOT DEFINED CMAKE_INSTALL_MODULEDIR)
20+
set(
21+
CMAKE_INSTALL_MODULEDIR
22+
"${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}"
23+
CACHE
24+
STRING
25+
"Directory in prefix to install generated module files"
26+
)
27+
endif()
28+
29+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
30+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
31+
32+
# Export a pkg-config file
33+
configure_file(
34+
"${CMAKE_CURRENT_SOURCE_DIR}/template.pc"
35+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
36+
@ONLY
37+
)
38+
39+
install(
40+
FILES
41+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
42+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
43+
)
44+
45+
# Export CMake package file
46+
include(CMakePackageConfigHelpers)
47+
configure_package_config_file(
48+
"${CMAKE_CURRENT_SOURCE_DIR}/template.cmake"
49+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
50+
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
51+
)
52+
53+
if(BUILD_SHARED_LIBS OR PROJECT_VERSION_MAJOR EQUAL 0)
54+
# Due to the uncertain ABI compatibility of Fortran shared libraries
55+
# limit compatibility for dynamic linking to same minor version.
56+
set(COMPATIBILITY SameMinorVersion)
57+
else()
58+
# Require API compatibility via semantic versioning for static linking.
59+
set(COMPATIBILITY SameMajorVersion)
60+
endif()
61+
62+
write_basic_package_version_file(
63+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
64+
VERSION "${PROJECT_VERSION}"
65+
COMPATIBILITY ${COMPATIBILITY}
66+
)
67+
68+
install(
69+
FILES
70+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
71+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
72+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
73+
)

configure/template.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@PACKAGE_INIT@
2+
3+
if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
4+
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
5+
endif()

configure/template.pc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
3+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
4+
moduledir=${prefix}/@CMAKE_INSTALL_MODULEDIR@
5+
6+
Name: @PROJECT_NAME@
7+
Description: @PROJECT_DESCRIPTION@
8+
Version: @PROJECT_VERSION@
9+
Libs: -L${libdir} -l@PROJECT_NAME@
10+
Cflags: -I${includedir} -I${moduledir}

dependencies/CMakeLists.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

dependencies/collections/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)