Skip to content

Commit f9154fc

Browse files
committed
Rename new offload library and try to match LLVM style
1 parent 88ed298 commit f9154fc

35 files changed

+82
-100
lines changed

offload/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ add_subdirectory(tools)
352352
add_subdirectory(src)
353353

354354
add_subdirectory(tools/offload-tblgen)
355-
add_subdirectory(new-api)
355+
add_subdirectory(liboffload)
356356

357357
# Add tests.
358358
add_subdirectory(test)
File renamed without changes.

offload/new-api/API/CMakeLists.txt renamed to offload/liboffload/API/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ find_program(CLANG_FORMAT clang-format PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT
66
if (CLANG_FORMAT)
77
set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/OffloadAPI.td)
88

9-
tablegen(OFFLOAD offload_api.h -gen-api)
10-
tablegen(OFFLOAD offload_funcs.inc -gen-func-names)
11-
tablegen(OFFLOAD offload_impl_func_decls.inc -gen-impl-func-decls)
12-
tablegen(OFFLOAD offload_entry_points.inc -gen-entry-points)
13-
tablegen(OFFLOAD offload_print.hpp -gen-print-header)
14-
tablegen(OFFLOAD offload_exports -gen-exports)
9+
tablegen(OFFLOAD OffloadAPI.h -gen-api)
10+
tablegen(OFFLOAD OffloadFuncs.inc -gen-func-names)
11+
tablegen(OFFLOAD OffloadImplFuncDecls.inc -gen-impl-func-decls)
12+
tablegen(OFFLOAD OffloadPrint.hpp -gen-print-header)
13+
tablegen(OFFLOAD OffloadExports -gen-exports)
1514

1615
set(OFFLOAD_GENERATED_FILES ${TABLEGEN_OUTPUT})
1716
add_public_tablegen_target(OffloadGenerate)
1817
add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CLANG_FORMAT}
1918
-i ${OFFLOAD_GENERATED_FILES})
2019
add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CMAKE_COMMAND}
21-
-E copy_if_different ${OFFLOAD_GENERATED_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/../include")
20+
-E copy_if_different ${OFFLOAD_GENERATED_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/../include/generated")
2221
else()
2322
message(WARNING "clang-format was not found, so the OffloadGenerate target\
2423
will not be available. Offload will still build, but you will not be\
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

offload/liboffload/CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
add_subdirectory(API)
2+
3+
add_llvm_library(LLVMOffload SHARED
4+
src/OffloadLib.cpp
5+
src/OffloadImpl.cpp)
6+
7+
foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
8+
target_link_libraries(LLVMOffload PRIVATE omptarget.rtl.${plugin})
9+
endforeach()
10+
11+
if(LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
12+
target_link_libraries(LLVMOffload PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
13+
endif()
14+
15+
target_include_directories(LLVMOffload PUBLIC
16+
${CMAKE_CURRENT_BINARY_DIR}/../include
17+
${CMAKE_CURRENT_SOURCE_DIR}/include
18+
${CMAKE_CURRENT_SOURCE_DIR}/include/generated
19+
${CMAKE_CURRENT_SOURCE_DIR}/../include
20+
${CMAKE_CURRENT_SOURCE_DIR}/../plugins-nextgen/common/include)
21+
22+
target_compile_options(LLVMOffload PRIVATE ${offload_compile_flags})
23+
target_link_options(LLVMOffload PRIVATE ${offload_link_flags})
24+
25+
set_target_properties(LLVMOffload PROPERTIES
26+
POSITION_INDEPENDENT_CODE ON
27+
INSTALL_RPATH "$ORIGIN"
28+
BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
29+
install(TARGETS LLVMOffload LIBRARY COMPONENT LLVMOffload DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")
30+
31+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/OffloadAPI.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
32+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/OffloadPrint.hpp DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
File renamed without changes.

0 commit comments

Comments
 (0)