From 4e6e8d8c151c9eb7888927e816dc3756a600ec0f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 4 Jul 2023 03:23:13 +0200 Subject: update cmake-common Also, change the build directory to build/. --- .github/workflows/ci.yml | 4 ++-- .gitignore | 2 +- CMakeLists.txt | 5 +---- Makefile | 23 +++++++---------------- README.md | 2 +- client/Dockerfile | 2 +- cmake | 2 +- server/Dockerfile | 2 +- 8 files changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fd12a7..65ff40e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - name: Cache Boost uses: actions/cache@v3 with: - path: '${{ runner.workspace }}/build/boost_*.tar.gz' + path: './build/boost_*.tar.gz' key: 'boost_${{ env.BOOST_VERSION }}' - name: Build Boost run: make deps @@ -64,7 +64,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: 'math-server-${{ matrix.toolset }}-${{ matrix.platform }}-${{ matrix.configuration }}' - path: '${{ runner.workspace }}/build/install/' + path: './build/install/' if-no-files-found: error - name: Test run: make test diff --git a/.gitignore b/.gitignore index 0e03e15..84c048a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/.build/ +/build/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 027f3ec..84c4552 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) # for C++17 +cmake_minimum_required(VERSION 3.8) project(math_server CXX) enable_testing() -# C++17 is mandatory: -set(CC_CXX_STANDARD 17) - include(cmake/common.cmake) # AppVeyor builds w/ Visual Studio 2017 bombard me with stupid warnings otherwise: diff --git a/Makefile b/Makefile index d933134..a9f6a2a 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ DO: PROJECT := math-server TOOLSET ?= auto +PLATFORM ?= auto CONFIGURATION ?= Debug BOOST_VERSION ?= 1.72.0 BOOST_LIBRARIES := --with-filesystem --with-program_options --with-regex --with-test @@ -12,11 +13,7 @@ CMAKE_FLAGS ?= -D MATH_SERVER_TESTS=ON this_dir := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) src_dir := $(this_dir) -ifdef CI -build_dir := $(this_dir)../build -else -build_dir := $(this_dir).build -endif +build_dir := $(this_dir)build boost_dir := $(build_dir)/boost cmake_dir := $(build_dir)/cmake DESTDIR ?= $(build_dir)/install @@ -27,6 +24,7 @@ DOCKER_PLATFORMS := amd64,armhf,arm64 DOCKER_USERNAME := egortensin $(eval $(call noexpand,TOOLSET)) +$(eval $(call noexpand,PLATFORM)) $(eval $(call noexpand,CONFIGURATION)) $(eval $(call noexpand,BOOST_VERSION)) $(eval $(call noexpand,CMAKE_FLAGS)) @@ -50,34 +48,27 @@ $(boost_dir)/: '$(call escape,$(boost_dir))' .PHONY: deps -ifdef CI -deps: - cd cmake && python3 -m project.ci.boost -- $(BOOST_LIBRARIES) -else deps: $(boost_dir)/ cd cmake && python3 -m project.boost.build \ --toolset '$(call escape,$(TOOLSET))' \ + --platform '$(call escape,$(PLATFORM))' \ --configuration '$(call escape,$(CONFIGURATION))' \ -- \ '$(call escape,$(boost_dir))' \ $(BOOST_LIBRARIES) -endif .PHONY: build build: -ifdef CI - cd cmake && python3 -m project.ci.cmake --install -- $(CMAKE_FLAGS) -else - cd cmake && python3 -m project.cmake.build \ + cd cmake && python3 -m project.build \ --toolset '$(call escape,$(TOOLSET))' \ + --platform '$(call escape,$(PLATFORM))' \ --configuration '$(call escape,$(CONFIGURATION))' \ - --build '$(call escape,$(cmake_dir))' \ --install '$(call escape,$(DESTDIR))' \ --boost '$(call escape,$(boost_dir))' \ -- \ '$(call escape,$(src_dir))' \ + '$(call escape,$(cmake_dir))' \ $(CMAKE_FLAGS) -endif .PHONY: install install: build diff --git a/README.md b/README.md index 641d0e8..b056330 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Development Build using CMake. Depends on Boost.{Filesystem,Program_options,Regex,Test}. -There's a Makefile with useful shortcuts to build the project in the .build/ +There's a Makefile with useful shortcuts to build the project in the build/ directory along with the dependencies: make deps diff --git a/client/Dockerfile b/client/Dockerfile index 6927dcb..2d4e0a3 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -20,7 +20,7 @@ FROM base LABEL maintainer="Egor Tensin " ARG src_dir -COPY --from=builder ["$src_dir/.build/install", "/opt/math-server"] +COPY --from=builder ["$src_dir/build/install", "/opt/math-server"] RUN runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \ apk add -q --no-cache $runtime_deps && \ diff --git a/cmake b/cmake index b230fff..23a96df 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit b230fffce638cdac8837ba9d9d343d9a93cef2ee +Subproject commit 23a96df0cedd7236fbd70087c8e3ee12b222040e diff --git a/server/Dockerfile b/server/Dockerfile index d64f251..a76bb72 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -20,7 +20,7 @@ FROM base LABEL maintainer="Egor Tensin " ARG src_dir -COPY --from=builder ["$src_dir/.build/install", "/opt/math-server"] +COPY --from=builder ["$src_dir/build/install", "/opt/math-server"] RUN runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \ apk add -q --no-cache $runtime_deps && \ -- cgit v1.2.3