summaryrefslogtreecommitdiff
path: root/CommonAPI-Examples/E06Unions/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CommonAPI-Examples/E06Unions/CMakeLists.txt')
-rw-r--r--CommonAPI-Examples/E06Unions/CMakeLists.txt90
1 files changed, 90 insertions, 0 deletions
diff --git a/CommonAPI-Examples/E06Unions/CMakeLists.txt b/CommonAPI-Examples/E06Unions/CMakeLists.txt
new file mode 100644
index 0000000..641fd78
--- /dev/null
+++ b/CommonAPI-Examples/E06Unions/CMakeLists.txt
@@ -0,0 +1,90 @@
+# Copyright (C) 2014, 2015 BMW Group
+# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
+# Author: Juergen Gehring (juergen.gehring@bmw.de)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PRJ_NAME E06Unions)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -std=c++0x -D_GLIBCXX_USE_NANOSLEEP")
+
+message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "Choose the type of build, options are: Debug Release." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+
+OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON)
+message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}")
+
+if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+else()
+ FIND_PACKAGE(CommonAPI REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI-DBus REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+endif()
+
+message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
+message(STATUS "CommonAPI-DBus_CONSIDERED_CONFIGS: ${CommonAPI-DBus_CONSIDERED_CONFIGS}")
+message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS: ${COMMONAPI_DBUS_INCLUDE_DIRS}")
+
+# CommonAPI
+include(FindPkgConfig)
+pkg_check_modules (DBUS "dbus-1 >= 1.4")
+
+# Source Files
+set(PRJ_SRC_PATH src)
+set(PRJ_SRC_GEN_PATH src-gen/commonapi/examples)
+
+set(PRJ_NAME_CLIENT ${PRJ_NAME}Client)
+set(PRJ_NAME_SERVICE ${PRJ_NAME}Service)
+
+FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.cpp ${PRJ_SRC_GEN_PATH}/CommonTypes.cpp)
+FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/${PRJ_NAME}.cpp ${PRJ_SRC_GEN_PATH}/CommonTypes.cpp)
+FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_PATH}/*Stub*.cpp)
+
+set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS})
+set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS})
+
+# Paths
+OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (patched) version of dbus" ON)
+message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+
+include_directories(
+ src-gen
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIRS}
+)
+
+if ("${USE_INSTALLED_DBUS}" STREQUAL "ON")
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_LIBDIR}
+)
+else()
+link_directories(
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${DBUS_INCLUDE_DIRS}/dbus/.libs
+)
+endif()
+
+set(LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBUS_LIBRARIES})
+
+# Build Client
+add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS})
+target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES})
+
+# Build service
+add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS})
+target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES})