Skip to content

Commit

Permalink
update Fortran bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
wojdyr committed Apr 18, 2023
1 parent 8abb1b4 commit bb97983
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ if (INFO)
endif()

if (USE_FORTRAN)
message(STATUS "Currently, Fortran bindings are not built by cmake.")
message(STATUS "They can be built by running make in fortran directory.")
enable_language(Fortran)
else()
message(STATUS "Skipping Fortran bindings. Add -D USE_FORTRAN=1 to build them.")
#message(STATUS "Skipping Fortran bindings. Add -D USE_FORTRAN=1 to build them.")
endif()

if (DEFINED ENV{EXTRA_WFLAGS})
Expand Down
17 changes: 12 additions & 5 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,25 @@ Fortran and C bindings
----------------------

The Fortran bindings are in early stage and are not documented yet.
They use the ISO_C_BINDING module introduced in Fortran 2003.
They use the ISO_C_BINDING module introduced in Fortran 2003
and `shroud <https://github.com/LLNL/shroud>`_ (the latest version from git).
You may see the ``fortran/`` directory to know what to expect.
The bindings and usage examples can be compiled with CMake::
This directory contains Makefile -- run make to built the bindings.
(They are currently not integrated with the cmake build.)

..
The bindings and usage examples can be compiled with CMake::
cmake -D USE_FORTRAN=1 .
make

The C bindings are used only for making Fortran bindings,
but they should be usable on their own.
If you use cmake to build the project
you get a static library ``libcgemmi.a`` that can be used from C,
together with the :file:`fortran/*.h` headers.

..
If you use cmake to build the project
you get a static library ``libcgemmi.a`` that can be used from C,
together with the :file:`fortran/*.h` headers.
Program
-------
Expand Down
2 changes: 1 addition & 1 deletion c_fortran/Makefile → fortran/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ clean:
rm -f $(TEST_PROGS) *.a *.o *.mod
rm -f wrap* types*.h util*.cpp *.json *.log gemmi_types.yaml

$(C_OBJS:.o=.cpp) $(F_OBJS:.o=.f): gemmi.yaml
$(C_OBJS:.o=.cpp) $(F_OBJS:.o=.f90): gemmi.yaml
shroud gemmi.yaml

%.o: %.cpp
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions c_fortran/gemmi.yaml → fortran/gemmi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ library: gemmi
namespace: gemmi
format:
C_prefix: ge_
F_filename_suffix: f90
options:
wrap_struct_as: class
C_line_length: 94
F_line_length: 94
F_API_case: lower

splicer_code:
c:
Expand Down
File renamed without changes.

0 comments on commit bb97983

Please sign in to comment.