Skip to content

Commit fb7698d

Browse files
committed
[ORC-RT] Initial check-in for a new, top-level ORC runtime project.
Includes CMake files and a placeholder header, library, and tool. See discussion at https://discourse.llvm.org/t/rfc-move-orc-executor-support-into-top-level-project/81049
1 parent a3508e0 commit fb7698d

File tree

11 files changed

+95
-2
lines changed

11 files changed

+95
-2
lines changed

llvm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ endif()
155155
# As we migrate runtimes to using the bootstrapping build, the set of default runtimes
156156
# should grow as we remove those runtimes from LLVM_ENABLE_PROJECTS above.
157157
set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind")
158-
set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload")
158+
set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload;orc-rt")
159159
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
160160
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
161161
if(LLVM_ENABLE_RUNTIMES STREQUAL "all")

llvm/projects/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ foreach(entry ${entries})
99
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libcxx) AND
1010
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libcxxabi) AND
1111
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libunwind) AND
12+
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/orc-rt) AND
1213
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/test-suite) AND
1314
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/openmp) AND
1415
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/cross-project-tests))
@@ -33,6 +34,7 @@ if(${LLVM_BUILD_RUNTIME})
3334
add_llvm_external_project(libc)
3435
add_llvm_external_project(libcxxabi)
3536
add_llvm_external_project(libcxx)
37+
add_llvm_external_project(orc-rt)
3638
endif()
3739
if(NOT LLVM_BUILD_EXTERNAL_COMPILER_RT)
3840
add_llvm_external_project(compiler-rt)

orc-rt/CMakeLists.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# CMake build for ORC-RT.
2+
3+
#===============================================================================
4+
# Setup Project
5+
#===============================================================================
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
set(LLVM_SUBPROJECT_TITLE "orc-rt")
9+
10+
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
11+
12+
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
13+
NO_POLICY_SCOPE)
14+
15+
# Add path for custom orc-rt modules.
16+
list(INSERT CMAKE_MODULE_PATH 0
17+
# "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
18+
# "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
19+
"${LLVM_COMMON_CMAKE_UTILS}"
20+
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
21+
)
22+
23+
set(CMAKE_FOLDER "orc-rt")
24+
25+
set(LIBORCRT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
26+
set(LIBORCRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
27+
28+
#===============================================================================
29+
# Setup CMake Options
30+
#===============================================================================
31+
32+
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
33+
set(CMAKE_CXX_STANDARD_REQUIRED YES)
34+
set(CMAKE_CXX_EXTENSIONS NO)
35+
36+
#================================
37+
# Setup Compiler Flags
38+
#================================
39+
40+
# Configure compiler. Must happen after setting the target flags.
41+
42+
#===============================================================================
43+
# Setup Source Code
44+
#===============================================================================
45+
46+
add_subdirectory(lib)
47+
add_subdirectory(tools)

orc-rt/include/orc-rt-c/orc-rt.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*===- orc-rt-c/orc-rt.h - Placeholder header for orc-rt ----------*- C -*-===*\
2+
|* *|
3+
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4+
|* Exceptions. *|
5+
|* See https://llvm.org/LICENSE.txt for license information. *|
6+
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7+
|* *|
8+
|*===----------------------------------------------------------------------===*|
9+
|* *|
10+
|* Placeholder header for initial orc-rt checkin *|
11+
|* *|
12+
\*===----------------------------------------------------------------------===*/
13+
14+
#ifndef ORC_RT_C_ORC_RT_H
15+
#define ORC_RT_C_ORC_RT_H
16+
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
21+
void orc_rt(void);
22+
23+
#ifdef __cplusplus
24+
} /* extern "C" */
25+
#endif
26+
27+
#endif /* ORC_RT_C_ORC_RT_H */

orc-rt/lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(prelink)

orc-rt/lib/prelink/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_library(orc-rt-prelink STATIC orc-rt-prelink.cpp)

orc-rt/lib/prelink/orc-rt-prelink.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdio.h>
2+
3+
extern "C" void orc_rt(void) {
4+
printf("hello, world!\n");
5+
}

orc-rt/tools/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(orc-executor)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_executable(orc-executor orc-executor.cpp)
2+
target_link_libraries(orc-executor PRIVATE orc-rt-prelink)
3+
target_include_directories(orc-executor PRIVATE ../../include)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "orc-rt-c/orc-rt.h"
2+
3+
int main(int argc, char *argv[]) {
4+
orc_rt();
5+
return 0;
6+
}

0 commit comments

Comments
 (0)