Skip to content

Commit b2b1eb7

Browse files
committed
feat: [Makefile] Support g++ min version, cygwin
Update README.
1 parent aff3412 commit b2b1eb7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ Coding guidelines
4949
Build & test
5050
------------
5151

52+
This repository requires Gnu g++ compiler minimum version 13 to support C++20
53+
features such as `std::format()` used in code.
54+
5255
This repository uses Gnu Makefile to run build and test tasks along with some
5356
helper tasks such as to run formatter, linter for source code.
5457

58+
Build is tested and tests are verified on Gnu/Linux & Cygwin (Windows)
59+
operating systems.
60+
5561
### Examples
5662

5763
```bash

cpp/Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,25 @@ all: tests check
88
# ============================================================================
99
include ../mk/common.mk
1010

11-
CXX = /usr/bin/g++-13
11+
CXX = /usr/bin/g++
12+
MIN_GPP_VERSION=13
13+
GPP_VERSION:=$(shell $(CXX) -dumpfullversion | cut -d. -f1)
14+
CHECK_GPP_VERSION:=$(shell expr "$(GPP_VERSION)" ">=" "$(MIN_GPP_VERSION)")
15+
16+
ifneq "$(CHECK_GPP_VERSION)" "1"
17+
$(error ERROR: $(CXX) version $(GPP_VERSION) is lower than required \
18+
minimum version $(MIN_GPP_VERSION))
19+
endif
20+
1221
CXXFLAGS = -std=c++20 -Wall -Wextra -Wpedantic -Werror -Iincludes
1322

23+
SYS_NAME:=$(shell uname -s)
24+
IS_CYGWIN:=$(findstring CYGWIN, $(SYS_NAME))
25+
26+
ifeq ($(IS_CYGWIN), CYGWIN)
27+
CXXFLAGS += -static-libstdc++
28+
endif
29+
1430
BUILD_DIR:=build
1531

1632
HDRS:=$(shell $(GIT_LS) -- 'includes/*.h')

0 commit comments

Comments
 (0)