From e8847c9d6ba859156217c39eee538cb4621d2041 Mon Sep 17 00:00:00 2001 From: BSolonenko Date: Thu, 8 Nov 2018 15:12:24 +0200 Subject: added cmake files for 3rd party libraries --- CMakeLists.txt | 1 + cmake/helpers/dependencies.cmake | 30 +++++++++++++ cmake/helpers/dependencies/BSON.cmake | 47 ++++++++++++++++++++ cmake/helpers/dependencies/apr-util.cmake | 51 ++++++++++++++++++++++ cmake/helpers/dependencies/apr.cmake | 51 ++++++++++++++++++++++ cmake/helpers/dependencies/boost.cmake | 11 +++++ cmake/helpers/dependencies/boost/filesystem.cmake | 37 ++++++++++++++++ cmake/helpers/dependencies/boost/system.cmake | 30 +++++++++++++ cmake/helpers/dependencies/boost/thread.cmake | 37 ++++++++++++++++ cmake/helpers/dependencies/log4cxx.cmake | 35 +++++++++++++++ src/3rd_party/CMakeLists.txt | 3 +- src/3rd_party/apr-util-cmake/CMakeLists.txt | 7 +++ src/appMain/CMakeLists.txt | 6 +-- src/components/application_manager/CMakeLists.txt | 4 +- .../src/application_manager_impl.cc | 2 +- .../test/application_manager_impl_test.cc | 2 +- src/components/protocol_handler/CMakeLists.txt | 4 +- .../protocol_handler/src/handshake_handler.cc | 2 +- .../protocol_handler/src/protocol_handler_impl.cc | 2 +- .../test/protocol_handler_tm_test.cc | 2 +- src/components/utils/CMakeLists.txt | 22 ++++++---- tools/cmake/helpers/install_rules.cmake | 6 +++ 22 files changed, 372 insertions(+), 20 deletions(-) create mode 100644 cmake/helpers/dependencies.cmake create mode 100644 cmake/helpers/dependencies/BSON.cmake create mode 100644 cmake/helpers/dependencies/apr-util.cmake create mode 100644 cmake/helpers/dependencies/apr.cmake create mode 100644 cmake/helpers/dependencies/boost.cmake create mode 100644 cmake/helpers/dependencies/boost/filesystem.cmake create mode 100644 cmake/helpers/dependencies/boost/system.cmake create mode 100644 cmake/helpers/dependencies/boost/thread.cmake create mode 100644 cmake/helpers/dependencies/log4cxx.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b17f708773..d54ffcbd50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ project(${PROJECT}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/modules/") +include("${CMAKE_CURRENT_LIST_DIR}/cmake/helpers/dependencies.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tools/cmake/helpers/install_rules.cmake") include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/platform.cmake) include( diff --git a/cmake/helpers/dependencies.cmake b/cmake/helpers/dependencies.cmake new file mode 100644 index 0000000000..ce625bd607 --- /dev/null +++ b/cmake/helpers/dependencies.cmake @@ -0,0 +1,30 @@ +include_guard(GLOBAL) + +set(dependency_descriptor_dir "${CMAKE_CURRENT_LIST_DIR}/dependencies") +file(GLOB dependency_descriptors "${dependency_descriptor_dir}/*") +foreach(dependency IN LISTS dependency_descriptors) + get_filename_component(dependency_name "${dependency}" NAME_WE) + list(APPEND buildable_dependencies "${dependency_name}") +endforeach() + +function(SDL_find_package) + # Handle REQUIRED somehow so this doesn't fail + if(REQUIRED IN_LIST ARGV) + set(${ARGV0}_REQUIRED ON) + endif() + list(REMOVE_ITEM ARGV REQUIRED) + + find_package(${ARGV} QUIET) + if(NOT ${ARGV0}_FOUND AND NOT ${ARGV0} IN_LIST buildable_dependencies) + if(${ARGV0}_REQUIRED) + message(FATAL_ERROR "Required package ${ARGV0} was not found and there is no " + "dependency descriptor file which can provide it.") + endif() + else() + include("${dependency_descriptor_dir}/${ARGV0}.cmake") + endif() + if(${ARGV0}_REQUIRED AND NOT ${ARGV0}_FOUND) + message(FATAL_ERROR "Required package ${ARGV0} was missing and the dependency " + "descriptor ${dependency_descriptor_dir}/${ARGV0}.cmake did not provide it.") + endif() +endfunction() diff --git a/cmake/helpers/dependencies/BSON.cmake b/cmake/helpers/dependencies/BSON.cmake new file mode 100644 index 0000000000..3f2d56d693 --- /dev/null +++ b/cmake/helpers/dependencies/BSON.cmake @@ -0,0 +1,47 @@ +# Copyright (c) 2018, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +include(FetchContent) + +FetchContent_Declare( + BSON + GIT_REPOSITORY https://github.com/BSolonenko/bson_c_lib.git + GIT_TAG topic/sdl_rework +) + +FetchContent_GetProperties(BSON) +if(NOT bson_POPULATED) + FetchContent_Populate(BSON) + add_subdirectory("${bson_SOURCE_DIR}" "${bson_BINARY_DIR}") +endif() + +set(BSON_FOUND ON) + diff --git a/cmake/helpers/dependencies/apr-util.cmake b/cmake/helpers/dependencies/apr-util.cmake new file mode 100644 index 0000000000..52eb442e85 --- /dev/null +++ b/cmake/helpers/dependencies/apr-util.cmake @@ -0,0 +1,51 @@ +if(TARGET apr-util::apr-util) + set(apr-util_FOUND ON) + return() +endif() + +find_path(apr-util_INCLUDE_DIR + NAMES + apu.h + PATH_SUFFIXES + include +) + +if(apr-util_INCLUDE_DIR) + set(apr-util_VERSION_MAJOR 0) + set(apr-util_VERSION_MINOR 0) + set(apr-util_VERSION_PATCH 0) + + if(EXISTS "${apr-util_INCLUDE_DIR}/apr-1/apu_version.h") + # Read and parse apr version header file for version number + file(STRINGS "${apr-util_INCLUDE_DIR}/apr-1/apu_version.h" _apr_util_version_HEADER_CONTENTS REGEX "#define APU_[A-Z]+_VERSION[ \t]+[0-9]+") + string(REGEX REPLACE ".*#define APU_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" apr-util_VERSION_MAJOR "${_apr_util_version_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define APU_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" apr-util_VERSION_MINOR "${_apr_util_version_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define APU_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" apr-util_VERSION_PATCH "${_apr_util_version_HEADER_CONTENTS}") + unset(_apr_util_version_HEADER_CONTENTS) + endif() + set(apr-util_VERSION_STRING "${apr-util_VERSION_MAJOR}.${apr-util_VERSION_MINOR}.${apr-util_VERSION_PATCH}") +endif () + +find_library(apr-util_LIBRARY + NAMES + aprutil-1 + PATH_SUFFIXES + lib +) + +mark_as_advanced(apr-util_INCLUDE_DIR apr-util_LIBRARY apr-util_FOUND) + +if(apr-util_LIBRARY AND apr-util_INCLUDE_DIR) + set(apr-util_FOUND ON) + message(STATUS "Found apr-util: ${apr-util_LIBRARY} (found version \"${apr-util_VERSION_STRING}\")") +else() + message(STATUS "apr-util library not found") + return() +endif() + +add_library(apr-util::apr-util UNKNOWN IMPORTED GLOBAL) +set_target_properties(apr-util::apr-util + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${apr-util_INCLUDE_DIR}" + IMPORTED_LOCATION "${apr-util_LIBRARY}" +) diff --git a/cmake/helpers/dependencies/apr.cmake b/cmake/helpers/dependencies/apr.cmake new file mode 100644 index 0000000000..4ab8dcaf5f --- /dev/null +++ b/cmake/helpers/dependencies/apr.cmake @@ -0,0 +1,51 @@ +if(TARGET apr::apr) + set(apr_FOUND ON) + return() +endif() + +find_path(apr_INCLUDE_DIR + NAMES + apr.h + PATH_SUFFIXES + include +) + +if(apr_INCLUDE_DIR) + set(apr_VERSION_MAJOR 0) + set(apr_VERSION_MINOR 0) + set(apr_VERSION_PATCH 0) + + if(EXISTS "${apr_INCLUDE_DIR}/apr-1/apr_version.h") + # Read and parse apr version header file for version number + file(STRINGS "${apr_INCLUDE_DIR}/apr-1/apr_version.h" _apr_version_HEADER_CONTENTS REGEX "#define APR_[A-Z]+_VERSION[ \t]+[0-9]+") + string(REGEX REPLACE ".*#define APR_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" apr_VERSION_MAJOR "${_apr_version_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define APR_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" apr_VERSION_MINOR "${_apr_version_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define APR_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" apr_VERSION_PATCH "${_apr_version_HEADER_CONTENTS}") + unset(_apr_version_HEADER_CONTENTS) + endif() + set(apr_VERSION_STRING "${apr_VERSION_MAJOR}.${apr_VERSION_MINOR}.${apr_VERSION_PATCH}") +endif () + +find_library(apr_LIBRARY + NAMES + apr-1 + PATH_SUFFIXES + lib +) + +mark_as_advanced(apr_INCLUDE_DIR apr_LIBRARY apr_FOUND) + +if(apr_LIBRARY AND apr_INCLUDE_DIR) + set(apr_FOUND ON) + message(STATUS "Found apr: ${apr_LIBRARY} (found version \"${apr_VERSION_STRING}\")") +else() + message(STATUS "apr library not found") + return() +endif() + +add_library(apr::apr UNKNOWN IMPORTED GLOBAL) +set_target_properties(apr::apr + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${apr_INCLUDE_DIR}" + IMPORTED_LOCATION "${apr_LIBRARY}" +) diff --git a/cmake/helpers/dependencies/boost.cmake b/cmake/helpers/dependencies/boost.cmake new file mode 100644 index 0000000000..a7503c54c3 --- /dev/null +++ b/cmake/helpers/dependencies/boost.cmake @@ -0,0 +1,11 @@ +if(boost_FOUND) + return() +endif() + +include("${dependency_descriptor_dir}/boost/filesystem.cmake") +include("${dependency_descriptor_dir}/boost/system.cmake") +include("${dependency_descriptor_dir}/boost/thread.cmake") + +if(boost_filesystem_FOUND AND boost_thread_FOUND AND boost_system_FOUND) + set(boost_FOUND ON) +endif() \ No newline at end of file diff --git a/cmake/helpers/dependencies/boost/filesystem.cmake b/cmake/helpers/dependencies/boost/filesystem.cmake new file mode 100644 index 0000000000..7e6923f3e5 --- /dev/null +++ b/cmake/helpers/dependencies/boost/filesystem.cmake @@ -0,0 +1,37 @@ +if(TARGET boost::filesystem) + set(boost_filesystem_FOUND ON) + return() +endif() + +find_path(boost_filesystem_INCLUDE_DIR + NAMES + boost/filesystem.hpp + PATH_SUFFIXES + include +) + +find_library(boost_filesystem_LIBRARY + NAMES + boost_filesystem + PATH_SUFFIXES + lib +) + +mark_as_advanced(boost_filesystem_INCLUDE_DIR boost_filesystem_LIBRARY boost_filesystem_FOUND) + +if(boost_filesystem_INCLUDE_DIR AND boost_filesystem_LIBRARY) + set(boost_filesystem_FOUND ON) + message(STATUS "boost::filesystem found") + message(STATUS "boost_filesystem_LIBRARY -> ${boost_filesystem_LIBRARY}") +else() + message(STATUS "----> boost::filesystem not found!!!") + return() +endif() + +add_library(boost::filesystem UNKNOWN IMPORTED GLOBAL ${boost_system_LIBRARY}) +set_target_properties(boost::filesystem + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${boost_filesystem_INCLUDE_DIR}" + IMPORTED_LOCATION "${boost_filesystem_LIBRARY}" +) + diff --git a/cmake/helpers/dependencies/boost/system.cmake b/cmake/helpers/dependencies/boost/system.cmake new file mode 100644 index 0000000000..abafcdb6f6 --- /dev/null +++ b/cmake/helpers/dependencies/boost/system.cmake @@ -0,0 +1,30 @@ +if(TARGET boost::system) + set(boost_system_FOUND ON) + return() +endif() + +find_library(boost_system_LIBRARY + NAMES + boost_system + PATH_SUFFIXES + lib +) + +mark_as_advanced(boost_system_LIBRARY boost_system_FOUND) + +if(boost_system_LIBRARY) + set(boost_system_FOUND ON) + message(STATUS "boost::system found") + message(STATUS "boost_system_LIBRARY -> ${boost_system_LIBRARY}") + +else() + message(STATUS "----> boost::system not found!!!") + return() +endif() + +add_library(boost::system UNKNOWN IMPORTED GLOBAL ${boost_system_LIBRARY}) +set_target_properties(boost::system + PROPERTIES + IMPORTED_LOCATION "${boost_system_LIBRARY}" +) + diff --git a/cmake/helpers/dependencies/boost/thread.cmake b/cmake/helpers/dependencies/boost/thread.cmake new file mode 100644 index 0000000000..7dcbf42179 --- /dev/null +++ b/cmake/helpers/dependencies/boost/thread.cmake @@ -0,0 +1,37 @@ +if(TARGET boost::thread) + set(boost_thread_FOUND ON) + return() +endif() + +find_path(boost_thread_INCLUDE_DIR + NAMES + boost/thread.hpp + PATH_SUFFIXES + include +) + +find_library(boost_thread_LIBRARY + NAMES + boost_thread + PATH_SUFFIXES + lib +) + +mark_as_advanced(boost_thread_INCLUDE_DIR boost_thread_LIBRARY boost_thread_FOUND) + +if(boost_thread_INCLUDE_DIR AND boost_thread_LIBRARY) + set(boost_thread_FOUND ON) + message(STATUS "boost::thread found") + message(STATUS "boost_thread_LIBRARY -> ${boost_thread_LIBRARY}") + +else() + message(STATUS "----> boost::thread not found!!!") + return() +endif() + +add_library(boost::thread UNKNOWN IMPORTED GLOBAL) +set_target_properties(boost::thread + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${boost_thread_INCLUDE_DIR}" + IMPORTED_LOCATION "${boost_thread_LIBRARY}" +) \ No newline at end of file diff --git a/cmake/helpers/dependencies/log4cxx.cmake b/cmake/helpers/dependencies/log4cxx.cmake new file mode 100644 index 0000000000..0a6d9d51ce --- /dev/null +++ b/cmake/helpers/dependencies/log4cxx.cmake @@ -0,0 +1,35 @@ +if(TARGET log4cxx::log4cxx) + set(log4cxx_FOUND ON) + return() +endif() + +find_path(log4cxx_INCLUDE_DIR + NAMES + log4cxx/log4cxx.h + PATH_SUFFIXES + include +) + +find_library(log4cxx_LIBRARY + NAMES + log4cxx + PATH_SUFFIXES + lib +) + +mark_as_advanced(log4cxx_INCLUDE_DIR log4cxx_LIBRARY log4cxx_FOUND) + +if(log4cxx_LIBRARY AND log4cxx_INCLUDE_DIR) + set(log4cxx_FOUND ON) + message(STATUS "Found log4cxx: ${log4cxx_LIBRARY}") +else() + message(STATUS "log4cxx library not found") + return() +endif() + +add_library(log4cxx::log4cxx UNKNOWN IMPORTED GLOBAL) +set_target_properties(log4cxx::log4cxx + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${log4cxx_INCLUDE_DIR}" + IMPORTED_LOCATION "${log4cxx_LIBRARY}" +) diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index 1de1b01a09..6cfd5b47d7 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -155,6 +155,8 @@ if(ENABLE_LOG) set(APR_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE) set(APR_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include PARENT_SCOPE) set(APR_UTIL_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE) + set(APR_UTIL_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include PARENT_SCOPE) + set(LOG4CXX_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include PARENT_SCOPE) set(LOG4CXX_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE) @@ -241,7 +243,6 @@ endif() add_custom_target(install-3rd_party DEPENDS ${install-3rd_party_logger_var} - DEPENDS libbson DEPENDS Boost WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY} ) diff --git a/src/3rd_party/apr-util-cmake/CMakeLists.txt b/src/3rd_party/apr-util-cmake/CMakeLists.txt index 86f43f2b16..16eb187b42 100644 --- a/src/3rd_party/apr-util-cmake/CMakeLists.txt +++ b/src/3rd_party/apr-util-cmake/CMakeLists.txt @@ -31,6 +31,7 @@ set(APR_UTIL_SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../apr-util-1.5.3) set(APR_UTIL_BUILD_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../apr-util-build) +set(APR_UTIL_INCLUDE_DIRECTORY ${APR_UTIL_BUILD_DIRECTORY}/include) set(APR_UTIL_LIBS_DIRECTORY ${APR_UTIL_BUILD_DIRECTORY}/.libs) file(MAKE_DIRECTORY @@ -71,3 +72,9 @@ install( USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN libaprutil-1.so* ) +install( + DIRECTORY ${APR_UTIL_INCLUDE_DIRECTORY}/ + DESTINATION ${3RD_PARTY_INSTALL_PREFIX}/include + USE_SOURCE_PERMISSIONS + FILES_MATCHING PATTERN *.h +) diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt index 9bac7f1fb6..84970027c3 100644 --- a/src/appMain/CMakeLists.txt +++ b/src/appMain/CMakeLists.txt @@ -41,7 +41,7 @@ target_sources(${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/signal_handlers.cc" ) -find_package(Boost 1.66.0 COMPONENTS system filesystem) +SDL_find_package(boost REQUIRED) target_link_libraries(${PROJECT_NAME} PUBLIC @@ -55,8 +55,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE components::interface Policy::usage_statistics - Boost::system - Boost::filesystem + boost::filesystem + boost::system ) target_include_directories(${PROJECT_NAME} diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index 8ac2a6b4c3..872ad2f2b8 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -107,6 +107,8 @@ target_sources( "${CMAKE_CURRENT_LIST_DIR}/src/state_controller_impl.cc" "${CMAKE_CURRENT_LIST_DIR}/src/usage_statistics.cc" "${CMAKE_CURRENT_LIST_DIR}/src/help_prompt_manager_impl") + +SDL_find_package(BSON REQUIRED) target_link_libraries(${PROJECT_NAME} PUBLIC utils::utils @@ -119,7 +121,7 @@ target_link_libraries(${PROJECT_NAME} hmi_message_handler::hmi_message_handler Policy::Policy Policy::usage_statistics - # bson + BSON::BSON PRIVATE components::interface) if(TELEMETRY_MONITOR) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 24f27af2e2..926bc36413 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include "application_manager/application_manager_impl.h" #include "application_manager/commands/command_impl.h" diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc index 7e57b51329..239d09f2e5 100644 --- a/src/components/application_manager/test/application_manager_impl_test.cc +++ b/src/components/application_manager/test/application_manager_impl_test.cc @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "gtest/gtest.h" #include "application_manager/application.h" diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt index cef87df292..d9e6db7ca5 100644 --- a/src/components/protocol_handler/CMakeLists.txt +++ b/src/components/protocol_handler/CMakeLists.txt @@ -40,12 +40,14 @@ target_sources( "${CMAKE_CURRENT_LIST_DIR}/src/protocol_packet.cc" "${CMAKE_CURRENT_LIST_DIR}/src/protocol_payload.cc") +SDL_find_package(BSON REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC config_profile::config_profile protocol::protocol utils::utils connection_handler::connection_handler - PRIVATE components::interface bson) + PRIVATE components::interface BSON::BSON) if(TELEMETRY_MONITOR) target_link_libraries(${PROJECT_NAME} diff --git a/src/components/protocol_handler/src/handshake_handler.cc b/src/components/protocol_handler/src/handshake_handler.cc index 775d77db66..30270576fc 100644 --- a/src/components/protocol_handler/src/handshake_handler.cc +++ b/src/components/protocol_handler/src/handshake_handler.cc @@ -32,7 +32,7 @@ #include "protocol_handler/handshake_handler.h" -#include +#include #include "protocol_handler/protocol_handler_impl.h" #include "protocol_handler/protocol_packet.h" diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index d03030b747..3557b3d761 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -34,7 +34,7 @@ #include // for INET6_ADDRSTRLEN #include #include // std::find -#include +#include #include #include "connection_handler/connection_handler_impl.h" diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc index 51284dfcda..b51b6b14df 100644 --- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc +++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc @@ -51,7 +51,7 @@ #include "utils/semantic_version.h" #include "utils/test_async_waiter.h" -#include +#include namespace transport_manager { namespace transport_adapter { diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt index bd48dd3bd2..98def35265 100644 --- a/src/components/utils/CMakeLists.txt +++ b/src/components/utils/CMakeLists.txt @@ -23,7 +23,8 @@ target_sources(${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/src/threads/async_runner.cc" "${CMAKE_CURRENT_LIST_DIR}/src/threads/thread_delegate.cc" "${CMAKE_CURRENT_LIST_DIR}/src/threads/thread_posix.cc" - "${CMAKE_CURRENT_LIST_DIR}/src/threads/thread_validator.cc") + "${CMAKE_CURRENT_LIST_DIR}/src/threads/thread_validator.cc" + "${CMAKE_CURRENT_LIST_DIR}/src/semantic_version.cc") if(BUILD_BACKTRACE_SUPPORT AND NOT QNXNTO) target_sources(${PROJECT_NAME} PRIVATE @@ -37,9 +38,12 @@ if(QNXNTO) "${CMAKE_CURRENT_LIST_DIR}/src/threads/pulse_thread_delegate.cc") endif() -find_package(Boost 1.66 COMPONENTS system thread REQUIRED) - if(ENABLE_LOG) + SDL_find_package(apr REQUIRED) + SDL_find_package(apr-util REQUIRED) + SDL_find_package(log4cxx REQUIRED) + SDL_find_package(boost REQUIRED) + find_package(EXPAT REQUIRED) target_sources(${PROJECT_NAME} @@ -50,14 +54,14 @@ if(ENABLE_LOG) "${CMAKE_CURRENT_LIST_DIR}/src/logger_status.cc" "${CMAKE_CURRENT_LIST_DIR}/src/auto_trace.cc") target_link_libraries(${PROJECT_NAME} - PUBLIC libapr-1.so - libaprutil-1.so - log4cxx + PUBLIC apr::apr + apr-util::apr-util + log4cxx::log4cxx EXPAT::EXPAT config_profile::config_profile - Boost::boost - Boost::system - ${Boost_LIBRARIES}) + boost::system + boost::filesystem + boost::thread) target_compile_definitions(${PROJECT_NAME} PUBLIC ENABLE_LOG) endif() diff --git a/tools/cmake/helpers/install_rules.cmake b/tools/cmake/helpers/install_rules.cmake index e83ea0e2e7..5aac777b03 100644 --- a/tools/cmake/helpers/install_rules.cmake +++ b/tools/cmake/helpers/install_rules.cmake @@ -1,6 +1,12 @@ include(GNUInstallDirs) +set(EXPAT_INCLUDE_DIRS "${THIRD_PARTY_INSTALL_PREFIX}/include") +set(EXPAT_LIBRARIES "${THIRD_PARTY_INSTALL_PREFIX}/lib") + +set(BOOST_INCLUDEDIR "${THIRD_PARTY_INSTALL_PREFIX}/include") +set(BOOST_LIBRARYDIR "${THIRD_PARTY_INSTALL_PREFIX}/lib") + if(QNXNTO) set(SDL_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_SYSCONFDIR}/AppLink") set(SDL_PLUGINS_INSTALL_DIR "${CMAKE_INSTALL_SYSCONFDIR}/AppLink/plugins") -- cgit v1.2.1 From 3282e639bf1ecb683619ca0ccae822afa0614cd6 Mon Sep 17 00:00:00 2001 From: bsolonenko Date: Wed, 14 Nov 2018 10:09:15 +0200 Subject: fixed THIRD_PARTY_INSTALL_PREFIX --- src/plugins/appenders/CMakeLists.txt | 23 +++++++--- src/plugins/appenders/include/safe_file_appender.h | 50 ++++++++++++++++++++++ .../appenders/include/safe_rolling_file_appender.h | 50 ++++++++++++++++++++++ src/plugins/appenders/safe_file_appender.cc | 46 -------------------- src/plugins/appenders/safe_file_appender.h | 50 ---------------------- .../appenders/safe_rolling_file_appender.cc | 46 -------------------- src/plugins/appenders/safe_rolling_file_appender.h | 50 ---------------------- src/plugins/appenders/src/safe_file_appender.cc | 46 ++++++++++++++++++++ .../appenders/src/safe_rolling_file_appender.cc | 46 ++++++++++++++++++++ tools/cmake/helpers/install_rules.cmake | 8 +++- 10 files changed, 215 insertions(+), 200 deletions(-) create mode 100644 src/plugins/appenders/include/safe_file_appender.h create mode 100644 src/plugins/appenders/include/safe_rolling_file_appender.h delete mode 100644 src/plugins/appenders/safe_file_appender.cc delete mode 100644 src/plugins/appenders/safe_file_appender.h delete mode 100644 src/plugins/appenders/safe_rolling_file_appender.cc delete mode 100644 src/plugins/appenders/safe_rolling_file_appender.h create mode 100644 src/plugins/appenders/src/safe_file_appender.cc create mode 100644 src/plugins/appenders/src/safe_rolling_file_appender.cc diff --git a/src/plugins/appenders/CMakeLists.txt b/src/plugins/appenders/CMakeLists.txt index 8c05f542a3..a2b42e8fed 100644 --- a/src/plugins/appenders/CMakeLists.txt +++ b/src/plugins/appenders/CMakeLists.txt @@ -34,13 +34,24 @@ add_library(${PROJECT_NAME} SHARED) add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) target_sources(${PROJECT_NAME} - PRIVATE - "${CMAKE_CURRENT_LIST_DIR}/safe_file_appender.cc" - "${CMAKE_CURRENT_LIST_DIR}/safe_file_appender.h" - "${CMAKE_CURRENT_LIST_DIR}/safe_rolling_file_appender.cc" - "${CMAKE_CURRENT_LIST_DIR}/safe_rolling_file_appender.h") + PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/src/safe_file_appender.cc" + "${CMAKE_CURRENT_LIST_DIR}/src/safe_rolling_file_appender.cc" +) -target_link_libraries(${PROJECT_NAME} PUBLIC EXPAT::EXPAT) +target_include_directories(${PROJECT_NAME} + PUBLIC + "${CMAKE_CURRENT_LIST_DIR}/include" + "${THIRD_PARTY_INSTALL_PREFIX}/include" +) + +SDL_find_package(log4cxx REQUIRED) + +target_link_libraries(${PROJECT_NAME} + PUBLIC + EXPAT::EXPAT + log4cxx::log4cxx +) install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}" diff --git a/src/plugins/appenders/include/safe_file_appender.h b/src/plugins/appenders/include/safe_file_appender.h new file mode 100644 index 0000000000..45299602ff --- /dev/null +++ b/src/plugins/appenders/include/safe_file_appender.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_PLUGINS_APPENDERS_SAFE_FILE_APPENDER_H_ +#define SRC_PLUGINS_APPENDERS_SAFE_FILE_APPENDER_H_ + +#include + +namespace log4cxx { + +class SafeFileAppender : public FileAppender { + public: + DECLARE_LOG4CXX_OBJECT(SafeFileAppender) + protected: + virtual void subAppend(const spi::LoggingEventPtr& event, + log4cxx::helpers::Pool& p); +}; + +} // namespace log4cxx + +#endif // SRC_PLUGINS_APPENDERS_SAFE_FILE_APPENDER_H_ diff --git a/src/plugins/appenders/include/safe_rolling_file_appender.h b/src/plugins/appenders/include/safe_rolling_file_appender.h new file mode 100644 index 0000000000..75832b7de7 --- /dev/null +++ b/src/plugins/appenders/include/safe_rolling_file_appender.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_PLUGINS_APPENDERS_SAFE_ROLLING_FILE_APPENDER_H_ +#define SRC_PLUGINS_APPENDERS_SAFE_ROLLING_FILE_APPENDER_H_ + +#include + +namespace log4cxx { + +class SafeRollingFileAppender : public RollingFileAppender { + public: + DECLARE_LOG4CXX_OBJECT(SafeRollingFileAppender) + protected: + virtual void subAppend(const spi::LoggingEventPtr& event, + log4cxx::helpers::Pool& p); +}; + +} // namespace log4cxx + +#endif // SRC_PLUGINS_APPENDERS_SAFE_ROLLING_FILE_APPENDER_H_ diff --git a/src/plugins/appenders/safe_file_appender.cc b/src/plugins/appenders/safe_file_appender.cc deleted file mode 100644 index ead775a1c6..0000000000 --- a/src/plugins/appenders/safe_file_appender.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "safe_file_appender.h" - -using namespace log4cxx; -using namespace log4cxx::helpers; - -IMPLEMENT_LOG4CXX_OBJECT(SafeFileAppender) - -void SafeFileAppender::subAppend(const spi::LoggingEventPtr& event, - log4cxx::helpers::Pool& p) { - try { - WriterAppender::subAppend(event, p); - } catch (...) { - } -} diff --git a/src/plugins/appenders/safe_file_appender.h b/src/plugins/appenders/safe_file_appender.h deleted file mode 100644 index 45299602ff..0000000000 --- a/src/plugins/appenders/safe_file_appender.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_PLUGINS_APPENDERS_SAFE_FILE_APPENDER_H_ -#define SRC_PLUGINS_APPENDERS_SAFE_FILE_APPENDER_H_ - -#include - -namespace log4cxx { - -class SafeFileAppender : public FileAppender { - public: - DECLARE_LOG4CXX_OBJECT(SafeFileAppender) - protected: - virtual void subAppend(const spi::LoggingEventPtr& event, - log4cxx::helpers::Pool& p); -}; - -} // namespace log4cxx - -#endif // SRC_PLUGINS_APPENDERS_SAFE_FILE_APPENDER_H_ diff --git a/src/plugins/appenders/safe_rolling_file_appender.cc b/src/plugins/appenders/safe_rolling_file_appender.cc deleted file mode 100644 index 7ed387d5c4..0000000000 --- a/src/plugins/appenders/safe_rolling_file_appender.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "safe_rolling_file_appender.h" - -using namespace log4cxx; -using namespace log4cxx::helpers; - -IMPLEMENT_LOG4CXX_OBJECT(SafeRollingFileAppender) - -void SafeRollingFileAppender::subAppend(const spi::LoggingEventPtr& event, - log4cxx::helpers::Pool& p) { - try { - RollingFileAppenderSkeleton::subAppend(event, p); - } catch (...) { - } -} diff --git a/src/plugins/appenders/safe_rolling_file_appender.h b/src/plugins/appenders/safe_rolling_file_appender.h deleted file mode 100644 index 75832b7de7..0000000000 --- a/src/plugins/appenders/safe_rolling_file_appender.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_PLUGINS_APPENDERS_SAFE_ROLLING_FILE_APPENDER_H_ -#define SRC_PLUGINS_APPENDERS_SAFE_ROLLING_FILE_APPENDER_H_ - -#include - -namespace log4cxx { - -class SafeRollingFileAppender : public RollingFileAppender { - public: - DECLARE_LOG4CXX_OBJECT(SafeRollingFileAppender) - protected: - virtual void subAppend(const spi::LoggingEventPtr& event, - log4cxx::helpers::Pool& p); -}; - -} // namespace log4cxx - -#endif // SRC_PLUGINS_APPENDERS_SAFE_ROLLING_FILE_APPENDER_H_ diff --git a/src/plugins/appenders/src/safe_file_appender.cc b/src/plugins/appenders/src/safe_file_appender.cc new file mode 100644 index 0000000000..ead775a1c6 --- /dev/null +++ b/src/plugins/appenders/src/safe_file_appender.cc @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "safe_file_appender.h" + +using namespace log4cxx; +using namespace log4cxx::helpers; + +IMPLEMENT_LOG4CXX_OBJECT(SafeFileAppender) + +void SafeFileAppender::subAppend(const spi::LoggingEventPtr& event, + log4cxx::helpers::Pool& p) { + try { + WriterAppender::subAppend(event, p); + } catch (...) { + } +} diff --git a/src/plugins/appenders/src/safe_rolling_file_appender.cc b/src/plugins/appenders/src/safe_rolling_file_appender.cc new file mode 100644 index 0000000000..7ed387d5c4 --- /dev/null +++ b/src/plugins/appenders/src/safe_rolling_file_appender.cc @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "safe_rolling_file_appender.h" + +using namespace log4cxx; +using namespace log4cxx::helpers; + +IMPLEMENT_LOG4CXX_OBJECT(SafeRollingFileAppender) + +void SafeRollingFileAppender::subAppend(const spi::LoggingEventPtr& event, + log4cxx::helpers::Pool& p) { + try { + RollingFileAppenderSkeleton::subAppend(event, p); + } catch (...) { + } +} diff --git a/tools/cmake/helpers/install_rules.cmake b/tools/cmake/helpers/install_rules.cmake index 5aac777b03..5bb074d110 100644 --- a/tools/cmake/helpers/install_rules.cmake +++ b/tools/cmake/helpers/install_rules.cmake @@ -1,8 +1,12 @@ include(GNUInstallDirs) -set(EXPAT_INCLUDE_DIRS "${THIRD_PARTY_INSTALL_PREFIX}/include") -set(EXPAT_LIBRARIES "${THIRD_PARTY_INSTALL_PREFIX}/lib") + + +set(THIRD_PARTY_INSTALL_PREFIX "$ENV{THIRD_PARTY_INSTALL_PREFIX}") +message(STATUS "THIRD_PARTY_INSTALL_PREFIX: ${THIRD_PARTY_INSTALL_PREFIX}") + +set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}" "${THIRD_PARTY_INSTALL_PREFIX}") set(BOOST_INCLUDEDIR "${THIRD_PARTY_INSTALL_PREFIX}/include") set(BOOST_LIBRARYDIR "${THIRD_PARTY_INSTALL_PREFIX}/lib") -- cgit v1.2.1 From c00055f6332140a2c7b6b23fff73a204cfba93a0 Mon Sep 17 00:00:00 2001 From: bsolonenko Date: Thu, 22 Nov 2018 15:11:28 +0200 Subject: code style was fixed --- cmake/helpers/dependencies.cmake | 18 +++- cmake/helpers/dependencies/BSON.cmake | 47 ++++----- cmake/helpers/dependencies/apr-util.cmake | 56 ++++++----- cmake/helpers/dependencies/apr.cmake | 53 +++++----- cmake/helpers/dependencies/boost.cmake | 4 +- cmake/helpers/dependencies/boost/filesystem.cmake | 30 +++--- cmake/helpers/dependencies/boost/system.cmake | 16 +-- cmake/helpers/dependencies/boost/thread.cmake | 29 ++---- cmake/helpers/dependencies/log4cxx.cmake | 22 ++--- cmake_toolchains/Toolchain-QNX7-QCC-Base.cmake | 114 ++++++++++++++-------- src/components/utils/CMakeLists.txt | 8 +- src/plugins/appenders/CMakeLists.txt | 21 ++-- 12 files changed, 216 insertions(+), 202 deletions(-) diff --git a/cmake/helpers/dependencies.cmake b/cmake/helpers/dependencies.cmake index ce625bd607..29c2fc8737 100644 --- a/cmake/helpers/dependencies.cmake +++ b/cmake/helpers/dependencies.cmake @@ -15,16 +15,24 @@ function(SDL_find_package) list(REMOVE_ITEM ARGV REQUIRED) find_package(${ARGV} QUIET) - if(NOT ${ARGV0}_FOUND AND NOT ${ARGV0} IN_LIST buildable_dependencies) + if(NOT ${ARGV0}_FOUND + AND NOT + ${ARGV0} + IN_LIST + buildable_dependencies) if(${ARGV0}_REQUIRED) - message(FATAL_ERROR "Required package ${ARGV0} was not found and there is no " - "dependency descriptor file which can provide it.") + message( + FATAL_ERROR "Required package ${ARGV0} was not found and there is no " + "dependency descriptor file which can provide it.") endif() else() include("${dependency_descriptor_dir}/${ARGV0}.cmake") endif() if(${ARGV0}_REQUIRED AND NOT ${ARGV0}_FOUND) - message(FATAL_ERROR "Required package ${ARGV0} was missing and the dependency " - "descriptor ${dependency_descriptor_dir}/${ARGV0}.cmake did not provide it.") + message( + FATAL_ERROR + "Required package ${ARGV0} was missing and the dependency " + "descriptor ${dependency_descriptor_dir}/${ARGV0}.cmake did not provide it." + ) endif() endfunction() diff --git a/cmake/helpers/dependencies/BSON.cmake b/cmake/helpers/dependencies/BSON.cmake index 3f2d56d693..9c53e53df7 100644 --- a/cmake/helpers/dependencies/BSON.cmake +++ b/cmake/helpers/dependencies/BSON.cmake @@ -1,5 +1,4 @@ -# Copyright (c) 2018, Ford Motor Company -# All rights reserved. +# Copyright (c) 2018, Ford Motor Company All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -7,41 +6,37 @@ # Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following -# disclaimer in the documentation and/or other materials provided with the -# distribution. +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. # # Neither the name of the Ford Motor Company nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. +# may be used to endorse or promote products derived from this software without +# specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. include(FetchContent) -FetchContent_Declare( - BSON - GIT_REPOSITORY https://github.com/BSolonenko/bson_c_lib.git - GIT_TAG topic/sdl_rework -) +fetchcontent_declare(BSON + GIT_REPOSITORY + https://github.com/BSolonenko/bson_c_lib.git + GIT_TAG + topic/sdl_rework) -FetchContent_GetProperties(BSON) +fetchcontent_getproperties(BSON) if(NOT bson_POPULATED) - FetchContent_Populate(BSON) + fetchcontent_populate(BSON) add_subdirectory("${bson_SOURCE_DIR}" "${bson_BINARY_DIR}") endif() set(BSON_FOUND ON) - diff --git a/cmake/helpers/dependencies/apr-util.cmake b/cmake/helpers/dependencies/apr-util.cmake index 52eb442e85..2283f51eb7 100644 --- a/cmake/helpers/dependencies/apr-util.cmake +++ b/cmake/helpers/dependencies/apr-util.cmake @@ -3,12 +3,7 @@ if(TARGET apr-util::apr-util) return() endif() -find_path(apr-util_INCLUDE_DIR - NAMES - apu.h - PATH_SUFFIXES - include -) +find_path(apr-util_INCLUDE_DIR NAMES apu.h PATH_SUFFIXES include) if(apr-util_INCLUDE_DIR) set(apr-util_VERSION_MAJOR 0) @@ -17,27 +12,42 @@ if(apr-util_INCLUDE_DIR) if(EXISTS "${apr-util_INCLUDE_DIR}/apr-1/apu_version.h") # Read and parse apr version header file for version number - file(STRINGS "${apr-util_INCLUDE_DIR}/apr-1/apu_version.h" _apr_util_version_HEADER_CONTENTS REGEX "#define APU_[A-Z]+_VERSION[ \t]+[0-9]+") - string(REGEX REPLACE ".*#define APU_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" apr-util_VERSION_MAJOR "${_apr_util_version_HEADER_CONTENTS}") - string(REGEX REPLACE ".*#define APU_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" apr-util_VERSION_MINOR "${_apr_util_version_HEADER_CONTENTS}") - string(REGEX REPLACE ".*#define APU_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" apr-util_VERSION_PATCH "${_apr_util_version_HEADER_CONTENTS}") + file(STRINGS "${apr-util_INCLUDE_DIR}/apr-1/apu_version.h" + _apr_util_version_HEADER_CONTENTS + REGEX "#define APU_[A-Z]+_VERSION[ \t]+[0-9]+") + string(REGEX + REPLACE ".*#define APU_MAJOR_VERSION[ \t]+([0-9]+).*" + "\\1" + apr-util_VERSION_MAJOR + "${_apr_util_version_HEADER_CONTENTS}") + string(REGEX + REPLACE ".*#define APU_MINOR_VERSION[ \t]+([0-9]+).*" + "\\1" + apr-util_VERSION_MINOR + "${_apr_util_version_HEADER_CONTENTS}") + string(REGEX + REPLACE ".*#define APU_PATCH_VERSION[ \t]+([0-9]+).*" + "\\1" + apr-util_VERSION_PATCH + "${_apr_util_version_HEADER_CONTENTS}") unset(_apr_util_version_HEADER_CONTENTS) endif() - set(apr-util_VERSION_STRING "${apr-util_VERSION_MAJOR}.${apr-util_VERSION_MINOR}.${apr-util_VERSION_PATCH}") -endif () + set( + apr-util_VERSION_STRING + "${apr-util_VERSION_MAJOR}.${apr-util_VERSION_MINOR}.${apr-util_VERSION_PATCH}" + ) +endif() -find_library(apr-util_LIBRARY - NAMES - aprutil-1 - PATH_SUFFIXES - lib -) +find_library(apr-util_LIBRARY NAMES aprutil-1 PATH_SUFFIXES lib) mark_as_advanced(apr-util_INCLUDE_DIR apr-util_LIBRARY apr-util_FOUND) if(apr-util_LIBRARY AND apr-util_INCLUDE_DIR) set(apr-util_FOUND ON) - message(STATUS "Found apr-util: ${apr-util_LIBRARY} (found version \"${apr-util_VERSION_STRING}\")") + message( + STATUS + "Found apr-util: ${apr-util_LIBRARY} (found version \"${apr-util_VERSION_STRING}\")" + ) else() message(STATUS "apr-util library not found") return() @@ -45,7 +55,7 @@ endif() add_library(apr-util::apr-util UNKNOWN IMPORTED GLOBAL) set_target_properties(apr-util::apr-util - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${apr-util_INCLUDE_DIR}" - IMPORTED_LOCATION "${apr-util_LIBRARY}" -) + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${apr-util_INCLUDE_DIR}" + IMPORTED_LOCATION + "${apr-util_LIBRARY}") diff --git a/cmake/helpers/dependencies/apr.cmake b/cmake/helpers/dependencies/apr.cmake index 4ab8dcaf5f..fff1f99973 100644 --- a/cmake/helpers/dependencies/apr.cmake +++ b/cmake/helpers/dependencies/apr.cmake @@ -3,12 +3,7 @@ if(TARGET apr::apr) return() endif() -find_path(apr_INCLUDE_DIR - NAMES - apr.h - PATH_SUFFIXES - include -) +find_path(apr_INCLUDE_DIR NAMES apr.h PATH_SUFFIXES include) if(apr_INCLUDE_DIR) set(apr_VERSION_MAJOR 0) @@ -17,27 +12,39 @@ if(apr_INCLUDE_DIR) if(EXISTS "${apr_INCLUDE_DIR}/apr-1/apr_version.h") # Read and parse apr version header file for version number - file(STRINGS "${apr_INCLUDE_DIR}/apr-1/apr_version.h" _apr_version_HEADER_CONTENTS REGEX "#define APR_[A-Z]+_VERSION[ \t]+[0-9]+") - string(REGEX REPLACE ".*#define APR_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" apr_VERSION_MAJOR "${_apr_version_HEADER_CONTENTS}") - string(REGEX REPLACE ".*#define APR_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" apr_VERSION_MINOR "${_apr_version_HEADER_CONTENTS}") - string(REGEX REPLACE ".*#define APR_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" apr_VERSION_PATCH "${_apr_version_HEADER_CONTENTS}") + file(STRINGS "${apr_INCLUDE_DIR}/apr-1/apr_version.h" + _apr_version_HEADER_CONTENTS + REGEX "#define APR_[A-Z]+_VERSION[ \t]+[0-9]+") + string(REGEX + REPLACE ".*#define APR_MAJOR_VERSION[ \t]+([0-9]+).*" + "\\1" + apr_VERSION_MAJOR + "${_apr_version_HEADER_CONTENTS}") + string(REGEX + REPLACE ".*#define APR_MINOR_VERSION[ \t]+([0-9]+).*" + "\\1" + apr_VERSION_MINOR + "${_apr_version_HEADER_CONTENTS}") + string(REGEX + REPLACE ".*#define APR_PATCH_VERSION[ \t]+([0-9]+).*" + "\\1" + apr_VERSION_PATCH + "${_apr_version_HEADER_CONTENTS}") unset(_apr_version_HEADER_CONTENTS) endif() - set(apr_VERSION_STRING "${apr_VERSION_MAJOR}.${apr_VERSION_MINOR}.${apr_VERSION_PATCH}") -endif () + set(apr_VERSION_STRING + "${apr_VERSION_MAJOR}.${apr_VERSION_MINOR}.${apr_VERSION_PATCH}") +endif() -find_library(apr_LIBRARY - NAMES - apr-1 - PATH_SUFFIXES - lib -) +find_library(apr_LIBRARY NAMES apr-1 PATH_SUFFIXES lib) mark_as_advanced(apr_INCLUDE_DIR apr_LIBRARY apr_FOUND) if(apr_LIBRARY AND apr_INCLUDE_DIR) set(apr_FOUND ON) - message(STATUS "Found apr: ${apr_LIBRARY} (found version \"${apr_VERSION_STRING}\")") + message( + STATUS "Found apr: ${apr_LIBRARY} (found version \"${apr_VERSION_STRING}\")" + ) else() message(STATUS "apr library not found") return() @@ -45,7 +52,7 @@ endif() add_library(apr::apr UNKNOWN IMPORTED GLOBAL) set_target_properties(apr::apr - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${apr_INCLUDE_DIR}" - IMPORTED_LOCATION "${apr_LIBRARY}" -) + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${apr_INCLUDE_DIR}" + IMPORTED_LOCATION + "${apr_LIBRARY}") diff --git a/cmake/helpers/dependencies/boost.cmake b/cmake/helpers/dependencies/boost.cmake index a7503c54c3..2214907317 100644 --- a/cmake/helpers/dependencies/boost.cmake +++ b/cmake/helpers/dependencies/boost.cmake @@ -7,5 +7,5 @@ include("${dependency_descriptor_dir}/boost/system.cmake") include("${dependency_descriptor_dir}/boost/thread.cmake") if(boost_filesystem_FOUND AND boost_thread_FOUND AND boost_system_FOUND) - set(boost_FOUND ON) -endif() \ No newline at end of file + set(boost_FOUND ON) +endif() diff --git a/cmake/helpers/dependencies/boost/filesystem.cmake b/cmake/helpers/dependencies/boost/filesystem.cmake index 7e6923f3e5..8891a0e8bb 100644 --- a/cmake/helpers/dependencies/boost/filesystem.cmake +++ b/cmake/helpers/dependencies/boost/filesystem.cmake @@ -1,23 +1,16 @@ if(TARGET boost::filesystem) - set(boost_filesystem_FOUND ON) - return() + set(boost_filesystem_FOUND ON) + return() endif() find_path(boost_filesystem_INCLUDE_DIR - NAMES - boost/filesystem.hpp - PATH_SUFFIXES - include -) + NAMES boost/filesystem.hpp + PATH_SUFFIXES include) -find_library(boost_filesystem_LIBRARY - NAMES - boost_filesystem - PATH_SUFFIXES - lib -) +find_library(boost_filesystem_LIBRARY NAMES boost_filesystem PATH_SUFFIXES lib) -mark_as_advanced(boost_filesystem_INCLUDE_DIR boost_filesystem_LIBRARY boost_filesystem_FOUND) +mark_as_advanced(boost_filesystem_INCLUDE_DIR boost_filesystem_LIBRARY + boost_filesystem_FOUND) if(boost_filesystem_INCLUDE_DIR AND boost_filesystem_LIBRARY) set(boost_filesystem_FOUND ON) @@ -30,8 +23,7 @@ endif() add_library(boost::filesystem UNKNOWN IMPORTED GLOBAL ${boost_system_LIBRARY}) set_target_properties(boost::filesystem - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${boost_filesystem_INCLUDE_DIR}" - IMPORTED_LOCATION "${boost_filesystem_LIBRARY}" -) - + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${boost_filesystem_INCLUDE_DIR}" + IMPORTED_LOCATION + "${boost_filesystem_LIBRARY}") diff --git a/cmake/helpers/dependencies/boost/system.cmake b/cmake/helpers/dependencies/boost/system.cmake index abafcdb6f6..50b6677245 100644 --- a/cmake/helpers/dependencies/boost/system.cmake +++ b/cmake/helpers/dependencies/boost/system.cmake @@ -1,14 +1,9 @@ if(TARGET boost::system) - set(boost_system_FOUND ON) - return() + set(boost_system_FOUND ON) + return() endif() -find_library(boost_system_LIBRARY - NAMES - boost_system - PATH_SUFFIXES - lib -) +find_library(boost_system_LIBRARY NAMES boost_system PATH_SUFFIXES lib) mark_as_advanced(boost_system_LIBRARY boost_system_FOUND) @@ -24,7 +19,4 @@ endif() add_library(boost::system UNKNOWN IMPORTED GLOBAL ${boost_system_LIBRARY}) set_target_properties(boost::system - PROPERTIES - IMPORTED_LOCATION "${boost_system_LIBRARY}" -) - + PROPERTIES IMPORTED_LOCATION "${boost_system_LIBRARY}") diff --git a/cmake/helpers/dependencies/boost/thread.cmake b/cmake/helpers/dependencies/boost/thread.cmake index 7dcbf42179..ecf16abfbe 100644 --- a/cmake/helpers/dependencies/boost/thread.cmake +++ b/cmake/helpers/dependencies/boost/thread.cmake @@ -1,23 +1,14 @@ if(TARGET boost::thread) - set(boost_thread_FOUND ON) - return() + set(boost_thread_FOUND ON) + return() endif() -find_path(boost_thread_INCLUDE_DIR - NAMES - boost/thread.hpp - PATH_SUFFIXES - include -) +find_path(boost_thread_INCLUDE_DIR NAMES boost/thread.hpp PATH_SUFFIXES include) -find_library(boost_thread_LIBRARY - NAMES - boost_thread - PATH_SUFFIXES - lib -) +find_library(boost_thread_LIBRARY NAMES boost_thread PATH_SUFFIXES lib) -mark_as_advanced(boost_thread_INCLUDE_DIR boost_thread_LIBRARY boost_thread_FOUND) +mark_as_advanced(boost_thread_INCLUDE_DIR boost_thread_LIBRARY + boost_thread_FOUND) if(boost_thread_INCLUDE_DIR AND boost_thread_LIBRARY) set(boost_thread_FOUND ON) @@ -31,7 +22,7 @@ endif() add_library(boost::thread UNKNOWN IMPORTED GLOBAL) set_target_properties(boost::thread - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${boost_thread_INCLUDE_DIR}" - IMPORTED_LOCATION "${boost_thread_LIBRARY}" -) \ No newline at end of file + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${boost_thread_INCLUDE_DIR}" + IMPORTED_LOCATION + "${boost_thread_LIBRARY}") diff --git a/cmake/helpers/dependencies/log4cxx.cmake b/cmake/helpers/dependencies/log4cxx.cmake index 0a6d9d51ce..3ff6a759a1 100644 --- a/cmake/helpers/dependencies/log4cxx.cmake +++ b/cmake/helpers/dependencies/log4cxx.cmake @@ -3,19 +3,9 @@ if(TARGET log4cxx::log4cxx) return() endif() -find_path(log4cxx_INCLUDE_DIR - NAMES - log4cxx/log4cxx.h - PATH_SUFFIXES - include -) +find_path(log4cxx_INCLUDE_DIR NAMES log4cxx/log4cxx.h PATH_SUFFIXES include) -find_library(log4cxx_LIBRARY - NAMES - log4cxx - PATH_SUFFIXES - lib -) +find_library(log4cxx_LIBRARY NAMES log4cxx PATH_SUFFIXES lib) mark_as_advanced(log4cxx_INCLUDE_DIR log4cxx_LIBRARY log4cxx_FOUND) @@ -29,7 +19,7 @@ endif() add_library(log4cxx::log4cxx UNKNOWN IMPORTED GLOBAL) set_target_properties(log4cxx::log4cxx - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${log4cxx_INCLUDE_DIR}" - IMPORTED_LOCATION "${log4cxx_LIBRARY}" -) + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${log4cxx_INCLUDE_DIR}" + IMPORTED_LOCATION + "${log4cxx_LIBRARY}") diff --git a/cmake_toolchains/Toolchain-QNX7-QCC-Base.cmake b/cmake_toolchains/Toolchain-QNX7-QCC-Base.cmake index f27fc10027..c344c42231 100644 --- a/cmake_toolchains/Toolchain-QNX7-QCC-Base.cmake +++ b/cmake_toolchains/Toolchain-QNX7-QCC-Base.cmake @@ -6,54 +6,67 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "lib") set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") if(CMAKE_HOST_WIN32) - set(HOST_EXECUTABLE_SUFFIX ".exe") + set(HOST_EXECUTABLE_SUFFIX ".exe") endif() if(QNX_HOST) - set(ENV{QNX_HOST} "${QNX_HOST}") + set(ENV{QNX_HOST} "${QNX_HOST}") else() - set(QNX_HOST "$ENV{QNX_HOST}") - if("${QNX_HOST}" STREQUAL "") - message(FATAL_ERROR "QNX_HOST environment variable is not defined") - endif() - set(QNX_HOST "${QNX_HOST}" CACHE INTERNAL "") + set(QNX_HOST "$ENV{QNX_HOST}") + if("${QNX_HOST}" STREQUAL "") + message(FATAL_ERROR "QNX_HOST environment variable is not defined") + endif() + set(QNX_HOST "${QNX_HOST}" CACHE INTERNAL "") endif() message(STATUS "Using QNX_HOST ${QNX_HOST}") if(QNX_TARGET) - set(ENV{QNX_TARGET} "${QNX_TARGET}") + set(ENV{QNX_TARGET} "${QNX_TARGET}") else() - set(QNX_TARGET "$ENV{QNX_TARGET}") - if("${QNX_TARGET}" STREQUAL "") - message(FATAL_ERROR "QNX_TARGET environment variable is not defined") - endif() - set(QNX_TARGET "${QNX_TARGET}" CACHE INTERNAL "") + set(QNX_TARGET "$ENV{QNX_TARGET}") + if("${QNX_TARGET}" STREQUAL "") + message(FATAL_ERROR "QNX_TARGET environment variable is not defined") + endif() + set(QNX_TARGET "${QNX_TARGET}" CACHE INTERNAL "") endif() message(STATUS "Using QNX_TARGET ${QNX_TARGET}") if(NOT EXISTS "${QNX_TARGET}/etc/qversion") - message(FATAL_ERROR "The folder ${QNX_TARGET} is missing /etc/qversion and may not provide a QNX SDK") + message( + FATAL_ERROR + "The folder ${QNX_TARGET} is missing /etc/qversion and may not provide a QNX SDK" + ) endif() file(READ "${QNX_TARGET}/etc/qversion" CMAKE_SYSTEM_VERSION) -string(REGEX REPLACE "[^0-9.]" "" CMAKE_SYSTEM_VERSION "${CMAKE_SYSTEM_VERSION}") +string(REGEX + REPLACE "[^0-9.]" + "" + CMAKE_SYSTEM_VERSION + "${CMAKE_SYSTEM_VERSION}") if("${CMAKE_SYSTEM_VERSION}" VERSION_LESS "7.0.0") - message(FATAL_ERROR "This toolchain file is not supported for QNX ${CMAKE_SYSTEM_VERSION}") + message( + FATAL_ERROR + "This toolchain file is not supported for QNX ${CMAKE_SYSTEM_VERSION}") else() - message(STATUS "QNX Version is ${CMAKE_SYSTEM_VERSION}") + message(STATUS "QNX Version is ${CMAKE_SYSTEM_VERSION}") endif() -# Since we are passing while crosscompilation CMAKE_FIND_ROOT_PATH(containing QNX third party dependencies) -# as command line argument to cmake we have to take it into account when setting CMAKE_FIND_ROOT_PATH -# variable below. -# ${QNX_TARGET}/usr contains platform independent headers. -# But QNX_TARGET is a root directory containing sysroots for different0 platforms. -# Therefore to avoid passing overall QNX_TARGET as root path to search just for 'usr' directory -# ${QNX_TARGET}/usr passed instead. -set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}" "${QNX_TARGET}/${QNX_TARGET_ARCH_DIR}" "${QNX_TARGET}/usr") -# Since CMAKE_TOOLCHAIN_FILE behaviour does NOT suppose any 'append' operations like setting -# CMAKE_FIND_ROOT_PATH above and CMAKE_TOOLCHAIN_FILE must provide the same environment independently -# of how often and how many times it calls remove duplicates in CMAKE_FIND_ROOT_PATH. +# Since we are passing while crosscompilation CMAKE_FIND_ROOT_PATH(containing +# QNX third party dependencies) as command line argument to cmake we have to +# take it into account when setting CMAKE_FIND_ROOT_PATH variable below. +# ${QNX_TARGET}/usr contains platform independent headers. But QNX_TARGET is a +# root directory containing sysroots for different0 platforms. Therefore to +# avoid passing overall QNX_TARGET as root path to search just for 'usr' +# directory ${QNX_TARGET}/usr passed instead. +set(CMAKE_FIND_ROOT_PATH + "${CMAKE_FIND_ROOT_PATH}" + "${QNX_TARGET}/${QNX_TARGET_ARCH_DIR}" + "${QNX_TARGET}/usr") +# Since CMAKE_TOOLCHAIN_FILE behaviour does NOT suppose any 'append' operations +# like setting CMAKE_FIND_ROOT_PATH above and CMAKE_TOOLCHAIN_FILE must provide +# the same environment independently of how often and how many times it calls +# remove duplicates in CMAKE_FIND_ROOT_PATH. list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) @@ -61,19 +74,42 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_C_COMPILER "${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX gcc Program") -set(CMAKE_CXX_COMPILER "${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX g++ Program") -set(CMAKE_AR "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ar${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ar Program") -set(CMAKE_RANLIB "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ranlib Program") -set(CMAKE_NM "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-nm${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX nm Program") -set(CMAKE_OBJCOPY "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objcopy${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objcopy Program") -set(CMAKE_OBJDUMP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objdump${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objdump Program") -set(CMAKE_LINKER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Linker Program") -set(CMAKE_STRIP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-strip${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Strip Program") +set(CMAKE_C_COMPILER "${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX gcc Program") +set(CMAKE_CXX_COMPILER "${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX g++ Program") +set( + CMAKE_AR + "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ar${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX ar Program") +set( + CMAKE_RANLIB + "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX ranlib Program") +set( + CMAKE_NM + "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-nm${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX nm Program") +set( + CMAKE_OBJCOPY + "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objcopy${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX objcopy Program") +set( + CMAKE_OBJDUMP + "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objdump${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX objdump Program") +set( + CMAKE_LINKER + "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX Linker Program") +set( + CMAKE_STRIP + "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-strip${HOST_EXECUTABLE_SUFFIX}" + CACHE PATH "QNX Strip Program") # Will only add -V if compiler name is "qcc" -set(CMAKE_C_COMPILER_TARGET ${QNX_QCC_ARCH} CACHE INTERNAL "") +set(CMAKE_C_COMPILER_TARGET ${QNX_QCC_ARCH} CACHE INTERNAL "") set(CMAKE_CXX_COMPILER_TARGET ${QNX_QCC_ARCH} CACHE INTERNAL "") -set(CMAKE_C_FLAGS_INIT "-lang-c") +set(CMAKE_C_FLAGS_INIT "-lang-c") set(CMAKE_CXX_FLAGS_INIT "-lang-c++") diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt index 98def35265..f1b14ccc50 100644 --- a/src/components/utils/CMakeLists.txt +++ b/src/components/utils/CMakeLists.txt @@ -39,10 +39,10 @@ if(QNXNTO) endif() if(ENABLE_LOG) - SDL_find_package(apr REQUIRED) - SDL_find_package(apr-util REQUIRED) - SDL_find_package(log4cxx REQUIRED) - SDL_find_package(boost REQUIRED) + sdl_find_package(apr REQUIRED) + sdl_find_package(apr-util REQUIRED) + sdl_find_package(log4cxx REQUIRED) + sdl_find_package(boost REQUIRED) find_package(EXPAT REQUIRED) diff --git a/src/plugins/appenders/CMakeLists.txt b/src/plugins/appenders/CMakeLists.txt index a2b42e8fed..7735908d31 100644 --- a/src/plugins/appenders/CMakeLists.txt +++ b/src/plugins/appenders/CMakeLists.txt @@ -34,24 +34,17 @@ add_library(${PROJECT_NAME} SHARED) add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) target_sources(${PROJECT_NAME} - PRIVATE - "${CMAKE_CURRENT_LIST_DIR}/src/safe_file_appender.cc" - "${CMAKE_CURRENT_LIST_DIR}/src/safe_rolling_file_appender.cc" -) + PRIVATE + "${CMAKE_CURRENT_LIST_DIR}/src/safe_file_appender.cc" + "${CMAKE_CURRENT_LIST_DIR}/src/safe_rolling_file_appender.cc") target_include_directories(${PROJECT_NAME} - PUBLIC - "${CMAKE_CURRENT_LIST_DIR}/include" - "${THIRD_PARTY_INSTALL_PREFIX}/include" -) + PUBLIC "${CMAKE_CURRENT_LIST_DIR}/include" + "${THIRD_PARTY_INSTALL_PREFIX}/include") -SDL_find_package(log4cxx REQUIRED) +sdl_find_package(log4cxx REQUIRED) -target_link_libraries(${PROJECT_NAME} - PUBLIC - EXPAT::EXPAT - log4cxx::log4cxx -) +target_link_libraries(${PROJECT_NAME} PUBLIC EXPAT::EXPAT log4cxx::log4cxx) install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}" -- cgit v1.2.1