Skip to content

Commit d5ef738

Browse files
robertodrarnfinn
authored andcommitted
FIx handling of pcmsolver.f90 file (#143)
* Install pcmsolver.f90 rather than compiling it * Fix documentation of configuration option
1 parent bf5b5f2 commit d5ef738

File tree

11 files changed

+45
-28
lines changed

11 files changed

+45
-28
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
This choice was made to simplify the set up of the ReadTheDocs and local
2525
documentation building procedures and to minimize the chances of breaking
2626
either.
27+
- The Fortran API bindings file `pcmsolver.f90` is now installed alongside the
28+
`pcmsolver.h` header file. The users will have to compile it explicitly to
29+
get the type checking from the API redeclaration in Fortran 90.
30+
The file is always installed.
31+
- The `ENABLE_Fortran_API` configuration option has been renamed
32+
`TEST_Fortran_API`, since it now only triggers compilation of the
33+
`Fortran_host` test case.
2734

2835
## [Version 1.2.0-rc1] - 2018-03-02
2936

api/CMakeLists.txt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
install(FILES ${PROJECT_SOURCE_DIR}/api/pcmsolver.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
2-
install(FILES ${PROJECT_SOURCE_DIR}/api/PCMInput.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
3-
4-
if(ENABLE_Fortran_API)
5-
add_library(fortran_bindings OBJECT ${PROJECT_SOURCE_DIR}/api/pcmsolver.f90)
6-
set_target_properties(fortran_bindings
7-
PROPERTIES
8-
INCLUDE_DIRECTORIES ""
9-
POSITION_INDEPENDENT_CODE 1
10-
)
11-
list(APPEND _objects $<TARGET_OBJECTS:fortran_bindings>)
12-
endif()
1+
install(
2+
FILES
3+
${PROJECT_SOURCE_DIR}/api/pcmsolver.h
4+
DESTINATION
5+
${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
6+
)
7+
install(
8+
FILES
9+
${PROJECT_SOURCE_DIR}/api/PCMInput.h
10+
DESTINATION
11+
${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
12+
)
13+
install(
14+
FILES
15+
${PROJECT_SOURCE_DIR}/api/pcmsolver.f90
16+
DESTINATION
17+
${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
18+
)

cmake/PCMSolverConfig.cmake.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
#
99
# PCMSolver_FOUND - true if PCMSolver and all required components found on the system
1010
# PCMSolver_VERSION - PCMSolver version in format Major.Minor.Release
11-
# PCMSolver_INCLUDE_DIRS - Directory where PCMSolver/pcmsolver.h header is located.
11+
# PCMSolver_INCLUDE_DIRS - Directory where the PCMSolver/pcmsolver.h,
12+
# PCMSolver/PCMInput.h headers and PCMSolver/pcmsolver.f90 source file are located.
1213
# PCMSolver_INCLUDE_DIR - same as DIRS
1314
# PCMSolver_DEFINITIONS: Definitions necessary to use PCMSolver, namely USING_PCMSolver.
1415
# PCMSolver_LIBRARIES - PCMSolver library to link against.

cmake/custom/api.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#.rst:
22
#
33
# Manage compilation of API.
4-
# Optionally, enable compilation of Fortran 90 API bindings.
4+
# Optionally, enable testing of Fortran 90 API bindings.
55
#
66
# Variables defined::
77
#
8-
# ENABLE_Fortran_API
8+
# TEST_Fortran_API
99
#
1010
# autocmake.yml configuration::
1111
#
12-
# docopt: "--fbindings=<ENABLE_Fortran_API> Enable compilation of Fortran 90 API bindings <ON/OFF> [default: ON]."
13-
# define: "'-DENABLE_Fortran_API={0}'.format(arguments['--fbindings'])"
12+
# docopt: "--fbindings=<TEST_Fortran_API> Enable testing of Fortran 90 API bindings <ON/OFF> [default: ON]."
13+
# define: "'-DTEST_Fortran_API={0}'.format(arguments['--fbindings'])"
1414

15-
option(ENABLE_Fortran_API "Enable compilation of Fortran 90 API bindings" ON)
15+
option(TEST_Fortran_API "Enable testing of Fortran 90 API bindings" ON)
1616

1717
add_subdirectory(api)
1818
include_directories(${PROJECT_SOURCE_DIR}/api)

cmake/downloaded/autocmake_omp.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ if(ENABLE_OPENMP)
4242
endif()
4343
endif()
4444

45+
# this is only needed for CMake below 3.5
4546
if(DEFINED CMAKE_Fortran_COMPILER_ID AND NOT DEFINED OpenMP_Fortran_FLAGS)
4647
# we do this in a pedestrian way because the Fortran support is relatively recent
4748
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
@@ -50,8 +51,7 @@ if(ENABLE_OPENMP)
5051
if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
5152
if(WIN32)
5253
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Qopenmp")
53-
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" AND
54-
"${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
54+
elseif("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
5555
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -openmp")
5656
else()
5757
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qopenmp")

doc/users/building.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Version 3.3.0 of Eigen libraries is shipped with the module and resides in the `
4949
Configuration
5050
-------------
5151

52-
Configuration is managed through the front-end script ``setup`` residing in the
52+
Configuration is managed through the front-end script ``setup.py`` residing in the
5353
repository main directory. Issuing:
5454

5555
.. code-block:: bash
@@ -151,7 +151,7 @@ Some options can only be tweaked `via` ``--cmake-options`` to the setup script:
151151

152152
* ``ENABLE_TIMER`` Enable compilation of timer sources. Enabled by default.
153153
* ``BUILD_STANDALONE`` Enable compilation of standalone ``run_pcm`` executable. Enabled by default.
154-
* ``ENABLE_Fortran_API`` Enable compilation of the Fortran90 bindings for the API. Enabled by default.
154+
* ``TEST_Fortran_API`` Test the Fortran 90 bindings for the API. Enabled by default.
155155
* ``ENABLE_GENERIC`` Enable mostly static linking in shared library. Disabled by default.
156156
* ``ENABLE_TESTS`` Enable compilation of unit tests suite. Enabled by default.
157157
* ``SHARED_LIBRARY_ONLY`` Create only shared library. Opposite of ``--static``.

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
--int64 Enable 64bit integers [default: False].
3131
--omp Enable OpenMP parallelization [default: False].
3232
--python=<PYTHON_INTERPRETER> The Python interpreter (development version) to use. [default: ''].
33-
--fbindings=<ENABLE_Fortran_API> Enable compilation of Fortran 90 API bindings <ON/OFF> [default: ON].
33+
--fbindings=<TEST_Fortran_API> Enable testing of Fortran 90 API bindings <ON/OFF> [default: ON].
3434
--boost-headers=<BOOST_INCLUDEDIR> Include directories for Boost [default: ''].
3535
--boost-libraries=<BOOST_LIBRARYDIR> Library directories for Boost [default: ''].
3636
--build-boost=<FORCE_CUSTOM_BOOST> Deactivate Boost detection and build on-the-fly <ON/OFF> [default: OFF].
@@ -66,7 +66,7 @@ def gen_cmake_command(options, arguments):
6666
command.append('-DENABLE_64BIT_INTEGERS={0}'.format(arguments['--int64']))
6767
command.append('-DENABLE_OPENMP={0}'.format(arguments['--omp']))
6868
command.append('-DPYTHON_INTERPRETER="{0}"'.format(arguments['--python']))
69-
command.append('-DENABLE_Fortran_API={0}'.format(arguments['--fbindings']))
69+
command.append('-DTEST_Fortran_API={0}'.format(arguments['--fbindings']))
7070
command.append('-DBOOST_INCLUDEDIR="{0}"'.format(arguments['--boost-headers']))
7171
command.append('-DBOOST_LIBRARYDIR="{0}"'.format(arguments['--boost-libraries']))
7272
command.append('-DFORCE_CUSTOM_BOOST={0}'.format(arguments['--build-boost']))

src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ add_subdirectory(utils)
1919

2020
list(APPEND _objects
2121
$<TARGET_OBJECTS:cavity>
22-
$<$<BOOL:${ENABLE_Fortran_API}>:$<TARGET_OBJECTS:fortran_bindings>>
2322
$<TARGET_OBJECTS:green>
2423
$<TARGET_OBJECTS:interface>
2524
$<TARGET_OBJECTS:metal>

src/pedra/pedra_cavity.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ subroutine polyhedra_driver(pgroup, vert, centr, masses, global_print_unit, erro
116116
natm = mxcent
117117
numver = mxver
118118

119-
write(lvpri, '(a)') "Memory management through standard Fortran90 allocate/deallocate."
119+
write(lvpri, '(a)') "Memory management through standard Fortran 90 allocate/deallocate."
120120

121121
allocate(intsph(numts, 10))
122122
intsph = 0

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ target_link_libraries(unit_tests
4646
)
4747

4848
add_subdirectory(C_host)
49-
if(ENABLE_Fortran_API)
49+
if(TEST_Fortran_API)
5050
add_subdirectory(Fortran_host)
5151
endif()
5252
if(BUILD_STANDALONE)

0 commit comments

Comments
 (0)