Skip to content

Commit 21229e0

Browse files
committed
Properties to apply to all targets of a library
1 parent 8dbc647 commit 21229e0

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@
2727
# Library requires include path and linking to LLVM's Support component
2828
# ADDITIONAL_HEADERS
2929
# May specify header files for IDE generators.
30+
# INCLUDE_DIRECTORIES
31+
# Additional include_directories for all added targets
32+
# TARGET_PROPERTIES
33+
# Set target properties of all added targets
3034
# )
3135
function (add_flangrt_library name)
3236
set(options STATIC SHARED OBJECT INSTALL_WITH_TOOLCHAIN EXCLUDE_FROM_ALL LINK_TO_LLVM)
33-
set(multiValueArgs ADDITIONAL_HEADERS)
37+
set(multiValueArgs ADDITIONAL_HEADERS INCLUDE_DIRECTORIES TARGET_PROPERTIES)
3438
cmake_parse_arguments(ARG
3539
"${options}"
3640
""
@@ -152,6 +156,10 @@ function (add_flangrt_library name)
152156
target_include_directories(${name} PUBLIC ${LLVM_INCLUDE_DIRS})
153157
endif ()
154158

159+
if (ARG_INCLUDE_DIRECTORIES)
160+
target_include_directories(${name} ${ARG_INCLUDE_DIRECTORIES})
161+
endif ()
162+
155163
# If this is part of the toolchain, put it into the compiler's resource
156164
# directory. Otherwise it is part of testing and is not installed at all.
157165
# TODO: Consider multi-configuration builds (MSVC_IDE, "Ninja Multi-Config")
@@ -166,6 +174,10 @@ function (add_flangrt_library name)
166174
)
167175
endif ()
168176

177+
if (ARG_TARGET_PROPERTIES)
178+
set_target_properties(${name} PROPERTIES ${ARG_TARGET_PROPERTIES})
179+
endif ()
180+
169181
# flang-rt should build all the Flang-RT targets that are built in an
170182
# 'all' build.
171183
if (NOT ARG_EXCLUDE_FROM_ALL)

flang-rt/lib/flang_rt/CUDA/CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@ add_flangrt_library(CufRuntime STATIC
1515
memmove-function.cpp
1616
memory.cpp
1717
registration.cpp
18-
)
1918

20-
# libCufRuntime depends on a certain version of CUDA. To be able to have
21-
# multiple build of this library with different CUDA version, the version is
22-
# added to the library name.
23-
set_target_properties(CufRuntime
24-
PROPERTIES
19+
# libCufRuntime depends on a certain version of CUDA. To be able to have
20+
# multiple build of this library with different CUDA version, the version is
21+
# added to the library name.
22+
TARGET_PROPERTIES
2523
OUTPUT_NAME "CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}"
26-
)
2724

28-
target_include_directories(CufRuntime PRIVATE ${CUDAToolkit_INCLUDE_DIRS})
25+
INCLUDE_DIRECTORIES
26+
PRIVATE ${CUDAToolkit_INCLUDE_DIRS}
27+
)
2928

3029
target_link_libraries(CufRuntime
3130
PUBLIC

flang/include/flang/Runtime/descriptor-consts.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
1313
#include "flang/Common/api-attrs.h"
14+
#include "flang/Common/Fortran-consts.h"
1415
#include <cstddef>
1516
#include <cstdint>
1617

@@ -29,6 +30,7 @@ class DerivedType;
2930
namespace Fortran::runtime {
3031
class Descriptor;
3132
using SubscriptValue = ISO::CFI_index_t;
33+
using common::TypeCategory;
3234

3335
/// Returns size in bytes of the descriptor (not the data)
3436
/// This must be at least as large as the largest descriptor of any target

0 commit comments

Comments
 (0)