From 1e0097f517919f1e7537eb971e96c7ca0bb47248 Mon Sep 17 00:00:00 2001
From: Andrea Censi <andrea@cds.caltech.edu>
Date: Mon, 31 May 2010 19:30:09 -0700
Subject: [PATCH] Created stub for C++ wrapper

---
 sm/csmpp/.gitignore     |  6 +++++
 sm/csmpp/CMakeLists.txt | 50 +++++++++++++++++++++++++++++++++++++++++
 sm/csmpp/README.txt     |  1 +
 sm/csmpp/csmpp.cpp      |  6 +++++
 sm/csmpp/csmpp.h        |  2 ++
 sm/csmpp/csmpp.pc.in    | 10 +++++++++
 6 files changed, 75 insertions(+)
 create mode 100644 sm/csmpp/.gitignore
 create mode 100644 sm/csmpp/CMakeLists.txt
 create mode 100644 sm/csmpp/README.txt
 create mode 100644 sm/csmpp/csmpp.cpp
 create mode 100644 sm/csmpp/csmpp.h
 create mode 100644 sm/csmpp/csmpp.pc.in

diff --git a/sm/csmpp/.gitignore b/sm/csmpp/.gitignore
new file mode 100644
index 0000000..64e8f96
--- /dev/null
+++ b/sm/csmpp/.gitignore
@@ -0,0 +1,6 @@
+libcsmpp-static.a
+libcsmpp.dylib
+csmpp.pc
+cmake_install.cmake
+Makefile
+CMakeCache.txt
diff --git a/sm/csmpp/CMakeLists.txt b/sm/csmpp/CMakeLists.txt
new file mode 100644
index 0000000..9bbb3a8
--- /dev/null
+++ b/sm/csmpp/CMakeLists.txt
@@ -0,0 +1,50 @@
+cmake_minimum_required(VERSION 2.4)
+PROJECT (CSMPP CXX)
+SET(csmpp_version 0.1)
+
+# Require we have pkgconfig installed
+find_package(PkgConfig REQUIRED)
+# Tell pkgconfig to look for CSM
+pkg_check_modules(CSM REQUIRED csm)
+
+# Look for CSM
+IF(${CSM_FOUND})
+	MESSAGE("CSM_LIBRARY_DIRS: ${CSM_LIBRARY_DIRS}")
+	MESSAGE("CSM_LIBRARIES: ${CSM_LIBRARIES}")
+	MESSAGE("CSM_INCLUDE_DIRS: ${CSM_INCLUDE_DIRS}")
+	MESSAGE("CSM_LDFLAGS: " ${CSM_LDFLAGS})
+
+
+	INCLUDE_DIRECTORIES(${CSM_INCLUDE_DIRS}) # important! 
+	LINK_DIRECTORIES(${CSM_LIBRARY_DIRS})    # important! 
+ELSE(${CSM_FOUND})	
+	MESSAGE(FATAL_ERROR "CSM not found. Check that the environment variable PKG_CONFIG_PATH includes the path containing the file 'csm.pc'.")
+ENDIF(${CSM_FOUND})
+ 
+# Name of generated libraries
+SET(dynamic_lib csmpp)
+SET(static_lib csmpp-static)
+SET(csmpp_sources csmpp.cpp)
+
+SET(csmpp_c_flags "")
+SET(csmpp_link_flags  ${CSM_LDFLAGS} )
+
+# Creation of static library
+ADD_LIBRARY(${static_lib} STATIC ${csmpp_sources})
+TARGET_LINK_LIBRARIES(${static_lib} ${CSM_LIBRARIES})
+INSTALL(TARGETS ${static_lib} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+
+# Creation of dynamic library
+ADD_LIBRARY(${dynamic_lib} SHARED ${csmpp_sources})
+TARGET_LINK_LIBRARIES(${dynamic_lib} ${CSM_LIBRARIES})
+INSTALL(TARGETS ${dynamic_lib} LIBRARY DESTINATION lib)
+
+
+# Installation of pkgconfig configuration file
+CONFIGURE_FILE(csmpp.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/csmpp.pc @ONLY)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/csmpp.pc
+	DESTINATION lib/pkgconfig)
+
+
+
diff --git a/sm/csmpp/README.txt b/sm/csmpp/README.txt
new file mode 100644
index 0000000..dbeb9c9
--- /dev/null
+++ b/sm/csmpp/README.txt
@@ -0,0 +1 @@
+This is a C++ wrapper to CSM.
diff --git a/sm/csmpp/csmpp.cpp b/sm/csmpp/csmpp.cpp
new file mode 100644
index 0000000..848d22c
--- /dev/null
+++ b/sm/csmpp/csmpp.cpp
@@ -0,0 +1,6 @@
+#include "csmpp.h"
+
+
+void test_function() {
+	
+}
\ No newline at end of file
diff --git a/sm/csmpp/csmpp.h b/sm/csmpp/csmpp.h
new file mode 100644
index 0000000..8fe5682
--- /dev/null
+++ b/sm/csmpp/csmpp.h
@@ -0,0 +1,2 @@
+
+void test_function();
\ No newline at end of file
diff --git a/sm/csmpp/csmpp.pc.in b/sm/csmpp/csmpp.pc.in
new file mode 100644
index 0000000..9c11a01
--- /dev/null
+++ b/sm/csmpp/csmpp.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: csmpp
+Description: C++ wrapper to CSM
+Requires: csm
+Version: @csmpp_version@
+Libs: @csmpp_link_flags@ -L${libdir} -l@csmpp_link_flags@
+Cflags: @csmpp_c_flags@ -I${includedir}
-- 
GitLab