File tree Expand file tree Collapse file tree 4 files changed +32
-15
lines changed Expand file tree Collapse file tree 4 files changed +32
-15
lines changed Original file line number Diff line number Diff line change 11get_host_tool_path( clang CLANG clang_exe clang_target )
22
33set (SYCL_JIT_RESOURCE_CPP "${CMAKE_CURRENT_BINARY_DIR} /resource.cpp" )
4- # NOTE: has to have a name different from the "default" object target:
5- set (SYCL_JIT_RESOURCE_OBJ "${CMAKE_CURRENT_BINARY_DIR} /resource.cpp.custom.o" )
4+ set (SYCL_JIT_RESOURCE_OBJ "${CMAKE_CURRENT_BINARY_DIR} /resource.cpp.o" )
65
76add_custom_command (
87 OUTPUT ${SYCL_JIT_RESOURCE_CPP}
@@ -16,9 +15,18 @@ add_custom_command(
1615# We use C23/C++26's `#embed` to implement this resource creation, and "current"
1716# CMAKE_CXX_COMPILER might not have support for it. As such, use freshly built
1817# `clang++` instead.
18+ set (SYCL_JIT_RESOURCE_CXX_FLAGS -O2 -Wno-c23-extensions)
19+ if (LLVM_ENABLE_PIC)
20+ list (APPEND SYCL_JIT_RESOURCE_CXX_FLAGS -fPIC)
21+ endif ()
22+
23+ if (NOT WIN32 )
24+ list (APPEND SYCL_JIT_RESOURCE_CXX_FLAGS -fvisibility=hidden)
25+ endif ()
26+
1927add_custom_command (
2028 OUTPUT ${SYCL_JIT_RESOURCE_OBJ}
21- COMMAND ${clang_exe} ${SYCL_JIT_RESOURCE_CPP} -c -o ${SYCL_JIT_RESOURCE_OBJ} -O2 -Wno-c23-extensions -fPIC
29+ COMMAND ${clang_exe} ${SYCL_JIT_RESOURCE_CPP} -I ${CMAKE_CURRENT_SOURCE_DIR} / include - c -o ${SYCL_JIT_RESOURCE_OBJ} ${SYCL_JIT_RESOURCE_CXX_FLAGS}
2230 DEPENDS ${SYCL_JIT_RESOURCE_CPP}
2331)
2432
Original file line number Diff line number Diff line change 1+ // ===----------------------------------------------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #pragma once
10+
11+ #include < string_view>
12+ #include < utility>
13+
14+ namespace jit_compiler {
15+ // Defined in the auto-generated file:
16+ extern const std::pair<std::string_view, std::string_view> ToolchainFiles[];
17+ extern size_t NumToolchainFiles;
18+ extern std::string_view ToolchainPrefix;
19+ } // namespace jit_compiler
Original file line number Diff line number Diff line change 99#include " DeviceCompilation.h"
1010#include " ESIMD.h"
1111#include " JITBinaryInfo.h"
12+ #include " Resource.h"
1213#include " translation/Translation.h"
1314
1415#include < clang/Basic/DiagnosticDriver.h>
5152#include < array>
5253#include < sstream>
5354
54- namespace jit_compiler {
55- // Defined in the auto-generated file:
56- extern const std::pair<std::string_view, std::string_view> ToolchainFiles[];
57- extern size_t NumToolchainFiles;
58- extern std::string_view ToolchainPrefix;
59- } // namespace jit_compiler
60-
6155using namespace clang ;
6256using namespace clang ::tooling;
6357using namespace clang ::driver;
Original file line number Diff line number Diff line change @@ -25,11 +25,9 @@ def main():
2525 with open (args .output , "w" ) as out :
2626 out .write (
2727 """
28- #include <utility>
29- #include <string_view>
28+ #include <Resource.h>
3029
3130namespace jit_compiler {
32- extern const std::pair<std::string_view, std::string_view> ToolchainFiles[];
3331const std::pair<std::string_view, std::string_view> ToolchainFiles[] = {"""
3432 )
3533
@@ -57,9 +55,7 @@ def process_dir(dir):
5755 f"""
5856}};
5957
60- extern size_t NumToolchainFiles;
6158size_t NumToolchainFiles = std::size(ToolchainFiles);
62- extern std::string_view ToolchainPrefix;
6359std::string_view ToolchainPrefix = "{ args .prefix } ";
6460}} // namespace jit_compiler
6561"""
You can’t perform that action at this time.
0 commit comments