[libc-commits] [PATCH] D95205: [CMake][libc] Support cross-compiling libc-hdrgen
Petr Hosek via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Jan 21 22:57:19 PST 2021
phosek created this revision.
phosek added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett, mgorny.
Herald added a project: libc-project.
phosek requested review of this revision.
This is useful when cross-compiling libc to another target in which
case we first need to compile libc-hdrgen for host. We rely on the
existing LLVM CMake infrastructure for that.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95205
Files:
libc/CMakeLists.txt
libc/cmake/modules/LLVMLibCHeaderRules.cmake
libc/utils/CMakeLists.txt
libc/utils/HdrGen/CMakeLists.txt
Index: libc/utils/HdrGen/CMakeLists.txt
===================================================================
--- libc/utils/HdrGen/CMakeLists.txt
+++ libc/utils/HdrGen/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS Support)
-add_tablegen(libc-hdrgen llvm-libc
+add_tablegen(libc-hdrgen LIBC
Command.h
Command.cpp
Generator.cpp
Index: libc/utils/CMakeLists.txt
===================================================================
--- libc/utils/CMakeLists.txt
+++ libc/utils/CMakeLists.txt
@@ -1,7 +1,5 @@
add_subdirectory(CPP)
add_subdirectory(FPUtil)
-add_subdirectory(LibcTableGenUtil)
-add_subdirectory(HdrGen)
add_subdirectory(MPFRWrapper)
add_subdirectory(testutils)
add_subdirectory(tools)
Index: libc/cmake/modules/LLVMLibCHeaderRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -89,14 +89,15 @@
add_custom_command(
OUTPUT ${out_file}
- COMMAND $<TARGET_FILE:libc-hdrgen> -o ${out_file} --header ${ADD_GEN_HDR_GEN_HDR}
+ COMMAND ${LIBC_TABLEGEN_EXE} -o ${out_file} --header ${ADD_GEN_HDR_GEN_HDR}
--def ${in_file} ${replacement_params} -I ${LIBC_SOURCE_DIR}
${ENTRYPOINT_NAME_LIST_ARG}
${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${in_file} ${fq_data_files} ${td_includes}
- ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td libc-hdrgen
+ ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td
+ ${LIBC_TABLEGEN_EXE} ${LIBC_TABLEGEN_TARGET}
)
get_fq_target_name(${target_name} fq_target_name)
Index: libc/CMakeLists.txt
===================================================================
--- libc/CMakeLists.txt
+++ libc/CMakeLists.txt
@@ -81,6 +81,10 @@
list(APPEND TARGET_ENTRYPOINT_NAME_LIST ${entrypoint_name})
endforeach()
+# We need to set up hdrgen first since other targets depend on it.
+add_subdirectory(utils/LibcTableGenUtil)
+add_subdirectory(utils/HdrGen)
+
add_subdirectory(include)
add_subdirectory(config)
add_subdirectory(src)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95205.318427.patch
Type: text/x-patch
Size: 2180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210122/271c1230/attachment.bin>
More information about the libc-commits
mailing list