Skip to content

Commit

Permalink
Setting up the build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswailes committed Feb 13, 2012
1 parent 837859c commit 8b72b9c
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 0 deletions.
36 changes: 36 additions & 0 deletions 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)
24 changes: 24 additions & 0 deletions 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)
42 changes: 42 additions & 0 deletions src/llvm-ecb.c
@@ -0,0 +1,42 @@
/*
* Author: Chris Wailes <chris.wailes@gmail.com>
* Project: LLVM-ECB
* Date: 2012/02/13
* Description: Main header file for LLVM-ECB.
*/

// Standard Includes
#include <stdio.h>
#include <stdlib.h>

// 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;
}
29 changes: 29 additions & 0 deletions src/llvm-ecb.h.in
@@ -0,0 +1,29 @@
/*
* Author: Chris Wailes <chris.wailes@gmail.com>
* 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
20 changes: 20 additions & 0 deletions src/support/CMakeLists.txt
@@ -0,0 +1,20 @@
#######################
# Project Information #
#######################


######################
# Resource Locations #
######################


##################
# Subdirectories #
##################


#############
# Libraries #
#############

add_library(support STATIC support.cpp)
24 changes: 24 additions & 0 deletions src/support/support.cpp
@@ -0,0 +1,24 @@
/*
* Author: Chris Wailes <chris.wailes@gmail.com>
* Project: LLVM-ECB
* Date: 2012/02/13
* Description: Extended C bindings for the LLVM::Support namespace.
*/

// Standard Includes

#include <llvm/Support/DynamicLibrary.h>

// Project Includes

// Macros

// Global Variables

// Functions

extern "C" {
int LLVMLoadLibraryPermanently(const char* filename) {
return llvm::sys::DynamicLibrary::LoadLibraryPermanently(filename);
}
}
25 changes: 25 additions & 0 deletions src/support/support.h
@@ -0,0 +1,25 @@
/*
* Author: Chris Wailes <chris.wailes@gmail.com>
* 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

0 comments on commit 8b72b9c

Please sign in to comment.