added MinGW to CI and fixed local MinGW build (#3826)
This commit is contained in:
parent
9582032906
commit
aaa4425d90
|
@ -16,7 +16,7 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-2019]
|
os: [windows-2019]
|
||||||
arch: [x64, x86]
|
arch: [x64, x86]
|
||||||
fail-fast: true
|
fail-fast: false
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Some convenient links:
|
||||||
|
# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
|
||||||
|
#
|
||||||
|
|
||||||
|
name: CI-mingw
|
||||||
|
|
||||||
|
on: [push,pull_request]
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: cmd
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_mingw:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [windows-2019]
|
||||||
|
arch: [x64] # TODO: fix x86 build?
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up MinGW
|
||||||
|
uses: egor-tensin/setup-mingw@v2
|
||||||
|
with:
|
||||||
|
platform: ${{ matrix.arch }}
|
||||||
|
|
||||||
|
- name: Build cppcheck
|
||||||
|
run: |
|
||||||
|
mingw32-make -j2
|
||||||
|
|
||||||
|
- name: Build test
|
||||||
|
run: |
|
||||||
|
mingw32-make -j2 testrunner
|
||||||
|
|
||||||
|
- name: Run test
|
||||||
|
run: |
|
||||||
|
mingw32-make -j2 check
|
38
Makefile
38
Makefile
|
@ -20,7 +20,9 @@ ifeq ($(SRCDIR),build)
|
||||||
endif
|
endif
|
||||||
ifeq ($(MATCHCOMPILER),yes)
|
ifeq ($(MATCHCOMPILER),yes)
|
||||||
# Find available Python interpreter
|
# Find available Python interpreter
|
||||||
|
ifndef PYTHON_INTERPRETER
|
||||||
PYTHON_INTERPRETER := $(shell which python3)
|
PYTHON_INTERPRETER := $(shell which python3)
|
||||||
|
endif
|
||||||
ifndef PYTHON_INTERPRETER
|
ifndef PYTHON_INTERPRETER
|
||||||
PYTHON_INTERPRETER := $(shell which python)
|
PYTHON_INTERPRETER := $(shell which python)
|
||||||
endif
|
endif
|
||||||
|
@ -49,11 +51,15 @@ RDYNAMIC=-rdynamic
|
||||||
ifndef COMSPEC
|
ifndef COMSPEC
|
||||||
ifdef ComSpec
|
ifdef ComSpec
|
||||||
#### ComSpec is defined on some WIN32's.
|
#### ComSpec is defined on some WIN32's.
|
||||||
COMSPEC=$(ComSpec)
|
WINNT=1
|
||||||
|
|
||||||
|
ifneq (,$(findstring /cygdrive/,$(PATH)))
|
||||||
|
CYGWIN=1
|
||||||
|
endif # CYGWIN
|
||||||
endif # ComSpec
|
endif # ComSpec
|
||||||
endif # COMSPEC
|
endif # COMSPEC
|
||||||
|
|
||||||
ifdef COMSPEC
|
ifdef WINNT
|
||||||
#### Maybe Windows
|
#### Maybe Windows
|
||||||
ifndef CPPCHK_GLIBCXX_DEBUG
|
ifndef CPPCHK_GLIBCXX_DEBUG
|
||||||
CPPCHK_GLIBCXX_DEBUG=
|
CPPCHK_GLIBCXX_DEBUG=
|
||||||
|
@ -64,7 +70,7 @@ ifdef COMSPEC
|
||||||
else
|
else
|
||||||
RDYNAMIC=-lshlwapi
|
RDYNAMIC=-lshlwapi
|
||||||
endif
|
endif
|
||||||
else # !COMSPEC
|
else # !WINNT
|
||||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||||
|
|
||||||
ifeq ($(uname_S),Linux)
|
ifeq ($(uname_S),Linux)
|
||||||
|
@ -79,17 +85,16 @@ else # !COMSPEC
|
||||||
endif # !CPPCHK_GLIBCXX_DEBUG
|
endif # !CPPCHK_GLIBCXX_DEBUG
|
||||||
endif # GNU/kFreeBSD
|
endif # GNU/kFreeBSD
|
||||||
|
|
||||||
endif # COMSPEC
|
endif # WINNT
|
||||||
|
|
||||||
# Set the UNDEF_STRICT_ANSI flag to address compile time warnings
|
ifdef CYGWIN
|
||||||
# with tinyxml2 and Cygwin.
|
# Set the UNDEF_STRICT_ANSI flag to address compile time warnings
|
||||||
ifdef COMSPEC
|
# with tinyxml2 and Cygwin.
|
||||||
uname_S := $(shell uname -s)
|
|
||||||
|
|
||||||
ifneq (,$(findstring CYGWIN,$(uname_S)))
|
|
||||||
UNDEF_STRICT_ANSI=-U__STRICT_ANSI__
|
UNDEF_STRICT_ANSI=-U__STRICT_ANSI__
|
||||||
endif # CYGWIN
|
|
||||||
endif # COMSPEC
|
# Increase stack size for Cygwin builds to avoid segmentation fault in limited recursive tests.
|
||||||
|
CXXFLAGS+=-Wl,--stack,8388608
|
||||||
|
endif # CYGWIN
|
||||||
|
|
||||||
ifndef CXX
|
ifndef CXX
|
||||||
CXX=g++
|
CXX=g++
|
||||||
|
@ -102,15 +107,6 @@ ifndef CXXFLAGS
|
||||||
CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar $(CPPCHK_GLIBCXX_DEBUG) -g
|
CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar $(CPPCHK_GLIBCXX_DEBUG) -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Increase stack size for Cygwin builds to avoid segmentation fault in limited recursive tests.
|
|
||||||
ifdef COMSPEC
|
|
||||||
uname_S := $(shell uname -s)
|
|
||||||
|
|
||||||
ifneq (,$(findstring CYGWIN,$(uname_S)))
|
|
||||||
CXXFLAGS+=-Wl,--stack,8388608
|
|
||||||
endif # CYGWIN
|
|
||||||
endif # COMSPEC
|
|
||||||
|
|
||||||
ifeq (g++, $(findstring g++,$(CXX)))
|
ifeq (g++, $(findstring g++,$(CXX)))
|
||||||
override CXXFLAGS += -std=c++0x
|
override CXXFLAGS += -std=c++0x
|
||||||
else ifeq (clang++, $(findstring clang++,$(CXX)))
|
else ifeq (clang++, $(findstring clang++,$(CXX)))
|
||||||
|
|
12
readme.md
12
readme.md
|
@ -204,7 +204,17 @@ g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Ilib -Iexternals -Iexternals/sim
|
||||||
### MinGW
|
### MinGW
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mingw32-make LDFLAGS=-lshlwapi
|
mingw32-make
|
||||||
|
```
|
||||||
|
|
||||||
|
If you encounter the following error with `MATCHCOMPILER=yes` you need to specify your Python interpreter via `PYTHON_INTERPRETER`.
|
||||||
|
|
||||||
|
```
|
||||||
|
process_begin: CreateProcess(NULL, which python3, ...) failed.
|
||||||
|
makefile:24: pipe: No error
|
||||||
|
process_begin: CreateProcess(NULL, which python, ...) failed.
|
||||||
|
makefile:27: pipe: No error
|
||||||
|
makefile:30: *** Did not find a Python interpreter. Stop.
|
||||||
```
|
```
|
||||||
|
|
||||||
### Other Compiler/IDE
|
### Other Compiler/IDE
|
||||||
|
|
|
@ -117,7 +117,7 @@ g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Iexternals -Iexternals/simplecpp
|
||||||
### MinGW
|
### MinGW
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mingw32-make LDFLAGS=-lshlwapi
|
mingw32-make
|
||||||
```
|
```
|
||||||
|
|
||||||
### その他のコンパイラ/IDE
|
### その他のコンパイラ/IDE
|
||||||
|
|
|
@ -254,7 +254,9 @@ int main(int argc, char **argv)
|
||||||
<< "endif\n";
|
<< "endif\n";
|
||||||
fout << "ifeq ($(MATCHCOMPILER),yes)\n"
|
fout << "ifeq ($(MATCHCOMPILER),yes)\n"
|
||||||
<< " # Find available Python interpreter\n"
|
<< " # Find available Python interpreter\n"
|
||||||
|
<< " ifndef PYTHON_INTERPRETER\n"
|
||||||
<< " PYTHON_INTERPRETER := $(shell which python3)\n"
|
<< " PYTHON_INTERPRETER := $(shell which python3)\n"
|
||||||
|
<< " endif\n"
|
||||||
<< " ifndef PYTHON_INTERPRETER\n"
|
<< " ifndef PYTHON_INTERPRETER\n"
|
||||||
<< " PYTHON_INTERPRETER := $(shell which python)\n"
|
<< " PYTHON_INTERPRETER := $(shell which python)\n"
|
||||||
<< " endif\n"
|
<< " endif\n"
|
||||||
|
@ -287,11 +289,15 @@ int main(int argc, char **argv)
|
||||||
<< "ifndef COMSPEC\n"
|
<< "ifndef COMSPEC\n"
|
||||||
<< " ifdef ComSpec\n"
|
<< " ifdef ComSpec\n"
|
||||||
<< " #### ComSpec is defined on some WIN32's.\n"
|
<< " #### ComSpec is defined on some WIN32's.\n"
|
||||||
<< " COMSPEC=$(ComSpec)\n"
|
<< " WINNT=1\n"
|
||||||
|
<< "\n"
|
||||||
|
<< " ifneq (,$(findstring /cygdrive/,$(PATH)))\n"
|
||||||
|
<< " CYGWIN=1\n"
|
||||||
|
<< " endif # CYGWIN\n"
|
||||||
<< " endif # ComSpec\n"
|
<< " endif # ComSpec\n"
|
||||||
<< "endif # COMSPEC\n"
|
<< "endif # COMSPEC\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "ifdef COMSPEC\n"
|
<< "ifdef WINNT\n"
|
||||||
<< " #### Maybe Windows\n"
|
<< " #### Maybe Windows\n"
|
||||||
<< " ifndef CPPCHK_GLIBCXX_DEBUG\n"
|
<< " ifndef CPPCHK_GLIBCXX_DEBUG\n"
|
||||||
<< " CPPCHK_GLIBCXX_DEBUG=\n"
|
<< " CPPCHK_GLIBCXX_DEBUG=\n"
|
||||||
|
@ -302,7 +308,7 @@ int main(int argc, char **argv)
|
||||||
<< " else\n"
|
<< " else\n"
|
||||||
<< " RDYNAMIC=-lshlwapi\n"
|
<< " RDYNAMIC=-lshlwapi\n"
|
||||||
<< " endif\n"
|
<< " endif\n"
|
||||||
<< "else # !COMSPEC\n"
|
<< "else # !WINNT\n"
|
||||||
<< " uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n"
|
<< " uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< " ifeq ($(uname_S),Linux)\n"
|
<< " ifeq ($(uname_S),Linux)\n"
|
||||||
|
@ -317,19 +323,18 @@ int main(int argc, char **argv)
|
||||||
<< " endif # !CPPCHK_GLIBCXX_DEBUG\n"
|
<< " endif # !CPPCHK_GLIBCXX_DEBUG\n"
|
||||||
<< " endif # GNU/kFreeBSD\n"
|
<< " endif # GNU/kFreeBSD\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "endif # COMSPEC\n"
|
<< "endif # WINNT\n"
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
// tinymxl2 requires __STRICT_ANSI__ to be undefined to compile under CYGWIN.
|
// tinymxl2 requires __STRICT_ANSI__ to be undefined to compile under CYGWIN.
|
||||||
fout << "# Set the UNDEF_STRICT_ANSI flag to address compile time warnings\n"
|
fout << "ifdef CYGWIN\n"
|
||||||
<< "# with tinyxml2 and Cygwin.\n"
|
<< " # Set the UNDEF_STRICT_ANSI flag to address compile time warnings\n"
|
||||||
<< "ifdef COMSPEC\n"
|
<< " # with tinyxml2 and Cygwin.\n"
|
||||||
<< " uname_S := $(shell uname -s)\n"
|
|
||||||
<< "\n"
|
|
||||||
<< " ifneq (,$(findstring CYGWIN,$(uname_S)))\n"
|
|
||||||
<< " UNDEF_STRICT_ANSI=-U__STRICT_ANSI__\n"
|
<< " UNDEF_STRICT_ANSI=-U__STRICT_ANSI__\n"
|
||||||
<< " endif # CYGWIN\n"
|
<< " \n"
|
||||||
<< "endif # COMSPEC\n"
|
<< " # Increase stack size for Cygwin builds to avoid segmentation fault in limited recursive tests.\n"
|
||||||
|
<< " CXXFLAGS+=-Wl,--stack,8388608\n"
|
||||||
|
<< "endif # CYGWIN\n"
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
// skip "-D_GLIBCXX_DEBUG" if clang, since it breaks the build
|
// skip "-D_GLIBCXX_DEBUG" if clang, since it breaks the build
|
||||||
|
@ -374,16 +379,6 @@ int main(int argc, char **argv)
|
||||||
"-g");
|
"-g");
|
||||||
}
|
}
|
||||||
|
|
||||||
fout << "# Increase stack size for Cygwin builds to avoid segmentation fault in limited recursive tests.\n"
|
|
||||||
<< "ifdef COMSPEC\n"
|
|
||||||
<< " uname_S := $(shell uname -s)\n"
|
|
||||||
<< "\n"
|
|
||||||
<< " ifneq (,$(findstring CYGWIN,$(uname_S)))\n"
|
|
||||||
<< " CXXFLAGS+=-Wl,--stack,8388608\n"
|
|
||||||
<< " endif # CYGWIN\n"
|
|
||||||
<< "endif # COMSPEC\n"
|
|
||||||
<< "\n";
|
|
||||||
|
|
||||||
fout << "ifeq (g++, $(findstring g++,$(CXX)))\n"
|
fout << "ifeq (g++, $(findstring g++,$(CXX)))\n"
|
||||||
<< " override CXXFLAGS += -std=c++0x\n"
|
<< " override CXXFLAGS += -std=c++0x\n"
|
||||||
<< "else ifeq (clang++, $(findstring clang++,$(CXX)))\n"
|
<< "else ifeq (clang++, $(findstring clang++,$(CXX)))\n"
|
||||||
|
|
Loading…
Reference in New Issue