-# 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()
--- /dev/null
+add_subdirectory(Hello)
+add_subdirectory(Simple)
+add_subdirectory(mcc16)
+add_subdirectory(Skeleton)
--- /dev/null
+set(LLVM_USED_LIBS CompilerDriver)
+set(LLVM_LINK_COMPONENTS support)
+
+add_llvm_example(Hello Hello.cpp)
--- /dev/null
+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
+ )
--- /dev/null
+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
+ )
--- /dev/null
+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
+ )
--- /dev/null
+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
+ )