From 8b72b9c0a8021b8d8a0488f07263545a29f4e15d Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Mon, 13 Feb 2012 16:57:59 -0700 Subject: [PATCH] Setting up the build system. --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 24 ++++++++++++++++++++++ src/llvm-ecb.c | 42 ++++++++++++++++++++++++++++++++++++++ src/llvm-ecb.h.in | 29 ++++++++++++++++++++++++++ src/support/CMakeLists.txt | 20 ++++++++++++++++++ src/support/support.cpp | 24 ++++++++++++++++++++++ src/support/support.h | 25 +++++++++++++++++++++++ 7 files changed, 200 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/llvm-ecb.c create mode 100644 src/llvm-ecb.h.in create mode 100644 src/support/CMakeLists.txt create mode 100644 src/support/support.cpp create mode 100644 src/support/support.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..311b205 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +####################### +# Project Information # +####################### + +cmake_minimum_required(VERSION 2.8) +project(LLVM-ECB) + +set(PACKAGE_VERSION "3.0.0") + +set(PACKAGE_NAME llvm-ecb) +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set(PACKAGE_BUGREPORT "chris.wailes+llvm-ecb@gmail.com") + +set(LLVM_ECB_VERSION_MAJOR 0) +set(LLVM_ECB_VERSION_MINOR 0) + +set(LLVM_TARGET_VERSION \"3.0\") + +###################### +# File Configuration # +###################### + +configure_file(src/llvm-ecb.h.in src/llvm-ecb.h) + +###################### +# Resource Locations # +###################### + +include_directories (${CMAKE_BINARY_DIR}/src) +include_directories(~/software-3.0.src/include/) + +################## +# Subdirectories # +################## + +add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..783efee --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,24 @@ +####################### +# Project Information # +####################### + + +###################### +# Resource Locations # +###################### + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +################## +# Subdirectories # +################## + +add_subdirectory(support) + +############# +# Libraries # +############# + +add_library(llvm-ecb SHARED llvm-ecb.c) + +target_link_libraries(llvm-ecb support/support.a) diff --git a/src/llvm-ecb.c b/src/llvm-ecb.c new file mode 100644 index 0000000..11b9fca --- /dev/null +++ b/src/llvm-ecb.c @@ -0,0 +1,42 @@ +/* + * Author: Chris Wailes + * Project: LLVM-ECB + * Date: 2012/02/13 + * Description: Main header file for LLVM-ECB. + */ + +// Standard Includes +#include +#include + +// Project Includes + +#include "llvm-ecb.h" + +// Macros + +#define VERSION_BUFFER_SIZE 16 + +// Global Variables + +// Functions + +char* LLVMECBVersion(void) { + char* buffer; + + buffer = (char*)malloc(VERSION_BUFFER_SIZE); + + snprintf(buffer, VERSION_BUFFER_SIZE, "%s-%d.%d", LLVM_TARGET_VERSION, LLVM_ECB_VERSION_MAJOR, LLVM_ECB_VERSION_MINOR); + + return buffer; +} + +char* LLVMTargetVersion(void) { + char* buffer; + + buffer = (char*)malloc(VERSION_BUFFER_SIZE); + + snprintf(buffer, VERSION_BUFFER_SIZE, "%s", LLVM_TARGET_VERSION); + + return buffer; +} diff --git a/src/llvm-ecb.h.in b/src/llvm-ecb.h.in new file mode 100644 index 0000000..a01231e --- /dev/null +++ b/src/llvm-ecb.h.in @@ -0,0 +1,29 @@ +/* + * Author: Chris Wailes + * Project: LLVM-ECB + * Date: 2012/02/13 + * Description: Main header file for LLVM-ECB. + */ + +#ifndef LLVM_ECB_H +#define LLVM_ECB_H + +// Standard Includes + +// Project Includes + +// Macros + +#define LLVM_ECB_VERSION_MAJOR @LLVM_ECB_VERSION_MAJOR@ +#define LLVM_ECB_VERSION_MINOR @LLVM_ECB_VERSION_MINOR@ + +#define LLVM_TARGET_VERSION @LLVM_TARGET_VERSION@ + +// Types + +// Functions + +char* LLVMECBVersion(void); +char* LLVMTargetVersion(void); + +#endif diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt new file mode 100644 index 0000000..e664d67 --- /dev/null +++ b/src/support/CMakeLists.txt @@ -0,0 +1,20 @@ +####################### +# Project Information # +####################### + + +###################### +# Resource Locations # +###################### + + +################## +# Subdirectories # +################## + + +############# +# Libraries # +############# + +add_library(support STATIC support.cpp) diff --git a/src/support/support.cpp b/src/support/support.cpp new file mode 100644 index 0000000..9c4a1f5 --- /dev/null +++ b/src/support/support.cpp @@ -0,0 +1,24 @@ +/* + * Author: Chris Wailes + * Project: LLVM-ECB + * Date: 2012/02/13 + * Description: Extended C bindings for the LLVM::Support namespace. + */ + +// Standard Includes + +#include + +// Project Includes + +// Macros + +// Global Variables + +// Functions + +extern "C" { + int LLVMLoadLibraryPermanently(const char* filename) { + return llvm::sys::DynamicLibrary::LoadLibraryPermanently(filename); + } +} diff --git a/src/support/support.h b/src/support/support.h new file mode 100644 index 0000000..801d1fb --- /dev/null +++ b/src/support/support.h @@ -0,0 +1,25 @@ +/* + * Author: Chris Wailes + * Project: LLVM-ECB + * Date: 2012/02/13 + * Description: Header file for C bindings for the LLVM::Support namespace. + */ + +#ifndef SUPPORT_H +#define SUPPORT_H + +// Standard Includes + +// Project Includes + +// Macros + +// Types + +// Functions + +extern "C" { + int LLVMLoadLibraryPermanently(const char* filename); +} + +#endif