-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[vcpkg/fortran] Switch to ifort as the Fortran compiler #19413
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
Changes from all commits
e913fac
7c044f0
b013d52
265dc58
748c1a6
aa1bae1
7f18045
1598ae8
d9578d8
95e522e
4645f90
5dae300
958dcf4
165a35d
5bbd0ff
ebe763f
0c88af0
920d824
23b8903
a4a8d4b
a5a5cbb
1ca71a6
72e9b55
18a79ac
ef66652
81334b6
4b11744
3a2aa16
51bc1c8
fa3d306
fdeac76
190d8ae
2834bf1
a1c7798
e548037
bd501bb
5df8d64
83cd7b1
0365bde
ff140f3
f92a679
237e6ad
1f3d434
d5046a2
0a948fe
0dd65bb
dc90292
abfc0f0
0609d55
bf21246
f94bb10
b3a7158
9e0234c
d6c3f7d
a83fda7
b0d0816
c51de5e
5f56132
32dd4db
e111bf2
bf206e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| diff --git a/INSTALL/dsecnd_EXT_ETIME.f b/INSTALL/dsecnd_EXT_ETIME.f | ||
| index 35377643b..f98aad7a9 100644 | ||
| --- a/INSTALL/dsecnd_EXT_ETIME.f | ||
| +++ b/INSTALL/dsecnd_EXT_ETIME.f | ||
| @@ -34,6 +34,9 @@ | ||
| * | ||
| * ===================================================================== | ||
| DOUBLE PRECISION FUNCTION DSECND( ) | ||
| +#if defined(__INTEL_COMPILER) | ||
| + USE IFPORT | ||
| +#endif | ||
| * | ||
| * -- LAPACK auxiliary routine -- | ||
| * -- LAPACK is a software package provided by Univ. of Tennessee, -- | ||
| diff --git a/INSTALL/second_EXT_ETIME.f b/INSTALL/second_EXT_ETIME.f | ||
| index 43044cda7..0e2a9a331 100644 | ||
| --- a/INSTALL/second_EXT_ETIME.f | ||
| +++ b/INSTALL/second_EXT_ETIME.f | ||
| @@ -34,6 +34,9 @@ | ||
| * | ||
| * ===================================================================== | ||
| REAL FUNCTION SECOND( ) | ||
| +#if defined(__INTEL_COMPILER) | ||
| + USE IFPORT | ||
| +#endif | ||
| * | ||
| * -- LAPACK auxiliary routine -- | ||
| * -- LAPACK is a software package provided by Univ. of Tennessee, -- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "name": "vcpkg-cmake", | ||
| "version-date": "2022-04-21", | ||
| "version-date": "2022-04-28", | ||
| "license": "MIT" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| Copyright (c) Microsoft Corporation | ||
Neumann-A marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| All rights reserved. | ||
|
|
||
| MIT License | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| this software and associated documentation files (the "Software"), to deal in | ||
| the Software without restriction, including without limitation the rights to | ||
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
| of the Software, and to permit persons to whom the Software is furnished to do | ||
| so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| set(FUNCTION_NAME x_vcpkg_find_fortran) | ||
|
|
||
| if(VCPKG_CROSSCOMPILING) | ||
| # make FATAL_ERROR in CI when issue #16773 fixed | ||
| message(WARNING "${PORT} is a host-only port; please mark it as a host port in your dependencies.") | ||
Neumann-A marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| endif() | ||
|
|
||
| file(COPY | ||
| "${CMAKE_CURRENT_LIST_DIR}/${FUNCTION_NAME}.cmake" | ||
| "${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_load_environment_from_batch.cmake" | ||
| "${CMAKE_CURRENT_LIST_DIR}/copyright" | ||
| DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
|
|
||
| configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY) | ||
|
|
||
| set(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| include("${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_load_environment_from_batch.cmake") | ||
| include("${CMAKE_CURRENT_LIST_DIR}/@FUNCTION_NAME@.cmake") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "name": "vcpkg-fortran", | ||
| "version-date": "2022-02-22", | ||
| "description": "Metaport to use a fortran compiler", | ||
| "license": "MIT", | ||
| "supports": "windows & !arm" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| #[===[.md: | ||
| # x_vcpkg_find_fortran | ||
|
|
||
| Checks if a Fortran compiler can be found. | ||
| Windows(x86/x64) Only: If not it will search and enable Intel | ||
| ifort compiler if available. | ||
|
|
||
| ## Usage | ||
| ```cmake | ||
| x_vcpkg_find_fortran(<out_var>) | ||
| ``` | ||
|
|
||
| ## Example | ||
| ```cmake | ||
| x_vcpkg_find_fortran(fortran_args) | ||
| # ... | ||
| vcpkg_configure_cmake(... | ||
| OPTIONS | ||
| ${fortran_args} | ||
| ) | ||
| ``` | ||
| #]===] | ||
|
|
||
|
|
||
| function(x_vcpkg_find_fortran out_var) | ||
| if("${ARGC}" GREATER "1") | ||
| message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra args: ${ARGN}") | ||
| endif() | ||
|
|
||
| vcpkg_list(SET additional_cmake_args) | ||
|
|
||
| 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(CMAKE_Fortran_COMPILER) | ||
| set(VCPKG_DETECTED_CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}" PARENT_SCOPE) | ||
| endif() | ||
| if(NOT CMAKE_Fortran_COMPILER AND "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "") | ||
| # If a user uses their own VCPKG_CHAINLOAD_TOOLCHAIN_FILE, they _must_ figure out Fortran on their own. | ||
| if(WIN32) | ||
| message(STATUS "No Fortran compiler found on the PATH. Trying to find and use ifort!") | ||
| set(PATH_SUFFIX "bin/intel64") | ||
| if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") | ||
| string(APPEND PATH_SUFFIX "_ia32") | ||
| endif() | ||
| find_program(IFORT NAMES ifort PATHS ENV IFORT_COMPILER21 IFORT_COMPILER20 IFORT_COMPILER19 PATH_SUFFIXES "${PATH_SUFFIX}") | ||
| if(NOT IFORT) | ||
| message(STATUS "IFORT_COMPILER21:$ENV{IFORT_COMPILER21}") | ||
| message(STATUS "ONEAPI_ROOT:$ENV{ONEAPI_ROOT}") | ||
| message(FATAL_ERROR "ifort not found! Please install ifort from the Intel oneAPI for HPC toolkit: https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit/download.html!") | ||
| endif() | ||
| find_file(SETVARS NAMES setvars.bat PATHS ENV ONEAPI_ROOT) | ||
| if(NOT SETVARS) | ||
| message(FATAL_ERROR "Batch file to setup Intel oneAPI not found! Please provide a correct ONEAPI_ROOT and make sure it contains setvars.bat!") | ||
| endif() | ||
| z_vcpkg_load_environment_from_batch(BATCH_FILE_PATH "${SETVARS}") | ||
| if(VCPKG_TARGET_IS_UWP) | ||
| set(extra_uwp_flags "/NODEFAULTLIB /Qopenmp-stubs /D_UNICODE /DUNICODE /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D__WRL_NO_DEFAULT_LIB__") | ||
| set(exta_uwp_link_flags "-DCMAKE_SHARED_LINKER_FLAGS_INIT:STRING=/APPCONTAINER") | ||
| endif() | ||
|
Comment on lines
+58
to
+61
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UWP is not really supported since the Intel Fortran libraries don't have the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could edit the DLLs after the fact and add the bit -- though it may fail WACK later for other reasons.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It isn't just adding the bit; there's also the whole onecore vs. kernel32 thing... :( |
||
|
|
||
| vcpkg_list(APPEND additional_cmake_args | ||
| "-DCMAKE_Fortran_COMPILER=${IFORT}" | ||
| "-DCMAKE_Fortran_FLAGS_INIT:STRING=/Z7 /names:lowercase /assume:underscore /assume:protect_parens ${extra_uwp_flags}" | ||
| "${exta_uwp_link_flags}") | ||
| set(VCPKG_USE_INTERNAL_Fortran TRUE CACHE INTERNAL "") | ||
| 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("${out_var}" "${additional_cmake_args}" PARENT_SCOPE) | ||
| endfunction() | ||
Uh oh!
There was an error while loading. Please reload this page.