aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Neumann <30894796+Neumann-A@users.noreply.github.com>2020-08-12 19:28:41 +0200
committerGitHub <noreply@github.com>2020-08-12 10:28:41 -0700
commitf3b96f339c3179f8f1c46b412d192e0c8a84eb5e (patch)
tree1602ac95f8097220ffb55a62bbce63322cab3a5b /scripts
parentdea76199aad32b41af3e6d33a265d62d187a3da2 (diff)
downloadvcpkg-f3b96f339c3179f8f1c46b412d192e0c8a84eb5e.tar.gz
vcpkg-f3b96f339c3179f8f1c46b412d192e0c8a84eb5e.zip
[lapack-reference|fortran] Add new port (#12805)
* [vcpkg/script] add vcpkg_find_fortran * [openblas] add pkg-config fixes * [lapack] add lapack-reference and reduce dependency on clapack * fix build issues * dont touch any main files * move toolchain var into parent scope * fix a few more issues * create link in the noblas case * removed unnecessary check handled by vcpkg_find_fortran. * move dumpbin check * fix last issue * depend on openblas * set cmake_binary_dir so that compiler id run gets put into buildtree. * more paths * add missing PARENT_SCOPE * ws change * [mlpack] remove dep on clapack * comment out patches * remove openblas again * Install lapack wrapper since it is missing linkage against -lm and -lgfortran * PREPEND mingw path to make sure cmake picks it up correctly * depend on openblas also on osx * add clapack on windows to skip due to conflicting library installs * add clapack to skip on linux * add -fPIC as a fortran compiler flag * do not add the flag on windows * add gcc explicitly to the cmake args. * ws change * applyrequested changes from CR * fix the failing patch
Diffstat (limited to 'scripts')
-rw-r--r--scripts/ci.baseline.txt5
-rw-r--r--scripts/cmake/vcpkg_find_fortran.cmake61
2 files changed, 66 insertions, 0 deletions
diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt
index a6cc7c886..9bf7bcf16 100644
--- a/scripts/ci.baseline.txt
+++ b/scripts/ci.baseline.txt
@@ -208,6 +208,11 @@ chmlib:x64-uwp=fail
civetweb:arm64-windows = skip
civetweb:arm-uwp = skip
civetweb:x64-uwp = skip
+# clapack is replaced by lapack-reference.
+clapack:x64-linux = skip
+clapack:x64-windows = skip
+clapack:x64-windows-static = skip
+clapack:x86-windows = skip
clapack:x64-uwp=fail
clblas:arm64-windows=fail
clblast:x64-linux=fail
diff --git a/scripts/cmake/vcpkg_find_fortran.cmake b/scripts/cmake/vcpkg_find_fortran.cmake
new file mode 100644
index 000000000..e6be2722e
--- /dev/null
+++ b/scripts/cmake/vcpkg_find_fortran.cmake
@@ -0,0 +1,61 @@
+## # vcpkg_find_fortran
+##
+## Checks if a Fortran compiler can be found.
+## Windows(x86/x64) Only: If not it will switch/enable MinGW gfortran
+## and return required cmake args for building.
+##
+## ## Usage
+## ```cmake
+## vcpkg_find_fortran(<additional_cmake_args_out>
+## )
+## ```
+
+function(vcpkg_find_fortran additional_cmake_args_out)
+ set(ARGS_OUT)
+ set(CMAKE_BINARY_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
+ set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_BINARY_DIR}")
+ set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_BINARY_DIR}/Platform")
+ include(CMakeDetermineFortranCompiler)
+ if(NOT CMAKE_Fortran_COMPILER AND NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
+ # This intentionally breaks users with a custom toolchain which do not have a Fortran compiler setup
+ # because they either need to use a port-overlay (for e.g. lapack), remove the toolchain for the port using fortran
+ # or setup fortran in their VCPKG_CHAINLOAD_TOOLCHAIN_FILE themselfs!
+ if(WIN32)
+ message(STATUS "No Fortran compiler found on the PATH. Using MinGW gfortran!")
+ # If no Fortran compiler is on the path we switch to use gfortan from MinGW within vcpkg
+ set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake") # Switching to mingw toolchain
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(MINGW_PATH mingw32)
+ set(MSYS_TARGET i686)
+ set(MACHINE_FLAG -m32)
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(MINGW_PATH mingw64)
+ set(MSYS_TARGET x86_64)
+ set(MACHINE_FLAG -m64)
+ else()
+ message(FATAL_ERROR "Unknown architecture '${VCPKG_TARGET_ARCHITECTURE}' for MinGW Fortran build!")
+ endif()
+ vcpkg_acquire_msys(MSYS_ROOT "mingw-w64-${MSYS_TARGET}-gcc-fortran")
+ set(MINGW_BIN "${MSYS_ROOT}/${MINGW_PATH}/bin")
+ vcpkg_add_to_path(PREPEND "${MINGW_BIN}")
+ list(APPEND ARGS_OUT -DCMAKE_GNUtoMS=ON
+ "-DCMAKE_Fortran_COMPILER=${MINGW_BIN}/gfortran.exe"
+ "-DCMAKE_C_COMPILER=${MINGW_BIN}/gcc.exe"
+ "-DCMAKE_Fortran_FLAGS_INIT:STRING= -mabi=ms ${MACHINE_FLAG} ${VCPKG_Fortran_FLAGS}")
+ set(VCPKG_USE_INTERNAL_Fortran TRUE PARENT_SCOPE)
+ set(VCPKG_POLICY_SKIP_DUMPBIN_CHECKS enabled PARENT_SCOPE)
+ set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake" PARENT_SCOPE) # Switching to MinGW toolchain for Fortran
+ if(VCPKG_CRT_LINKAGE STREQUAL "static")
+ set(VCPKG_CRT_LINKAGE dynamic PARENT_SCOPE)
+ message(STATUS "VCPKG_CRT_LINKAGE linkage for ${PORT} using vcpkg's internal gfortran cannot be static due to linking against MinGW libraries. Forcing dynamic CRT linkage")
+ endif()
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ set(VCPKG_LIBRARY_LINKAGE dynamic PARENT_SCOPE)
+ message(STATUS "VCPKG_LIBRARY_LINKAGE linkage for ${PORT} using vcpkg's internal gfortran cannot be static due to linking against MinGW libraries. Forcing dynamic library linkage")
+ endif()
+ else()
+ message(FATAL_ERROR "Unable to find a Fortran compiler using 'CMakeDetermineFortranCompiler'. Please install one (e.g. gfortran) and make it available on the PATH!")
+ endif()
+ endif()
+ set(${additional_cmake_args_out} ${ARGS_OUT} PARENT_SCOPE)
+endfunction() \ No newline at end of file