From bb97983964855934d0b52baafebdcb6c5159aa36 Mon Sep 17 00:00:00 2001 From: Marcin Wojdyr Date: Tue, 18 Apr 2023 22:09:58 +0200 Subject: [PATCH] update Fortran bindings --- CMakeLists.txt | 4 +++- docs/install.rst | 17 ++++++++++++----- {c_fortran => fortran}/Makefile | 2 +- {c_fortran => fortran}/fsym.f90 | 0 {c_fortran => fortran}/ftest.f90 | 0 {c_fortran => fortran}/gemmi.yaml | 2 ++ {c_fortran => fortran}/write.cpp | 0 7 files changed, 18 insertions(+), 7 deletions(-) rename {c_fortran => fortran}/Makefile (95%) rename {c_fortran => fortran}/fsym.f90 (100%) rename {c_fortran => fortran}/ftest.f90 (100%) rename {c_fortran => fortran}/gemmi.yaml (98%) rename {c_fortran => fortran}/write.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b438129f..96fa7bfd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/docs/install.rst b/docs/install.rst index a7845075d..f778047f0 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -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 `_ (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 ------- diff --git a/c_fortran/Makefile b/fortran/Makefile similarity index 95% rename from c_fortran/Makefile rename to fortran/Makefile index 53fd12ecf..28cc1fd4b 100644 --- a/c_fortran/Makefile +++ b/fortran/Makefile @@ -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 diff --git a/c_fortran/fsym.f90 b/fortran/fsym.f90 similarity index 100% rename from c_fortran/fsym.f90 rename to fortran/fsym.f90 diff --git a/c_fortran/ftest.f90 b/fortran/ftest.f90 similarity index 100% rename from c_fortran/ftest.f90 rename to fortran/ftest.f90 diff --git a/c_fortran/gemmi.yaml b/fortran/gemmi.yaml similarity index 98% rename from c_fortran/gemmi.yaml rename to fortran/gemmi.yaml index 84e052b1c..10c64993c 100644 --- a/c_fortran/gemmi.yaml +++ b/fortran/gemmi.yaml @@ -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: diff --git a/c_fortran/write.cpp b/fortran/write.cpp similarity index 100% rename from c_fortran/write.cpp rename to fortran/write.cpp