[buildcore] Reduce commands in normal Make run, fix vcpkg
This commit is contained in:
parent
986c76a476
commit
9b644fef4a
75
deps/buildcore/base.mk
vendored
75
deps/buildcore/base.mk
vendored
@ -14,7 +14,18 @@ else
|
|||||||
BC_VAR_OS=$(shell uname | tr [:upper:] [:lower:])
|
BC_VAR_OS=$(shell uname | tr [:upper:] [:lower:])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef BC_USE_DOCKER_DEVENV
|
ifneq ($(shell which python3 2> /dev/null),)
|
||||||
|
BC_CMD_HOST_PY3=python3
|
||||||
|
else
|
||||||
|
ifeq ($(shell python -c 'import sys; print(sys.version_info[0])'),3)
|
||||||
|
BC_CMD_HOST_PY3=python
|
||||||
|
else
|
||||||
|
echo 'Please install Python3 on host'
|
||||||
|
exit 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef BC_VAR_USE_DOCKER_DEVENV
|
||||||
ifneq ($(shell which docker 2> /dev/null),)
|
ifneq ($(shell which docker 2> /dev/null),)
|
||||||
BC_VAR_DEVENV=devenv$(shell pwd | sed 's/\//-/g')
|
BC_VAR_DEVENV=devenv$(shell pwd | sed 's/\//-/g')
|
||||||
BC_VAR_DEVENV_IMAGE=${BC_VAR_PROJECT_NAME}-devenv
|
BC_VAR_DEVENV_IMAGE=${BC_VAR_PROJECT_NAME}-devenv
|
||||||
@ -22,22 +33,24 @@ ifdef BC_USE_DOCKER_DEVENV
|
|||||||
BC_CMD_ENVRUN=docker exec -i -t --user $(shell id -u ${USER}) ${BC_VAR_DEVENV}
|
BC_CMD_ENVRUN=docker exec -i -t --user $(shell id -u ${USER}) ${BC_VAR_DEVENV}
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
ifneq ($(shell ${BC_CMD_ENVRUN} which python3 2> /dev/null),)
|
||||||
|
BC_CMD_PY3=${BC_CMD_ENVRUN} python3
|
||||||
ifneq ($(shell ${BC_CMD_ENVRUN} which python3 2> /dev/null),)
|
|
||||||
BC_PY3=${BC_CMD_ENVRUN} python3
|
|
||||||
else
|
|
||||||
ifeq ($(shell ${BC_CMD_ENVRUN} python -c 'import sys; print(sys.version_info[0])'),3)
|
|
||||||
BC_PY3=${BC_CMD_ENVRUN} python
|
|
||||||
else
|
else
|
||||||
echo 'Please install Python3'
|
ifeq ($(shell ${BC_CMD_ENVRUN} python -c 'import sys; print(sys.version_info[0])'),3)
|
||||||
|
BC_CMD_PY3=${BC_CMD_ENVRUN} python
|
||||||
|
else
|
||||||
|
echo 'Please install Python3 in devenv'
|
||||||
exit 1
|
exit 1
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
BC_CMD_PY3=${BC_CMD_HOST_PY3}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BC_VAR_SCRIPTS=${BUILDCORE_PATH}/scripts
|
BC_VAR_SCRIPTS=${BUILDCORE_PATH}/scripts
|
||||||
BC_CMD_SETUP_BUILD=${BC_PY3} ${BC_VAR_SCRIPTS}/setup-build.py
|
BC_CMD_SETUP_BUILD=${BC_CMD_PY3} ${BC_VAR_SCRIPTS}/setup-build.py
|
||||||
BC_CMD_PYBB=${BC_PY3} ${BC_VAR_SCRIPTS}/pybb.py
|
BC_CMD_PYBB=${BC_CMD_PY3} ${BC_VAR_SCRIPTS}/pybb.py
|
||||||
|
BC_CMD_HOST_PYBB=${BC_CMD_HOST_PY3} ${BC_VAR_SCRIPTS}/pybb.py
|
||||||
BC_CMD_CMAKE_BUILD=${BC_CMD_PYBB} cmake-build
|
BC_CMD_CMAKE_BUILD=${BC_CMD_PYBB} cmake-build
|
||||||
BC_CMD_GETENV=${BC_CMD_PYBB} getenv
|
BC_CMD_GETENV=${BC_CMD_PYBB} getenv
|
||||||
BC_CMD_CTEST=${BC_CMD_PYBB} ctest-all
|
BC_CMD_CTEST=${BC_CMD_PYBB} ctest-all
|
||||||
@ -45,10 +58,20 @@ BC_CMD_RM_RF=${BC_CMD_PYBB} rm
|
|||||||
BC_CMD_MKDIR_P=${BC_CMD_PYBB} mkdir
|
BC_CMD_MKDIR_P=${BC_CMD_PYBB} mkdir
|
||||||
BC_CMD_CAT=${BC_CMD_PYBB} cat
|
BC_CMD_CAT=${BC_CMD_PYBB} cat
|
||||||
BC_CMD_DEBUGGER=${BC_CMD_PYBB} debug
|
BC_CMD_DEBUGGER=${BC_CMD_PYBB} debug
|
||||||
|
BC_CMD_HOST_DEBUGGER=${BC_CMD_HOST_PYBB} debug
|
||||||
BC_VAR_HOSTENV=$(shell ${BC_CMD_ENVRUN} ${BC_CMD_PYBB} hostenv)
|
BC_VAR_HOSTENV=$(shell ${BC_CMD_ENVRUN} ${BC_CMD_PYBB} hostenv)
|
||||||
BC_VAR_BUILD_PATH=build
|
BC_VAR_BUILD_PATH=build
|
||||||
BC_VAR_CURRENT_BUILD=$(BC_VAR_HOSTENV)-$(shell ${BC_CMD_ENVRUN} ${BC_CMD_CAT} .current_build)
|
BC_VAR_CURRENT_BUILD=$(BC_VAR_HOSTENV)-$(shell ${BC_CMD_ENVRUN} ${BC_CMD_CAT} .current_build)
|
||||||
|
|
||||||
|
ifdef BC_VAR_USE_VCPKG
|
||||||
|
ifndef BC_VAR_VCPKG_DIR_BASE
|
||||||
|
BC_VAR_VCPKG_DIR_BASE=.vcpkg
|
||||||
|
endif
|
||||||
|
ifndef BC_VAR_VCPKG_VERSION
|
||||||
|
BC_VAR_VCPKG_VERSION=2023.08.09
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
${BC_CMD_CMAKE_BUILD} ${BC_VAR_BUILD_PATH}
|
${BC_CMD_CMAKE_BUILD} ${BC_VAR_BUILD_PATH}
|
||||||
@ -75,7 +98,7 @@ test-verbose: build
|
|||||||
test-rerun-verbose: build
|
test-rerun-verbose: build
|
||||||
${BC_CMD_CTEST} ${BC_VAR_BUILD_PATH} --rerun-failed --output-on-failure
|
${BC_CMD_CTEST} ${BC_VAR_BUILD_PATH} --rerun-failed --output-on-failure
|
||||||
|
|
||||||
ifdef BC_USE_DOCKER_DEVENV
|
ifdef BC_VAR_USE_DOCKER_DEVENV
|
||||||
.PHONY: devenv-image
|
.PHONY: devenv-image
|
||||||
devenv-image:
|
devenv-image:
|
||||||
docker build . -t ${BC_VAR_DEVENV_IMAGE}
|
docker build . -t ${BC_VAR_DEVENV_IMAGE}
|
||||||
@ -102,24 +125,18 @@ devenv-shell:
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef BC_USE_VCPKG
|
ifdef BC_VAR_USE_VCPKG
|
||||||
|
|
||||||
ifndef BC_VCPKG_DIR_BASE
|
BC_VAR_VCPKG_TOOLCHAIN=--toolchain=${BC_VAR_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake
|
||||||
BC_VCPKG_DIR_BASE=.vcpkg
|
BC_VAR_VCPKG_DIR=$(BC_VAR_VCPKG_DIR_BASE)/$(BC_VAR_VCPKG_VERSION)-$(BC_VAR_HOSTENV)
|
||||||
endif
|
|
||||||
ifndef BC_VCPKG_VERSION
|
|
||||||
BC_VCPKG_VERSION=2023.08.09
|
|
||||||
endif
|
|
||||||
BC_VCPKG_TOOLCHAIN=--toolchain=${BC_VAR_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake
|
|
||||||
BC_VAR_VCPKG_DIR=$(BC_VCPKG_DIR_BASE)/$(BC_VCPKG_VERSION)-$(BC_VAR_HOSTENV)
|
|
||||||
|
|
||||||
.PHONY: vcpkg
|
.PHONY: vcpkg
|
||||||
vcpkg: ${BC_VAR_VCPKG_DIR} vcpkg-install
|
vcpkg: ${BC_VAR_VCPKG_DIR} vcpkg-install
|
||||||
|
|
||||||
${BC_VAR_VCPKG_DIR}:
|
${BC_VAR_VCPKG_DIR}:
|
||||||
${BC_CMD_RM_RF} ${BC_VAR_VCPKG_DIR}
|
${BC_CMD_RM_RF} ${BC_VAR_VCPKG_DIR}
|
||||||
${BC_CMD_PYBB} mkdir ${BC_VCPKG_DIR_BASE}
|
${BC_CMD_PYBB} mkdir ${BC_VAR_VCPKG_DIR_BASE}
|
||||||
${BC_CMD_ENVRUN} git clone -b release --depth 1 --branch ${BC_VCPKG_VERSION} https://github.com/microsoft/vcpkg.git ${BC_VAR_VCPKG_DIR}
|
${BC_CMD_ENVRUN} git clone -b release --depth 1 --branch ${BC_VAR_VCPKG_VERSION} https://github.com/microsoft/vcpkg.git ${BC_VAR_VCPKG_DIR}
|
||||||
ifneq (${BC_VAR_OS},windows)
|
ifneq (${BC_VAR_OS},windows)
|
||||||
${BC_CMD_ENVRUN} ${BC_VAR_VCPKG_DIR}/bootstrap-vcpkg.sh
|
${BC_CMD_ENVRUN} ${BC_VAR_VCPKG_DIR}/bootstrap-vcpkg.sh
|
||||||
else
|
else
|
||||||
@ -129,9 +146,9 @@ endif
|
|||||||
.PHONY: vcpkg-install
|
.PHONY: vcpkg-install
|
||||||
vcpkg-install:
|
vcpkg-install:
|
||||||
ifneq (${BC_VAR_OS},windows)
|
ifneq (${BC_VAR_OS},windows)
|
||||||
${BC_CMD_ENVRUN} ${BC_VAR_VCPKG_DIR}/vcpkg install ${BC_VCPKG_PKGS}
|
${BC_CMD_ENVRUN} ${BC_VAR_VCPKG_DIR}/vcpkg install ${BC_VAR_VCPKG_PKGS}
|
||||||
else
|
else
|
||||||
${BC_CMD_ENVRUN} ${BC_VAR_VCPKG_DIR}/vcpkg install --triplet x64-windows ${BC_VCPKG_PKGS}
|
${BC_CMD_ENVRUN} ${BC_VAR_VCPKG_DIR}/vcpkg install --triplet x64-windows ${BC_VAR_VCPKG_PKGS}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else ifdef USE_CONAN # USE_VCPKG / USE_CONAN ####################################
|
else ifdef USE_CONAN # USE_VCPKG / USE_CONAN ####################################
|
||||||
@ -155,18 +172,18 @@ endif # USE_CONAN ###############################################
|
|||||||
ifeq (${BC_VAR_OS},darwin)
|
ifeq (${BC_VAR_OS},darwin)
|
||||||
.PHONY: configure-xcode
|
.PHONY: configure-xcode
|
||||||
configure-xcode:
|
configure-xcode:
|
||||||
${BC_CMD_SETUP_BUILD} ${BC_VCPKG_TOOLCHAIN} --build_tool=xcode --current_build=0 --build_root=${BC_VAR_BUILD_PATH}
|
${BC_CMD_SETUP_BUILD} ${BC_VAR_VCPKG_TOOLCHAIN} --build_tool=xcode --current_build=0 --build_root=${BC_VAR_BUILD_PATH}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: configure-release
|
.PHONY: configure-release
|
||||||
configure-release:
|
configure-release:
|
||||||
${BC_CMD_SETUP_BUILD} ${BC_VCPKG_TOOLCHAIN} --build_type=release --build_root=${BC_VAR_BUILD_PATH}
|
${BC_CMD_SETUP_BUILD} ${BC_VAR_VCPKG_TOOLCHAIN} --build_type=release --build_root=${BC_VAR_BUILD_PATH}
|
||||||
|
|
||||||
.PHONY: configure-debug
|
.PHONY: configure-debug
|
||||||
configure-debug:
|
configure-debug:
|
||||||
${BC_CMD_SETUP_BUILD} ${BC_VCPKG_TOOLCHAIN} --build_type=debug --build_root=${BC_VAR_BUILD_PATH}
|
${BC_CMD_SETUP_BUILD} ${BC_VAR_VCPKG_TOOLCHAIN} --build_type=debug --build_root=${BC_VAR_BUILD_PATH}
|
||||||
|
|
||||||
.PHONY: configure-asan
|
.PHONY: configure-asan
|
||||||
configure-asan:
|
configure-asan:
|
||||||
${BC_CMD_SETUP_BUILD} ${BC_VCPKG_TOOLCHAIN} --build_type=asan --build_root=${BC_VAR_BUILD_PATH}
|
${BC_CMD_SETUP_BUILD} ${BC_VAR_VCPKG_TOOLCHAIN} --build_type=asan --build_root=${BC_VAR_BUILD_PATH}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user