Skip to content

Commit 0c6ad3d

Browse files
committed
[cmake] Add NATIVE build for cross compiling standalone builds
TableGen is a host tool and requires a native variant for every build. While building as a part of llvm this is trivial and llvm handles it. However, building standalone means that lldb has to handle this itself. Add a NATIVE build variant to enable this. llvm-svn: 366392
1 parent 6898332 commit 0c6ad3d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lldb/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ if (NOT LLDB_DISABLE_PYTHON)
3939
add_subdirectory(scripts)
4040
endif ()
4141

42+
if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE)
43+
set(LLVM_USE_HOST_TOOLS ON)
44+
include(CrossCompile)
45+
if (NOT LLDB_PATH_TO_NATIVE_LLVM_BUILD OR
46+
NOT LLDB_PATH_TO_NATIVE_CLANG_BUILD)
47+
message(FATAL_ERROR
48+
"Crosscompiling standalone requires the variables LLDB_PATH_TO_NATIVE_{CLANG,LLVM}_BUILD
49+
for building the native lldb-tblgen used during the build process.")
50+
endif()
51+
llvm_create_cross_target(lldb NATIVE "" Release
52+
-DLLDB_PATH_TO_LLVM_BUILD=${LLDB_PATH_TO_NATIVE_LLVM_BUILD}
53+
-DLLDB_PATH_TO_CLANG_BUILD=${LLDB_PATH_TO_NATIVE_CLANG_BUILD})
54+
endif()
55+
4256
add_subdirectory(utils/TableGen)
4357
add_subdirectory(source)
4458
add_subdirectory(tools)

0 commit comments

Comments
 (0)