From 990f40de0d5d00b0b344ac938219ee66664da5df Mon Sep 17 00:00:00 2001 From: Stefano Carrazza Date: Fri, 24 Aug 2018 10:44:20 +0200 Subject: [PATCH] adding compiler option to enable/disable fortran wrapper, included example in fortran --- CMakeLists.txt | 6 ++++++ examples/fortran_test.f | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 examples/fortran_test.f diff --git a/CMakeLists.txt b/CMakeLists.txt index 214fba7..d3a477e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,12 @@ install(FILES ${PROJECT_SOURCE_DIR}/src/qcdloop.pc DESTINATION lib/pkgconfig) install(DIRECTORY src/qcdloop DESTINATION include) install(TARGETS qcdloop DESTINATION lib) +# enable disable fortran/wrapper (to avoid name conflicts with ql1.x) +option(ENABLE_FORTRAN_WRAPPER "Enable fortran wrapper" ON) +if(ENABLE_FORTRAN_WRAPPER) + add_definitions(-DQL_NAMES) +endif() + # qcdloop examples option(ENABLE_EXAMPLES "Compile test examples" OFF) if(ENABLE_EXAMPLES) diff --git a/examples/fortran_test.f b/examples/fortran_test.f new file mode 100644 index 0000000..fb4d2a0 --- /dev/null +++ b/examples/fortran_test.f @@ -0,0 +1,19 @@ +! Example of fortran code calling the c++ library +! compile with: gfortran fortran_test.f `qcdloop-config --ldflags` + + program main + implicit none + double complex qli1 + double precision m, mu2 + +! init qcdloop objects + call qlinit() + + m = 5d0 + mu2 = 1.7d0**2 +! call some test function + write(*,*) qli1(m, mu2, 0) + write(*,*) qli1(m, mu2, 1) + write(*,*) qli1(m, mu2, 2) + + end