From b51a0e6f54d1218de7123e1f104f97a844df1918 Mon Sep 17 00:00:00 2001 From: GitLab Runner Date: Thu, 11 Jan 2024 02:49:12 +0300 Subject: [PATCH] Generated export autocommit from mamba.ru --- .dockerignore | 22 ++++++++++++ CMakeLists.txt | 4 ++- Dockerfile | 10 ++++++ Makefile | 26 +++++++++----- cmake/install.cmake | 58 ++++++++++++++++++++++++++++++ config/CMakeLists.txt | 43 ++++++++++++++++++++++ config/projectConfig.cmake.in | 7 ++++ config/version.hpp.in | 7 ++++ config/version.yml.in | 4 +++ package/CMakeLists.txt | 8 ++--- utilites/matchmaker/CMakeLists.txt | 2 +- version.yml | 4 +++ 12 files changed, 180 insertions(+), 15 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 cmake/install.cmake create mode 100644 config/CMakeLists.txt create mode 100644 config/projectConfig.cmake.in create mode 100644 config/version.hpp.in create mode 100644 config/version.yml.in create mode 100644 version.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..cfe40703 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,22 @@ +*_build.counter +*build_info.h +*~ +*.kdev4 +*.pyc +.cproject +.project +*.o +*/debug +*/release +*/build +build +.tup +*.kch +autom4te.cache +*.deps +CMakeFiles +CMakeCache.txt +*.kate-swp +*build_info.h +config.h +docs diff --git a/CMakeLists.txt b/CMakeLists.txt index a774c019..a8819006 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10) -project(wfc_jsonrpc) +project(wfc_jsonrpc VERSION "0.9.8") include(cmake/ci.cmake) @@ -15,3 +15,5 @@ if ( BUILD_TESTING ) enable_testing() add_subdirectory(tests) endif() + +include(cmake/install.cmake) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d9da7d81 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM debian +ENV LANG ru_RU.UTF-8 +ENV TZ="Europe/Moscow" +RUN apt update +RUN apt -y install g++ cmake git wget make +COPY . /prj +WORKDIR "/prj" +RUN make release +RUN make install +RUN rm -rf /prj diff --git a/Makefile b/Makefile index 57daa9a1..064334d1 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ help: @echo " make shared" @echo " make static" @echo " make release" - @echo " make install" @echo " make tests" @echo " make doc" @echo " make cppcheck" @@ -16,12 +15,18 @@ help: @echo " make clean" @echo " make update" @echo " make upgrade" + @echo " make install" + @echo " make docker-build" + @echo " make docker-run" + @echo " make docker-rm" @echo "Example:" @echo " make static " @echo " make shared VERBOSE=1 ARGS=-j5" @echo " BUILD_SHARED_LIBS=ON make tests" + @echo " make install ARGS=\"--prefix ./build/test-install\"" CMAKE ?= cmake +PRJ = `basename ${PWD}` doc: rm -rf docs @@ -36,6 +41,10 @@ init: runup ./external/cmake-ci/scripts/after_make.sh cppcheck: runup ./external/cmake-ci/scripts/cppcheck-ci.sh +release: runup + cd build && ${CMAKE} .. -DDISABLE_WARNINGS=ON + ${CMAKE} --build ./build -- $(or ${ARGS},-j4) + ./external/cmake-ci/scripts/after_make.sh static: runup cd build && ${CMAKE} .. -DBUILD_SHARED_LIBS=OFF -DDISABLE_WARNINGS=ON ${CMAKE} --build ./build -- $(or ${ARGS},-j4) @@ -44,13 +53,6 @@ shared: runup cd build && ${CMAKE} .. -DBUILD_SHARED_LIBS=ON -DDISABLE_WARNINGS=ON ${CMAKE} --build ./build -- $(or ${ARGS},-j4) ./external/cmake-ci/scripts/after_make.sh -release: runup - cd build && ${CMAKE} .. -DDISABLE_WARNINGS=ON - ${CMAKE} --build ./build -- $(or ${ARGS},-j4) - ./external/cmake-ci/scripts/after_make.sh -install: runup - cd build && ${CMAKE} .. -DDISABLE_WARNINGS=ON - ${CMAKE} --install ./build tests: runup cd build && ${CMAKE} .. -DBUILD_TESTING=ON ${CMAKE} --build ./build -- $(or ${ARGS},-j4) @@ -86,3 +88,11 @@ update: runup ./external/cmake-ci/scripts/update.sh upgrade: update ./external/cmake-ci/scripts/upgrade.sh +install: runup + ${CMAKE} --install ./build ${ARGS} +docker-build: + docker build -t ${PRJ} -f Dockerfile.build . +docker-run: + docker run --rm -it ${PRJ} +docker-rm: + docker rmi ${PRJ} diff --git a/cmake/install.cmake b/cmake/install.cmake new file mode 100644 index 00000000..63a3964d --- /dev/null +++ b/cmake/install.cmake @@ -0,0 +1,58 @@ +set(VERSION_MAJOR "${${PROJECT_NAME}_VERSION_MAJOR}") +set(VERSION_MINOR "${${PROJECT_NAME}_VERSION_MINOR}") +set(VERSION_PATCH "${${PROJECT_NAME}_VERSION_PATCH}") + +message(STATUS "${PROJECT_VERSION}: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") + +if ( IS_DIRECTORY ${PROJECT_NAME} ) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config/version.hpp.in" + "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.hpp" ) +endif() + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config/version.yml.in" + "${CMAKE_CURRENT_SOURCE_DIR}/version.yml" ) + + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) + +set(package_config_destination ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) + +configure_package_config_file( + ${CMAKE_CURRENT_LIST_DIR}/../config/projectConfig.cmake.in ${PROJECT_NAME}Config.cmake + INSTALL_DESTINATION ${package_config_destination} +) +write_basic_package_version_file( + ${PROJECT_NAME}ConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion +) + +install( + EXPORT ${PROJECT_NAME}Targets + DESTINATION ${package_config_destination} +) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + DESTINATION ${package_config_destination} +) + +install( + TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}Targets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) + +if ( IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${PROJECT_NAME} ) + install( + DIRECTORY ${PROJECT_SOURCE_DIR}/${PROJECT_NAME} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/" + PATTERN *.hpp + ) +endif() + diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt new file mode 100644 index 00000000..6929670e --- /dev/null +++ b/config/CMakeLists.txt @@ -0,0 +1,43 @@ +project(config) + +INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) +INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) +INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) + +CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_RT_LIB) +CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_FUNC) + +check_include_file("sys/time.h" HAVE_SYS_TIME_H) +check_include_file("sys/resource.h" HAVE_SYS_RESORCE_H) +check_include_file("sys/timeb.h" HAVE_SYS_TIMEB_H) + +check_include_file("unistd.h" HAVE_UNISTD_H) +check_include_file("io.h" HAVE_IO_H) +check_include_file("Windows.h" HAVE_WINDOWS_H) + + +set( + CMAKE_REQUIRED_INCLUDES + ${CMAKE_REQUIRED_INCLUDES} + "sys/time.h" + "sys/resource.h" + "sys/timeb.h" + "unistd.h" + "io.h" + "Windows.h" +) + +check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY_FUNC) +check_function_exists("socket" HAVE_SOCKET_FUNC) +check_function_exists("ftime" HAVE_FTIME_FUNC) +check_function_exists("_ftime" HAVE__FTIME_FUNC) +check_function_exists("_ftime32_s" HAVE__FTIME_S_FUNC) +check_function_exists("_ftime64_s" HAVE__FTIME_S_FUNC) +check_function_exists("isatty" HAVE_ISATTY_FUNC) +check_function_exists("_isatty" HAVE__ISATTY_FUNC) +check_function_exists("getrusage" HAVE_GETRUSAGE_FUNC) +check_function_exists("usleep" HAVE_USLEEP_FUNC) +check_function_exists("clock_gettime" HAVE_CLOCK_GETTIME_FUNC) + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../config/config.h.in" + "${CMAKE_CURRENT_SOURCE_DIR}/../fas/system/config.h" ) diff --git a/config/projectConfig.cmake.in b/config/projectConfig.cmake.in new file mode 100644 index 00000000..34ebca51 --- /dev/null +++ b/config/projectConfig.cmake.in @@ -0,0 +1,7 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") + +check_required_components(@PROJECT_NAME@) + +add_library(fas::testing ALIAS fas_testing) diff --git a/config/version.hpp.in b/config/version.hpp.in new file mode 100644 index 00000000..73347c7c --- /dev/null +++ b/config/version.hpp.in @@ -0,0 +1,7 @@ +#pragma once + +#define PROJECT_NAME "@PROJECT_NAME@" +#define VERSION_MAJOR "@VERSION_MAJOR@" +#define VERSION_MINOR "@VERSION_MINOR@" +#define VERSION_PATCH "@VERSION_PATCH@" + diff --git a/config/version.yml.in b/config/version.yml.in new file mode 100644 index 00000000..0f4d652f --- /dev/null +++ b/config/version.yml.in @@ -0,0 +1,4 @@ +variables: + RELEASE_TAG: "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@" + RELEASE_BRANCH: "release-@VERSION_MAJOR@.@VERSION_MINOR@" + diff --git a/package/CMakeLists.txt b/package/CMakeLists.txt index f150bddd..b352c928 100644 --- a/package/CMakeLists.txt +++ b/package/CMakeLists.txt @@ -50,12 +50,10 @@ add_library(wfc_jsonrpc ${wfc_jsonrpc_source_list}) wci_targets(wfc_jsonrpc) enable_stat(wfc_jsonrpc) -target_include_directories(wfc_jsonrpc PUBLIC ${wfc_jsonrpc_SOURCE_DIR}) -target_include_directories(wfc_jsonrpc PUBLIC ${wfc_jsonrpc_SOURCE_DIR}/package/backlog) +target_include_directories(wfc_jsonrpc PUBLIC $) +target_include_directories(wfc_jsonrpc PUBLIC $) target_compile_definitions(wfc_jsonrpc PRIVATE -DBOOST_ASIO_NO_DEPRECATED) -target_link_libraries(wfc_jsonrpc PUBLIC matchmaker wfc ) +target_link_libraries(wfc_jsonrpc PUBLIC $ wfc ) build_info(TARGET wfc_jsonrpc PREFIX jsonrpc) - -install(TARGETS wfc_jsonrpc DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/utilites/matchmaker/CMakeLists.txt b/utilites/matchmaker/CMakeLists.txt index d85dec6b..b49045e4 100644 --- a/utilites/matchmaker/CMakeLists.txt +++ b/utilites/matchmaker/CMakeLists.txt @@ -16,5 +16,5 @@ wci_utils(matchmaker) get_boost(regex) target_link_libraries(matchmaker PRIVATE wjson Boost::regex) -target_include_directories(matchmaker PUBLIC "${wfc_jsonrpc_SOURCE_DIR}/utilites") +target_include_directories(matchmaker PUBLIC $) set_target_properties(matchmaker PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/version.yml b/version.yml new file mode 100644 index 00000000..90e78316 --- /dev/null +++ b/version.yml @@ -0,0 +1,4 @@ +variables: + RELEASE_TAG: "0.9.8" + RELEASE_BRANCH: "release-0.9" +