summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt100
-rw-r--r--src/kiro-enums.c.template43
-rw-r--r--src/kiro-enums.h.template25
-rw-r--r--src/kiro.pc.in2
4 files changed, 162 insertions, 8 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a9e5d96..7b6eb8f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,13 +1,99 @@
-add_library(kiro SHARED kiro-trb.c kiro-client.c kiro-server.c kiro-sb.c)
+cmake_minimum_required(VERSION 2.6)
+project(KIRO C)
+
+set(kiro_SRCS
+ kiro-server.c
+ kiro-client.c
+ kiro-trb.c
+ kiro-sb.c
+ )
+
+set(kiro_HDRS
+ kiro-server.h
+ kiro-client.h
+ kiro-trb.h
+ kiro-sb.h
+ )
+
+create_enums(kiro-enums
+ ${CMAKE_CURRENT_SOURCE_DIR}/kiro-enums
+ ${kiro_HDRS}
+ kiro-rdma.h
+ )
+
+add_library(kiro SHARED
+ ${kiro_SRCS}
+ ${CMAKE_CURRENT_BINARY_DIR}/kiro-enums.c)
+
set_target_properties(kiro PROPERTIES
VERSION "${LIBKIRO_VERSION_MAJOR}.${LIBKIRO_VERSION_MINOR}"
SOVERSION ${LIBKIRO_VERSION_PATCH}
)
-target_link_libraries(kiro m rdmacm ibverbs pthread)
+target_link_libraries(kiro m ${KIRO_DEPS})
-install(FILES kiro-rdma.h kiro-trb.h kiro-client.h kiro-server.h kiro-sb.h
- DESTINATION ${KIRO_INCLUDEDIR}/kiro)
-install(TARGETS kiro
- LIBRARY DESTINATION ${KIRO_LIBDIR}
-)
+pkg_check_modules(GOBJECT_INTROSPECTION gobject-introspection-1.0)
+
+if (GOBJECT_INTROSPECTION_FOUND)
+
+ option(WITH_GIR "Build introspection files" ON)
+
+ if (WITH_GIR)
+ find_program(INTROSPECTION_SCANNER "g-ir-scanner")
+ find_program(INTROSPECTION_COMPILER "g-ir-compiler")
+ pkg_check_variable(gobject-introspection-1.0 g_ir_scanner)
+ pkg_check_variable(gobject-introspection-1.0 g_ir_compiler)
+
+ set(GIR_PREFIX "Kiro-${LIBKIRO_ABI_VERSION}.0")
+ set(GIR_XML "${GIR_PREFIX}.gir")
+ set(GIR_TYPELIB "${GIR_PREFIX}.typelib")
+ set(_gir_input)
+
+ foreach(_src ${kiro_SRCS} ${kiro_HDRS})
+ list(APPEND _gir_input "${CMAKE_CURRENT_SOURCE_DIR}/${_src}")
+ endforeach()
+
+ #list(APPEND _gir_input "${CMAKE_CURRENT_BINARY_DIR}/kiro-enums.h")
+ #list(APPEND _gir_input "${CMAKE_CURRENT_BINARY_DIR}/kiro-enums.c")
+
+ add_custom_command(OUTPUT ${GIR_XML}
+ COMMAND ${INTROSPECTION_SCANNER}
+ --namespace=Kiro
+ --nsversion=${LIBKIRO_ABI_VERSION}
+ --library=kiro
+ --no-libtool
+ --include=GObject-2.0
+ --include=GModule-2.0
+ --output ${GIR_XML}
+ --warn-all
+ --quiet
+ ${_gir_input}
+ DEPENDS ${kiro_SRCS}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_command(OUTPUT ${GIR_TYPELIB}
+ COMMAND ${INTROSPECTION_COMPILER}
+ -o ${GIR_TYPELIB}
+ ${GIR_XML}
+ DEPENDS ${GIR_XML}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_target(gir ALL DEPENDS ${GIR_XML} ${GIR_TYPELIB})
+ add_dependencies(gir kiro)
+
+ endif()
+endif()
+
+
+install(FILES ${kiro_HDRS} kiro-rdma.h DESTINATION ${KIRO_INCLUDEDIR}/kiro)
+install(TARGETS kiro LIBRARY DESTINATION ${KIRO_LIBDIR})
+
+if(WITH_GIR)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_XML}
+ DESTINATION ${KIRO_GIRDIR}
+ COMPONENT libraries)
+
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_TYPELIB}
+ DESTINATION ${KIRO_TYPELIBDIR}
+ COMPONENT libraries)
+endif()
diff --git a/src/kiro-enums.c.template b/src/kiro-enums.c.template
new file mode 100644
index 0000000..f68f0ff
--- /dev/null
+++ b/src/kiro-enums.c.template
@@ -0,0 +1,43 @@
+/*** BEGIN file-header ***/
+
+#include "kiro-enums.h"
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+#include "@filename@"
+/*** END file-production ***/
+
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+ static volatile gsize g_define_type_id__volatile = 0;
+
+ if (g_once_init_enter (&g_define_type_id__volatile)) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ GType g_define_type_id =
+ g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ }
+
+ return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
diff --git a/src/kiro-enums.h.template b/src/kiro-enums.h.template
new file mode 100644
index 0000000..12f7fca
--- /dev/null
+++ b/src/kiro-enums.h.template
@@ -0,0 +1,25 @@
+/*** BEGIN file-header ***/
+
+#ifndef KIRO_ENUMS_H
+#define KIRO_ENUMS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define KIRO_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* !KIRO_ENUMS_H */
+/*** END file-tail ***/
diff --git a/src/kiro.pc.in b/src/kiro.pc.in
index cc3fa94..7318e6b 100644
--- a/src/kiro.pc.in
+++ b/src/kiro.pc.in
@@ -5,6 +5,6 @@ includedir=@KIRO_INCLUDEDIR@
Name: @TARNAME@
Description: @LIBKIRO_DESCRIPTION_SUMMARY@
-Version: @LIBKIRO_ABI_VERSION@
+Version: @LIBKIRO_VERSION_MAJOR@.@LIBKIRO_VERSION_MINOR@.@LIBKIRO_VERSION_PATCH@
Libs: -L${libdir} -lkiro
Cflags: -I${includedir}