summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/CMakeLists.txt4
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CMakeLists.txt22
-rw-r--r--llvm/lib/CodeGen/GlobalISel/EmptyFile.cpp19
3 files changed, 40 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 8e326fae4e3..de6d21dde5e 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -143,6 +143,4 @@ add_dependencies(LLVMCodeGen intrinsics_gen)
add_subdirectory(SelectionDAG)
add_subdirectory(AsmPrinter)
add_subdirectory(MIRParser)
-if(LLVM_BUILD_GLOBAL_ISEL)
- add_subdirectory(GlobalISel)
-endif()
+add_subdirectory(GlobalISel)
diff --git a/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt b/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
index c18934acca1..a226dcc479d 100644
--- a/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
+++ b/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
@@ -1,6 +1,24 @@
+# List of all GlobalISel files.
+set(GLOBAL_ISEL_FILES
+ IRTranslator.cpp
+ MachineIRBuilder.cpp
+ )
+
+# Add GlobalISel files to the dependencies if the user wants to build it.
+if(LLVM_BUILD_GLOBAL_ISEL)
+ set(GLOBAL_ISEL_BUILD_FILES ${GLOBAL_ISEL_FILES})
+else()
+ set(GLOBAL_ISEL_BUILD_FILES"")
+ set(LLVM_OPTIONAL_SOURCES LLVMGlobalISel ${GLOBAL_ISEL_FILES})
+endif()
+
+
+# In LLVMBuild.txt files, it is not possible to mark a dependency to a
+# library as optional. So instead, generate an empty library if we did
+# not ask for it.
add_llvm_library(LLVMGlobalISel
- IRTranslator.cpp
- MachineIRBuilder.cpp
+ ${GLOBAL_ISEL_BUILD_FILES}
+ EmptyFile.cpp
)
add_dependencies(LLVMGlobalISel intrinsics_gen)
diff --git a/llvm/lib/CodeGen/GlobalISel/EmptyFile.cpp b/llvm/lib/CodeGen/GlobalISel/EmptyFile.cpp
new file mode 100644
index 00000000000..b87d9523660
--- /dev/null
+++ b/llvm/lib/CodeGen/GlobalISel/EmptyFile.cpp
@@ -0,0 +1,19 @@
+//===-- llvm/CodeGen/GlobalISel/EmptyFile.cpp ------ EmptyFile ---*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+/// The purpose of this file is to please cmake by not creating an
+/// empty library when we do not build GlobalISel.
+/// \todo This file should be removed when GlobalISel is not optional anymore.
+//===----------------------------------------------------------------------===//
+
+// Anonymous namespace so that we do not step on anyone's toes.
+namespace {
+__attribute__ ((unused)) void foo(void) {
+}
+}
OpenPOWER on IntegriCloud