Initial commit of example projects (except: example2-client).
authorKristóf Katus <kristof.katus@intra2net.com>
Wed, 24 Aug 2011 15:27:54 +0000 (17:27 +0200)
committerKristóf Katus <kristof.katus@intra2net.com>
Wed, 24 Aug 2011 15:27:54 +0000 (17:27 +0200)
examples-codegen/example1-client-wrapper/CMakeLists.txt [new file with mode: 0644]
examples-codegen/example1-client/CMakeLists.txt [new file with mode: 0644]
examples-codegen/example1/CMakeLists.txt [new file with mode: 0644]
examples-codegen/example2/CMakeLists.txt [new file with mode: 0644]
examples/CMakeLists.txt [new file with mode: 0644]

diff --git a/examples-codegen/example1-client-wrapper/CMakeLists.txt b/examples-codegen/example1-client-wrapper/CMakeLists.txt
new file mode 100644 (file)
index 0000000..dbd8e91
--- /dev/null
@@ -0,0 +1,36 @@
+# Project
+project(libt2n-example1-client-wrapper)
+set(VERSION 0.1)
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
+
+# CMake
+set(CMAKE_COLOR_MAKEFILE ON)
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+
+# Source package generation
+set(CPACK_SOURCE_GENERATOR             TGZ)
+set(CPACK_SOURCE_IGNORE_FILES          "~$;\\\\.git;build;build-rpm")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME     "${PROJECT_NAME}-${VERSION}")
+
+# Find external packages
+include(FindPkgConfig)
+
+pkg_check_modules(T2NEXAMPLE REQUIRED t2nexample=0.1)
+include_directories(${T2NEXAMPLE_INCLUDE_DIRS})
+link_directories(${T2NEXAMPLE_LIBRARY_DIRS})
+
+include(CPack)
+
+# Sources
+set(libt2n_example1_client_wrapper_SOURCES
+    client.cpp
+)
+
+# Executables
+add_executable(libt2n-example1-client-wrapper ${libt2n_example1_client_wrapper_SOURCES})
+
+# Dependencies
+target_link_libraries(libt2n-example1-client-wrapper ${T2NEXAMPLE_LIBRARIES})
+
+# Installation
+# install(TARGETS libt2n-example1-client-wrapper DESTINATION bin)
diff --git a/examples-codegen/example1-client/CMakeLists.txt b/examples-codegen/example1-client/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ccfe1ca
--- /dev/null
@@ -0,0 +1,36 @@
+# Project
+project(libt2n-example1-client)
+set(VERSION 0.1)
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
+
+# CMake
+set(CMAKE_COLOR_MAKEFILE ON)
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+
+# Source package generation
+set(CPACK_SOURCE_GENERATOR             TGZ)
+set(CPACK_SOURCE_IGNORE_FILES          "~$;\\\\.git;build;build-rpm")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME     "${PROJECT_NAME}-${VERSION}")
+
+# Find external packages
+include(FindPkgConfig)
+
+pkg_check_modules(T2NEXAMPLE REQUIRED t2nexample=0.1)
+include_directories(${T2NEXAMPLE_INCLUDE_DIRS})
+link_directories(${T2NEXAMPLE_LIBRARY_DIRS})
+
+include(CPack)
+
+# Sources
+set(libt2n_example1_client_SOURCES
+    client.cpp
+)
+
+# Executables
+add_executable(libt2n-example1-client ${libt2n_example1_client_SOURCES})
+
+# Dependencies
+target_link_libraries(libt2n-example1-client ${T2NEXAMPLE_LIBRARIES})
+
+# Installation
+# install(TARGETS libt2n-example1-client DESTINATION bin)
diff --git a/examples-codegen/example1/CMakeLists.txt b/examples-codegen/example1/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3d3efdb
--- /dev/null
@@ -0,0 +1,61 @@
+# Project
+project(libt2n-example1)
+set(VERSION 0.1)
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
+
+# CMake
+set(CMAKE_COLOR_MAKEFILE ON)
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+
+# Source package generation
+set(CPACK_SOURCE_GENERATOR             TGZ)
+set(CPACK_SOURCE_IGNORE_FILES          "~$;\\\\.git;build;build-rpm")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME     "${PROJECT_NAME}-${VERSION}")
+
+# Find external packages
+include(FindPkgConfig)
+
+pkg_check_modules(LIBT2N REQUIRED libt2n>=0.2)
+include_directories(${LIBT2N_INCLUDE_DIRS})
+link_directories(${LIBT2N_LIBRARY_DIRS})
+
+include(CPack)
+
+# Setup libt2n
+# for each command group list the files to parse for LIBT2N_EXPORT
+set(t2nexample_GROUP ${CMAKE_CURRENT_SOURCE_DIR}/t2nexample.cpp)
+# include CMake snippet doing all the magic
+include(${CMAKE_SOURCE_DIR}/../cmake/Libt2n.cmake)
+# command groups are listed here (seperated by spaces)
+setup_libt2n(t2nexample)
+
+# Sources
+# for each group build a client library from generated source file(s)
+# Note: the library name must match the group name
+set(libt2nexample_SOURCES
+    t2nexample_client.cpp
+)
+set(libt2n_example1_server_SOURCES
+    server.cpp
+    ${t2nexample_GROUP}
+    t2nexample_server.cpp
+)
+
+# Executables
+# build server program
+add_executable(libt2n-example1-server ${libt2n_example1_server_SOURCES})
+
+# Libraries
+add_library(libt2nexample STATIC ${libt2nexample_SOURCES})
+set_target_properties(libt2nexample PROPERTIES OUTPUT_NAME t2nexample)
+
+# Dependencies
+target_link_libraries(libt2n-example1-server ${LIBT2N_LIBRARIES})
+target_link_libraries(libt2nexample t2nexample ${LIBT2N_LIBRARIES})
+
+add_dependencies(libt2n-example1-server t2n_arnielizer_codegen_done)
+add_dependencies(libt2nexample t2n_arnielizer_codegen_done)
+
+# Installation
+# install(TARGETS libt2n-example1-server DESTINATION bin)
+# install(TARGETS libt2nexample ARCHIVE DESTINATION lib)
diff --git a/examples-codegen/example2/CMakeLists.txt b/examples-codegen/example2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7d4a461
--- /dev/null
@@ -0,0 +1,90 @@
+# Project
+project(libt2n-example2)
+set(VERSION 0.1)
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
+
+# CMake
+set(CMAKE_COLOR_MAKEFILE ON)
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+
+# Source package generation
+set(CPACK_SOURCE_GENERATOR             TGZ)
+set(CPACK_SOURCE_IGNORE_FILES          "~$;\\\\.git;build;build-rpm")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME     "${PROJECT_NAME}-${VERSION}")
+
+# Find external packages
+include(FindPkgConfig)
+
+pkg_check_modules(LIBT2N REQUIRED libt2n>=0.2)
+include_directories(${LIBT2N_INCLUDE_DIRS})
+link_directories(${LIBT2N_LIBRARY_DIRS})
+
+include(CPack)
+
+# Setup libt2n
+# for each command group list the files to parse for LIBT2N_EXPORT
+set(default_GROUP
+    ${CMAKE_CURRENT_SOURCE_DIR}/default.cpp
+)
+# example of a command group using multiple cpp files
+set(other_GROUP
+    ${CMAKE_CURRENT_SOURCE_DIR}/other-1.cpp 
+    ${CMAKE_CURRENT_SOURCE_DIR}/other-2.cpp
+)
+# headers declaring data types used as rpc arguments must be listed manually (???)
+# (in this example the class Foo)
+set(CPP_HEADERS
+    ${CMAKE_CURRENT_SOURCE_DIR}/foo.hxx
+)
+# include CMake snippet doing all the magic
+include(${CMAKE_SOURCE_DIR}/../cmake/Libt2n.cmake)
+# command groups are listed here (seperated by spaces)
+setup_libt2n(default other)
+
+# Sources
+# for each group build a client library from generated source file(s)
+# Note: the library name must match the group name
+set(libdefault_SOURCES
+    default_client.cpp
+)
+set(libother_SOURCES
+    other_client.cpp
+)
+# build an example server and client
+set(client_SOURCES
+    client.cpp
+)
+set(libt2n_example2_server_SOURCES
+    other_server.cpp
+    default_server.cpp
+    server.cpp
+    ${other_GROUP}
+    ${default_GROUP}
+)
+
+# Libraries
+add_library(libdefault STATIC ${libdefault_SOURCES})
+set_target_properties(libdefault PROPERTIES OUTPUT_NAME default)
+
+add_library(libother STATIC ${libother_SOURCES})
+set_target_properties(libother PROPERTIES OUTPUT_NAME other)
+
+# Executables
+# build server program
+add_executable(libt2n-example2-server ${libt2n_example2_server_SOURCES})
+
+# Dependencies
+target_link_libraries(libdefault ${LIBT2N_LIBRARIES})
+add_dependencies(libdefault default_codegen_done)
+
+target_link_libraries(libother ${LIBT2N_LIBRARIES})
+add_dependencies(libother other_codegen_done)
+
+target_link_libraries(libt2n-example2-server ${LIBT2N_LIBRARIES} libdefault libother)
+add_dependencies(libt2n-example2-server default_codegen_done other_codegen_done)
+
+# Installation
+# install(TARGETS default_client ARCHIVE DESTINATION lib)
+# install(TARGETS other_client ARCHIVE DESTINATION lib)
+# install(TARGETS libt2n-example2-server DESTINATION bin)
+# install(FILES ${CPP_HEADERS} DESTINATION include)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a5a3396
--- /dev/null
@@ -0,0 +1,44 @@
+# Sources
+set(libminimalistic_client_SOURCES
+    minimalistic-stub.hxx
+    minimalistic-stub-once.hxx
+    minimalistic-client-stub.hxx
+    minimalistic-client-stub.cpp
+)
+set(minimalistic_client_SOURCES
+    minimalistic-client.cpp
+)
+set(minimalistic_server_SOURCES
+    minimalistic-server.cpp
+    minimalistic-server-stub.cpp
+)
+include_directories(
+    BEFORE
+    ${CMAKE_SOURCE_DIR}/src
+    ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+# Libraries
+add_library(libminimalistic_client STATIC ${libminimalistic_client_SOURCES})
+set_target_properties(libminimalistic_client PROPERTIES OUTPUT_NAME minimalistic_client)
+
+# Executables
+add_executable(minimalistic_client ${minimalistic_client_SOURCES})
+add_executable(minimalistic_server ${minimalistic_server_SOURCES})
+
+# Dependencies
+target_link_libraries(minimalistic_client libt2n ${Boost_SERIALIZATION_LIBRARIES} libminimalistic_client)
+target_link_libraries(minimalistic_server libt2n ${Boost_SERIALIZATION_LIBRARIES})
+
+# Generation of minimalistic-server.xml
+get_property(gcc_include_dirs
+    DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    PROPERTY INCLUDE_DIRECTORIES
+)
+foreach(gcc_include_dir ${gcc_include_dirs})
+    set(gccxml_include_dirs "${gccxml_include_dirs} -I${gcc_include_dir}")
+endforeach()
+add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/minimalistic-server.xml
+    COMMAND ${CMAKE_SOURCE_DIR}/libt2n-gccxml.sh ${gccxml_include_dirs} ${CMAKE_CURRENT_SOURCE_DIR}/minimalistic-server.cpp -fxml=${CMAKE_CURRENT_SOURCE_DIR}/minimalistic-server.xml
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/minimalistic-server.cpp
+)