initial commit
authorStefan Huber <shuber@sthu.org>
Mon, 4 Nov 2013 08:32:50 +0000 (09:32 +0100)
committerStefan Huber <shuber@sthu.org>
Mon, 4 Nov 2013 08:42:09 +0000 (09:42 +0100)
12 files changed:
.gitignore [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
build.sh [new file with mode: 0755]
include/CMakeLists.txt [new file with mode: 0644]
include/stick.h [new file with mode: 0644]
lib/CMakeLists.txt [new file with mode: 0644]
lib/libstick.pc.cmake [new file with mode: 0644]
lib/stick.c [new file with mode: 0644]
src/CMakeLists.txt [new file with mode: 0644]
src/config.h.cmake [new file with mode: 0644]
src/main.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..89efb0f
--- /dev/null
@@ -0,0 +1,2 @@
+build
+*.swp
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c9d4fb2
--- /dev/null
@@ -0,0 +1,30 @@
+cmake_minimum_required (VERSION 2.6)
+project (stick) 
+
+
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")
+       set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed" )
+endif()
+
+set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
+if(CMAKE_BUILD_TYPE STREQUAL "Release")
+       # CMAKE_C_FLAGS_RELEASE is appended, but we need to prepend -O2 to take
+       # effect
+       set(CMAKE_C_FLAGS "-O2 ${CMAKE_C_FLAGS}")
+endif()
+
+set(PACKAGE_STRING stick)
+set(PACKAGE_BUGREPORT stefan.huber@ist.ac.at)
+set(PACKAGE_VERSION 0.1)
+
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99")
+       # I would like to use -pedantic, but VTK devs are not sufficiently
+       # pedantic
+       set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror")
+endif()
+
+add_subdirectory(include)
+add_subdirectory(lib)
+add_subdirectory(src)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..bf7b18f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2013 Stefan Huber
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/build.sh b/build.sh
new file mode 100755 (executable)
index 0000000..dddbb76
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,7 @@
+cd $(dirname $0)
+echo $PWD
+mkdir -p build
+cd build
+
+#cmake -D CMAKE_INSTALL_PREFIX:PATH=foo/ -D CMAKE_BUILD_TYPE="Debug" ..
+cmake -D CMAKE_BUILD_TYPE="Release" ..
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5e88e3f
--- /dev/null
@@ -0,0 +1,2 @@
+set(INCLUDE_DIR include/${PACKAGE_STRING}-${PACKAGE_VERSION})
+install (DIRECTORY ./ DESTINATION ${INCLUDE_DIR} FILES_MATCHING PATTERN "*.h")
diff --git a/include/stick.h b/include/stick.h
new file mode 100644 (file)
index 0000000..451a77e
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef lyxtor_h
+#define lyxtor_h
+
+void test();
+
+#endif
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3636f2e
--- /dev/null
@@ -0,0 +1,10 @@
+set(stick_SRC stick.c)
+
+include_directories(${stick_SOURCE_DIR}/include)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libstick.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libstick.pc @ONLY)
+
+add_library(stick SHARED ${stick_SRC})
+
+install(TARGETS stick DESTINATION lib)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libstick.pc DESTINATION lib/pkgconfig COMPONENT "pkgconfig")
diff --git a/lib/libstick.pc.cmake b/lib/libstick.pc.cmake
new file mode 100644 (file)
index 0000000..1a57794
--- /dev/null
@@ -0,0 +1,9 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: @PACKAGE_STRING@
+Description: A peristent homology libarary
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lm
+Cflags: -I${includedir}/@PACKAGE_STRING@-@PACKAGE_VERSION@
diff --git a/lib/stick.c b/lib/stick.c
new file mode 100644 (file)
index 0000000..d6adeff
--- /dev/null
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+#include "stick.h"
+
+
+void test() {
+       printf("Hello world.\n");
+}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..66012c5
--- /dev/null
@@ -0,0 +1,17 @@
+set(stick_cli_SRC main.c)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+include_directories(${stick_SOURCE_DIR}/include)
+
+find_package(VTK REQUIRED)
+INCLUDE(${VTK_USE_FILE})
+
+add_executable(stick-cli ${stick_cli_SRC})
+target_link_libraries(stick-cli
+       stick
+       ${stick_cli_LIBS}
+       ${VTK_LIBRARIES} )
+
+install (TARGETS stick-cli DESTINATION bin)
diff --git a/src/config.h.cmake b/src/config.h.cmake
new file mode 100644 (file)
index 0000000..9a2ff10
--- /dev/null
@@ -0,0 +1,4 @@
+#define PACKAGE_STRING "@PACKAGE_STRING@"
+#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
+
diff --git a/src/main.c b/src/main.c
new file mode 100644 (file)
index 0000000..2c3c4fd
--- /dev/null
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <stick.h>
+
+int main(int argc, char* argv[]) {
+       (void) argc;
+       (void) argv;
+
+       test();
+       return EXIT_SUCCESS;
+}
+