-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support in CMakeLists.txt
for lfortran
#260
Comments
To build: HERE="$(git rev-parse --show-toplevel)"
SRC_DIR="${HERE}/src/fortran"
BUILD_DIR="${HERE}/build-lfortran/build"
INSTALL_PREFIX="${HERE}/build-lfortran/usr"
LFORTRAN_BIN="$(pyenv which lfortran)"
echo "LFORTRAN_BIN=${LFORTRAN_BIN}"
rm -fr "${HERE}/build-lfortran"
mkdir -p "${BUILD_DIR}"
cmake \
-DCMAKE_Fortran_COMPILER="${LFORTRAN_BIN}" \
-DCMAKE_Fortran_COMPILER_ID=LFort \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-S "${SRC_DIR}" \
-B "${BUILD_DIR}"
cmake \
--build "${BUILD_DIR}" \
--config Debug \
--target install
cmake -L "${BUILD_DIR}" Note that |
Using this as a starting point: diff --git a/src/fortran/CMakeLists.txt b/src/fortran/CMakeLists.txt
index c2d5088..fab229b 100644
--- a/src/fortran/CMakeLists.txt
+++ b/src/fortran/CMakeLists.txt
@@ -11,8 +11,8 @@ set(DESCRIPTION "Library for Bezier curves and triangles.")
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(TARGET_NATIVE_ARCH "Optimize build for host (native) architecture" ON)
-if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Intel)$")
- message(FATAL_ERROR "gfortran and ifort are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
+if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Intel|LFort)$")
+ message(FATAL_ERROR "gfortran, ifort and lfortran are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
endif()
if(NOT CMAKE_BUILD_TYPE)
@@ -77,7 +77,7 @@ endif()
target_include_directories(bezier PUBLIC $<INSTALL_INTERFACE:include>)
-if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|LFort)$")
# ``-Wextra`` includes ``no-compare-reals``, but we have comparisons like
# ``value == 0.0_dp``.
target_compile_options(
@@ -109,7 +109,7 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
target_compile_options(quadpack PUBLIC -fast)
endif()
else()
- message(FATAL_ERROR "gfortran and ifort are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
+ message(FATAL_ERROR "gfortran, ifort and lfortran are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
endif()
include(GNUInstallDirs)
diff --git a/src/fortran/quadpack/CMakeLists.txt b/src/fortran/quadpack/CMakeLists.txt
index 02e242e..23e5dec 100644
--- a/src/fortran/quadpack/CMakeLists.txt
+++ b/src/fortran/quadpack/CMakeLists.txt
@@ -5,8 +5,8 @@ project(
DESCRIPTION "Library for numerical integration of one-dimensional functions."
LANGUAGES Fortran)
-if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Intel)$")
- message(FATAL_ERROR "gfortran and lfortran are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
+if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Intel|LFort)$")
+ message(FATAL_ERROR "gfortran, ifort and lfortran are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
endif()
if(NOT CMAKE_BUILD_TYPE)
@@ -34,7 +34,7 @@ if(${BUILD_SHARED_LIBS})
set_target_properties(quadpack PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
-if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|LFort)$")
# ``-Wextra`` includes ``no-compare-reals``, but we have comparisons like
# ``value == 0.0_dp``.
target_compile_options(
@@ -64,7 +64,7 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
target_compile_options(quadpack PUBLIC -fast)
endif()
else()
- message(FATAL_ERROR "gfortran and lfortran are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
+ message(FATAL_ERROR "gfortran, ifort and lfortran are the only supported compilers (current compiler ID is ${CMAKE_Fortran_COMPILER_ID})")
endif()
# Restore all Fortran flags. As mentioned compiling F77 / |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pyenv install anaconda3-2020.11
+pyenv local anaconda3-2020.11 3.9.1
)quadpack
is a problem because of: https://gitlab.com/lfortran/lfortran/-/issues/120The text was updated successfully, but these errors were encountered: