[flang-commits] [flang] c687c2c - [FLANG] Fix MSVC + clang-cl build
Muhammad Omair Javaid via flang-commits
flang-commits at lists.llvm.org
Wed Nov 30 03:29:58 PST 2022
Author: Muhammad Omair Javaid
Date: 2022-11-30T16:29:26+05:00
New Revision: c687c2cce5198676b72734265780d8d898674e7a
URL: https://github.com/llvm/llvm-project/commit/c687c2cce5198676b72734265780d8d898674e7a
DIFF: https://github.com/llvm/llvm-project/commit/c687c2cce5198676b72734265780d8d898674e7a.diff
LOG: [FLANG] Fix MSVC + clang-cl build
Flang build on windows with MSVC environment and clang-cl compiler
requires clang_rt.builtin.${target} library. This patch allows us to
locate and include this link library. This is mostly needed for flang
runtime and associated unittests as it requires the uint128 division
builtin function __udivti3.
Reviewed By: DavidTruby
Differential Revision: https://reviews.llvm.org/D138023
Added:
Modified:
flang/CMakeLists.txt
Removed:
################################################################################
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 2115ae9f3d59..d97adbccf493 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -38,6 +38,16 @@ endif()
# Must go below project(..)
include(GNUInstallDirs)
+# MSVC + clang-cl build requires clang_rt.builtin.${target} library
+if (MSVC AND CMAKE_CXX_COMPILER_ID MATCHES Clang)
+ include(HandleCompilerRT)
+ find_compiler_rt_library(builtins CLANG_RT_BUILTINS_LIBRARY)
+ get_filename_component(LIBDIR "${CLANG_RT_BUILTINS_LIBRARY}" DIRECTORY)
+ if (IS_DIRECTORY "${LIBDIR}")
+ link_libraries(${CLANG_RT_BUILTINS_LIBRARY})
+ endif()
+endif()
+
if (FLANG_STANDALONE_BUILD)
set(FLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
if (NOT MSVC_IDE)
More information about the flang-commits
mailing list