aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-03-31 20:10:48 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-03-31 20:10:48 +0300
commit4d20bc9c99ba1b25b171e6c9f9bb831e23d0ff14 (patch)
treedccaefedbbcc7985bc000f44ae760191b6422b83
parentcmake: use install_pdbs() (diff)
downloadwinapi-utf8-4d20bc9c99ba1b25b171e6c9f9bb831e23d0ff14.tar.gz
winapi-utf8-4d20bc9c99ba1b25b171e6c9f9bb831e23d0ff14.zip
add `make build`, `make test`, etc.
Diffstat (limited to '')
-rw-r--r--.github/workflows/ci.yml13
-rw-r--r--.gitignore1
-rw-r--r--Makefile84
-rw-r--r--README.md15
4 files changed, 104 insertions, 9 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b5d2c04..930b5fb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -40,6 +40,7 @@ jobs:
PLATFORM: '${{ matrix.platform }}'
CONFIGURATION: '${{ matrix.configuration }}'
BOOST_VERSION: 1.72.0
+ CMAKE_FLAGS: -D WINAPI_UTF8_TESTS=ON
defaults:
run:
shell: pwsh
@@ -58,20 +59,14 @@ jobs:
platform: '${{ matrix.platform }}'
if: matrix.toolset == 'mingw'
- name: Build Boost
- run: |
- cd cmake
- python -m project.ci.boost -- --with-test
+ run: make deps
- name: Build
- run: |
- cd cmake
- python -m project.ci.cmake --install -- -D WINAPI_UTF8_TESTS=ON
+ run: make install
- name: Upload binaries
uses: actions/upload-artifact@v2
with:
name: 'winapi-utf8-${{ matrix.os }}-${{ matrix.toolset }}-${{ matrix.platform }}-${{ matrix.configuration }}'
path: '${{ runner.workspace }}/build/install/'
- name: Test
- run: |
- cd ../build/cmake
- ctest -C '${{ env.CONFIGURATION }}' --verbose
+ run: make test
if: runner.os == 'Windows'
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0e03e15
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/.build/
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2bda0a4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,84 @@
+# Various one-liners which I'm too lazy to remember.
+# Basically a collection of really small shell scripts.
+
+MAKEFLAGS += --no-builtin-rules --no-builtin-variables --warn-undefined-variables
+unexport MAKEFLAGS
+.DEFAULT_GOAL := all
+.DELETE_ON_ERROR:
+.SUFFIXES:
+SHELL := bash
+.SHELLFLAGS := -eu -o pipefail -c
+
+.PHONY: DO
+DO:
+
+escape = $(subst ','\'',$(1))
+
+define noexpand
+ifeq ($$(origin $(1)),environment)
+ $(1) := $$(value $(1))
+endif
+ifeq ($$(origin $(1)),environment override)
+ $(1) := $$(value $(1))
+endif
+ifeq ($$(origin $(1)),command line)
+ override $(1) := $$(value $(1))
+endif
+endef
+
+TOOLSET ?= mingw
+CONFIGURATION ?= Debug
+BOOST_VERSION ?= 1.72.0
+BOOST_LIBRARIES := --with-test
+CMAKE_FLAGS ?= -D WINAPI_UTF8_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
+boost_dir := $(build_dir)/boost
+cmake_dir := $(build_dir)/cmake
+DESTDIR ?= $(build_dir)/install
+
+$(eval $(call noexpand,TOOLSET))
+$(eval $(call noexpand,CONFIGURATION))
+$(eval $(call noexpand,BOOST_VERSION))
+$(eval $(call noexpand,CMAKE_FLAGS))
+$(eval $(call noexpand,DESTDIR))
+
+.PHONY: all
+all: build
+
+.PHONY: clean
+clean:
+ rm -rf -- '$(call escape,$(build_dir))'
+
+$(boost_dir)/:
+ cd cmake && python3 -m project.boost.download --cache '$(call escape,$(build_dir))' -- '$(call escape,$(BOOST_VERSION))' '$(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))' --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 --toolset '$(call escape,$(TOOLSET))' --configuration '$(call escape,$(CONFIGURATION))' --build '$(call escape,$(cmake_dir))' --install '$(call escape,$(DESTDIR))' --boost '$(call escape,$(boost_dir))' -- '$(call escape,$(src_dir))' $(CMAKE_FLAGS)
+endif
+
+.PHONY: install
+install: build
+
+.PHONY: test
+test:
+ cd -- '$(call escape,$(cmake_dir))' && ctest -C '$(call escape,$(CONFIGURATION))' --verbose
diff --git a/README.md b/README.md
index 6897188..42cc23f 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,21 @@ winapi-utf8
UTF-8 <-> UTF-16 conversion functions, mainly to be used with WinAPI.
+Development
+-----------
+
+Build using CMake.
+Depends on Boost.Test.
+The project is Windows-only, so building with either MSVC or MinGW-w64 is
+required.
+
+There's a Makefile with useful shortcuts to build the project in the .build/
+directory (defaults to building with MinGW-w64):
+
+ make deps
+ make build
+ make test
+
License
-------