Builds llvmc and its examples with CMake.
authorOscar Fuentes <ofv@wanadoo.es>
Mon, 25 Jul 2011 17:25:10 +0000 (17:25 +0000)
committerOscar Fuentes <ofv@wanadoo.es>
Mon, 25 Jul 2011 17:25:10 +0000 (17:25 +0000)
Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135919 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvmc/CMakeLists.txt
tools/llvmc/examples/CMakeLists.txt [new file with mode: 0644]
tools/llvmc/examples/Hello/CMakeLists.txt [new file with mode: 0644]
tools/llvmc/examples/Simple/CMakeLists.txt [new file with mode: 0644]
tools/llvmc/examples/Skeleton/CMakeLists.txt [new file with mode: 0644]
tools/llvmc/examples/mcc16/CMakeLists.txt [new file with mode: 0644]
tools/llvmc/src/CMakeLists.txt [new file with mode: 0644]

index 10ad5d82009f18ebd4919099d30d86fba7730dc4..ff7cbae4837fa489d459f1848f800e82220575cf 100644 (file)
@@ -1,4 +1,8 @@
-add_subdirectory(src)
+add_subdirectory(src)
 
 # TODO: support plugins and user-configured builds.
 # See ./doc/LLVMC-Reference.rst "Customizing LLVMC: the compilation graph"
+
+if( LLVM_INCLUDE_EXAMPLES )
+  add_subdirectory(examples)
+endif()
diff --git a/tools/llvmc/examples/CMakeLists.txt b/tools/llvmc/examples/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2ad8aa4
--- /dev/null
@@ -0,0 +1,4 @@
+add_subdirectory(Hello)
+add_subdirectory(Simple)
+add_subdirectory(mcc16)
+add_subdirectory(Skeleton)
diff --git a/tools/llvmc/examples/Hello/CMakeLists.txt b/tools/llvmc/examples/Hello/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5679924
--- /dev/null
@@ -0,0 +1,4 @@
+set(LLVM_USED_LIBS CompilerDriver)
+set(LLVM_LINK_COMPONENTS support)
+
+add_llvm_example(Hello Hello.cpp)
diff --git a/tools/llvmc/examples/Simple/CMakeLists.txt b/tools/llvmc/examples/Simple/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8a401ea
--- /dev/null
@@ -0,0 +1,10 @@
+set(LLVM_TARGET_DEFINITIONS Simple.td)
+
+tablegen(Simple.inc -gen-llvmc)
+
+set(LLVM_USED_LIBS CompilerDriver)
+set(LLVM_LINK_COMPONENTS support)
+
+add_llvm_example(Simple
+  Simple.cpp
+  )
diff --git a/tools/llvmc/examples/Skeleton/CMakeLists.txt b/tools/llvmc/examples/Skeleton/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e1296ca
--- /dev/null
@@ -0,0 +1,11 @@
+set(LLVM_TARGET_DEFINITIONS AutoGenerated.td)
+
+tablegen(AutoGenerated.inc -gen-llvmc)
+
+set(LLVM_USED_LIBS CompilerDriver)
+set(LLVM_LINK_COMPONENTS support)
+
+add_llvm_example(llvmc-skeleton
+  Hooks.cpp
+  Main.cpp
+  )
diff --git a/tools/llvmc/examples/mcc16/CMakeLists.txt b/tools/llvmc/examples/mcc16/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f9eeb03
--- /dev/null
@@ -0,0 +1,11 @@
+set(LLVM_TARGET_DEFINITIONS PIC16.td)
+
+tablegen(PIC16.inc -gen-llvmc)
+
+set(LLVM_USED_LIBS CompilerDriver)
+set(LLVM_LINK_COMPONENTS support)
+
+add_llvm_example(mcc16
+  Hooks.cpp
+  Main.cpp
+  )
diff --git a/tools/llvmc/src/CMakeLists.txt b/tools/llvmc/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e6c8917
--- /dev/null
@@ -0,0 +1,19 @@
+set(LLVMGCCCOMMAND llvm-gcc)
+set(LLVMGXXCOMMAND llvm-g++)
+
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/Base.td.in
+  ${CMAKE_CURRENT_BINARY_DIR}/Base.td
+  @ONLY)
+
+set(LLVM_TARGET_DEFINITIONS AutoGenerated.td)
+
+tablegen(AutoGenerated.inc -gen-llvmc)
+
+set(LLVM_USED_LIBS CompilerDriver)
+set(LLVM_LINK_COMPONENTS support)
+
+add_llvm_tool(llvmc
+  Hooks.cpp
+  Main.cpp
+  )