summaryrefslogtreecommitdiff
path: root/src/appMain/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/appMain/CMakeLists.txt')
-rw-r--r--src/appMain/CMakeLists.txt159
1 files changed, 45 insertions, 114 deletions
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt
index 7e23cdc6a..d27a282c2 100644
--- a/src/appMain/CMakeLists.txt
+++ b/src/appMain/CMakeLists.txt
@@ -55,7 +55,9 @@ if (TIME_TESTER)
set(TIME_TESTER_LIB
TimeTester)
endif()
+
set(LIBRARIES
+ MediaManager
ApplicationManager
HMI_API
MOBILE_API
@@ -74,7 +76,6 @@ set(LIBRARIES
Utils
jsoncpp
ConfigProfile
- MediaManager
Resumption
)
@@ -104,52 +105,43 @@ endif()
include_directories (
./
- ${CMAKE_SOURCE_DIR}/src/components/protocol_handler/include/
+ ${COMPONENTS_DIR}/protocol_handler/include/
${JSONCPP_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/components/application_manager/include
- ${CMAKE_SOURCE_DIR}/src/components/formatters/include
- ${CMAKE_SOURCE_DIR}/src/components/transport_manager/include
+ ${COMPONENTS_DIR}/application_manager/include
+ ${COMPONENTS_DIR}/formatters/include
+ ${COMPONENTS_DIR}/transport_manager/include
+ ${COMPONENTS_DIR}/security_manager/include
${SecurityManagerIncludeDir}
-
- ${CMAKE_SOURCE_DIR}/src/components/config_profile/include
- ${CMAKE_SOURCE_DIR}/src/components/utils/include/
- ${CMAKE_SOURCE_DIR}/src/components/connection_handler/include/
- ${CMAKE_SOURCE_DIR}/src/components/hmi_message_handler/include
- ${CMAKE_SOURCE_DIR}/src/components/request_watchdog/include
- ${CMAKE_SOURCE_DIR}/src/components/smart_objects/include/
- ${CMAKE_SOURCE_DIR}/src/components/media_manager/include/
- ${CMAKE_SOURCE_DIR}/src/components/time_tester/include
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/include/
- ${CMAKE_SOURCE_DIR}/src/components/resumption/include/
+ ${COMPONENTS_DIR}/security_manager/include
+ ${COMPONENTS_DIR}/config_profile/include
+ ${COMPONENTS_DIR}/utils/include/
+ ${COMPONENTS_DIR}/connection_handler/include/
+ ${COMPONENTS_DIR}/hmi_message_handler/include
+ ${COMPONENTS_DIR}/request_watchdog/include
+ ${COMPONENTS_DIR}/smart_objects/include/
+ ${COMPONENTS_DIR}/media_manager/include/
+ ${COMPONENTS_DIR}/time_tester/include
+ ${COMPONENTS_DIR}/policy/src/policy/include/
+ ${COMPONENTS_DIR}/resumption/include/
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${ENCRYPTION_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/components/
+ ${COMPONENTS_DIR}
${CMAKE_BINARY_DIR}/src/components/
- ${CMAKE_SOURCE_DIR}/src/components/dbus/include/
+ ${COMPONENTS_DIR}/dbus/include/
${CMAKE_BINARY_DIR}/src/components/policy/src/policy
${CMAKE_SOURCE_DIR}
${default_media_inc}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${CMAKE_SOURCE_DIR}/src/3rd_party/dbus-1.7.8
+ ${CMAKE_SOURCE_DIR}/src/3rd_party/dbus-1.7.8/dbus/
)
-add_custom_target(gitversion
- COMMAND export GITVERSION=`git rev-parse HEAD` \;
- if ! grep -s \"\$\${GITVERSION}\" ${CMAKE_CURRENT_BINARY_DIR}/gitversion.cc > /dev/null \;
- then echo -n \"const char *gitVersion = \\\"Built against \$\${GITVERSION} revision\\\"\;\" > ${CMAKE_CURRENT_BINARY_DIR}/gitversion.cc\; fi
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-)
-add_custom_command(
- OUTPUT gitversion.cc
- DEPENDS gitversion
-)
set (SOURCES
main.cc
life_cycle.cc
signal_handlers.cc
- gitversion.cc
)
-
if( NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build. Options are: None, Debug, Release, RelWithDebInfo, MinSizeRel." FORCE)
endif()
@@ -158,84 +150,6 @@ add_executable(${PROJECT} ${SOURCES})
target_link_libraries(${PROJECT} ${LIBRARIES})
-#======================= Unit-Test section =======================
-if(BUILD_TESTS)
- set (AM_TEST_DIR ${CMAKE_SOURCE_DIR}/src/components/application_manager/test)
- set (AM_MOCK_DIR ${CMAKE_SOURCE_DIR}/src/components/application_manager/test/mock)
-
- get_property(the_include_dirs DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES)
- #replace include for mocking singltone
- set(class_to_mock ${CMAKE_SOURCE_DIR}/src/components/application_manager/include)
- list(FIND the_include_dirs ${class_to_mock} find_idx)
- if(find_idx GREATER -1)
- LIST_REPLACE(the_include_dirs ${find_idx} ${AM_MOCK_DIR}/include)
- endif()
- set_property(DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES ${the_include_dirs})
-
-
-include_directories (
- ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include
- ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include
-)
-
- set(testSources
- ./main_test.cc
- ${CMAKE_SOURCE_DIR}/src/components/utils/test/date_time_test.cc
- ${CMAKE_SOURCE_DIR}/src/components/utils/test/file_system_test.cc
- ${CMAKE_SOURCE_DIR}/src/components/media_manager/test/media_adapter_impl_test.cc
- ${AM_TEST_DIR}/command_impl_test.cc
- )
-
- set(test_exec_libraries
- gmock
- gtest
- ConfigProfile
- SmartObjects
- gmock
- gtest
- gmock
- gmock_main
- ApplicationManagerTest #Mocked Singlton
- HMI_API
- MOBILE_API
- v4_protocol_v1_2_no_extra
- SmartObjects
- formatters
- ProtocolLibrary
- ProtocolHandler
- connectionHandler
- HMIMessageHandler
- Utils
- jsoncpp
- ConfigProfile
- MediaManager
- Resumption
- )
-
-if(ENABLE_LOG)
- list(APPEND test_exec_libraries log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
- list(APPEND test_exec_libraries apr-1 -L${APR_LIBS_DIRECTORY})
- list(APPEND test_exec_libraries aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
- list(APPEND test_exec_libraries expat -L${EXPAT_LIBS_DIRECTORY})
-endif()
-
- include(${CMAKE_SOURCE_DIR}/src/components/policy/test/include.cmake)
-
- IF(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
- list(REMOVE_ITEM test_exec_libraries dl)
- endif()
-
- add_executable(${PROJECT}_test ${testSources})
- target_link_libraries(${PROJECT}_test ${test_exec_libraries})
-
- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_BINARY_DIR}/test/)
- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/smartDeviceLink.ini DESTINATION ${CMAKE_BINARY_DIR}/test/)
- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/hmi_capabilities.json DESTINATION ${CMAKE_BINARY_DIR}/test/)
-
-endif()
-
-#=================================================================
-
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/audio.8bit.wav DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@@ -246,7 +160,27 @@ if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/init_policy.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif ()
-
+# Replace commit in ini file
+set(GITCOMMIT "")
+if(EXISTS ${CMAKE_SOURCE_DIR}/.git)
+ find_package(Git)
+ if(GIT_FOUND)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE GITCOMMIT ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(INI_FILE ${CMAKE_CURRENT_BINARY_DIR}/smartDeviceLink.ini)
+ if(EXISTS ${INI_FILE})
+ file(READ ${INI_FILE} FILE_CONTENT)
+ set(LINE SDLVersion)
+ set(SEARCH_REGEX "${LINE}([^/\r/\n]+)")
+ string(REGEX REPLACE "${SEARCH_REGEX}" "${LINE} = ${GITCOMMIT}"
+ MODIFIED_FILE_CONTENT "${FILE_CONTENT}")
+ file(WRITE "${INI_FILE}" "${MODIFIED_FILE_CONTENT}")
+ endif()
+ endif(GIT_FOUND)
+endif()
if (${QT_HMI})
set(main_qml "hmi/MainWindow.qml")
@@ -265,10 +199,6 @@ if (${QT_HMI})
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/start_hmi.sh
"#!/bin/sh\n${start_command} ${command_arguments}\n")
-elseif (${WEB_HMI})
- file(COPY ${CMAKE_HOME_DIRECTORY}/src/components/HMI/ DESTINATION ${CMAKE_BINARY_DIR}/src/components/HMI/)
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hmi_link
- "${CMAKE_BINARY_DIR}/src/components/HMI/index.html")
endif ()
# Install rules
@@ -279,9 +209,10 @@ install(
${CMAKE_SOURCE_DIR}/mycert.pem ${CMAKE_SOURCE_DIR}/mykey.pem
DESTINATION bin
)
+
if (${WEB_HMI})
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hmi_link DESTINATION bin)
+ install( DIRECTORY ${CMAKE_HOME_DIRECTORY}/src/components/HMI/ DESTINATION bin/HMI)
endif ()
elseif (${QT_HMI})
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")