* Support for automatically generation of common-api sources. Cmake macros adopted...
[profile/ivi/genivi/genivi-audio-manager.git] / PluginCommandInterfaceCAPI / test / CMakeLists.txt
1 # Copyright (c) 2012 GENIVI Alliance
2 # Copyright (c) 2012 BMW
3 #
4 # author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
5 #
6 # copyright
7 # 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,
8 # 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,
9 # subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11 # 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.
12 # 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
13 # THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 #
15 # For further information see http://www.genivi.org/.
16 #
17
18 cmake_minimum_required(VERSION 2.6)
19
20 PROJECT(CAmCommandSenderCAPITests)
21
22 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
23
24 string (REPLACE "-g -Wall -Wextra" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
25 string (REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
26
27 set(STD_INCLUDE_DIRS "/usr/include")
28 set(EXECUTABLE_OUTPUT_PATH ${TEST_EXECUTABLE_OUTPUT_PATH})
29
30 FIND_PACKAGE(Threads)
31 FIND_PACKAGE(PkgConfig)
32 FIND_PACKAGE(PythonLibs REQUIRED)
33 FIND_PACKAGE(CommonAPI REQUIRED)
34
35 IF(WITH_DLT)    
36     pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)   
37 ENDIF(WITH_DLT)
38
39 INCLUDE_DIRECTORIES(   
40     ${STD_INCLUDE_DIRS}
41     ${CMAKE_SOURCE_DIR} 
42     ${CMAKE_CURRENT_BINARY_DIR}
43     ${AUDIO_INCLUDE_FOLDER}
44     ${CMAKE_SOURCE_DIR} 
45     ${DLT_INCLUDE_DIRS}
46     ${COMMON_API_INCLUDE_DIRS}
47         ${COMMON_API_DBUS_INCLUDE_DIRS}
48         ${COMMON_API_COMMAND_INTERFACE_GEN_INCLUDE_DIR}
49     ${INCLUDE_FOLDER}
50     ${PYTHON_INCLUDE_DIRS}
51     ${GOOGLE_TEST_INCLUDE_DIR}
52     ${GMOCK_INCLUDE_DIR}
53     "../../AudioManagerDaemon/include"
54     "../include"
55 )
56
57 link_directories(
58         ${LINK_DIRECTORIES}
59         ${COMMON_API_LIBRARY_DIRS}
60                 ${COMMON_API_DBUS_LIBRARY_DIRS}
61 )
62    
63 file(GLOB CAPI_PLUGIN_INTERFACE_SRCS_CXX 
64      "../../AudioManagerDaemon/src/CAmCommonAPIWrapper.cpp"
65      "../../AudioManagerDaemon/src/CAmSocketHandler.cpp"
66      "../../AudioManagerDaemon/src/CAmDltWrapper.cpp" 
67      "CAmCommandSenderCAPITest.cpp"
68      "CAmTestCAPIWrapper.cpp"
69      "CAmCommandSenderCommon.cpp"
70      "../src/*.cpp"
71      ${COMMON_API_COMMAND_INTERFACE_GEN_SOURCES}
72 )
73
74 ADD_EXECUTABLE(AmCommandSenderCAPITest ${CAPI_PLUGIN_INTERFACE_SRCS_CXX})
75
76 TARGET_LINK_LIBRARIES(AmCommandSenderCAPITest 
77     ${DLT_LIBRARIES}
78     ${CMAKE_DL_LIBS}
79     ${CMAKE_THREAD_LIBS_INIT}
80     ${PYTHON_LIBRARY}
81     ${PC_GSTREAMER_LIBRARIES}
82         ${COMMON_API_LIBRARIES}
83     ${COMMON_API_DBUS_LIBRARIES}
84     gtest
85     gmock
86 )
87
88 CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/PluginCommandInterfaceCAPI/fidl/PluginCommandInterfaceCAPI_dbus.conf ${EXECUTABLE_OUTPUT_PATH}/AmCommandSenderCAPITest_dbus.conf)
89
90 INSTALL(TARGETS AmCommandSenderCAPITest 
91         DESTINATION "~/AudioManagerTest/"
92         PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
93         COMPONENT tests
94 )
95
96 #execute_process(
97 #           COMMAND cp "${CMAKE_SOURCE_DIR}/PluginCommandInterfaceCAPI/fidls/PluginCommandInterfaceCAPI_dbus.conf" ${EXECUTABLE_OUTPUT_PATH})
98
99 SET(ADD_DEPEND "audiomanager-bin" "sqlite3(>=3.6.22)" "dlt" "gtest"  "libpthread-stubs0")
100 set_property(GLOBAL APPEND PROPERTY tests_prop "${ADD_DEPEND}")
101