add support for mingw64 build
This commit is contained in:
parent
eda132ee7d
commit
c7cc152dc4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
build/
|
||||
mingw-w64-x86_64-xz/
|
||||
|
8
Makefile
8
Makefile
@ -1,7 +1,7 @@
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
CFLAGS=-O3
|
||||
CXXFLAGS=-O3
|
||||
CFLAGS=$(MINGWPATHS) -O3
|
||||
CXXFLAGS=-std=c++17 $(MINGWPATHS) -O3
|
||||
DEPS = src/compress.h src/stringutils.h
|
||||
LIBS=-llzma
|
||||
OBJECTS = build/compress.o build/stringutils.o
|
||||
@ -17,11 +17,11 @@ build/%.o: src/%.c $(DEPS)
|
||||
|
||||
build/%.o: src/%.cpp $(DEPS)
|
||||
$(MAKE_BUILD_FOLDER)
|
||||
$(CXX) -c -o $@ $< $(CFLAGS)
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
||||
|
||||
build/compress_measurements: $(OBJECTS) src/compress_measurements.cpp
|
||||
$(MAKE_BUILD_FOLDER)
|
||||
$(CXX) -o $@ $^ $(LIBS) $(CFLAGS)
|
||||
$(CXX) -static -o $@ $^ $(LIBS) $(CXXFLAGS)
|
||||
|
||||
clean:
|
||||
-rm -rf build
|
||||
|
6
build-linux.sh
Executable file
6
build-linux.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
make clean
|
||||
make
|
40
build-windows.sh
Executable file
40
build-windows.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
XZ_DIR="mingw-w64-x86_64-xz"
|
||||
XZ_PACKAGE_VERSION_FILE="${XZ_DIR}/version"
|
||||
XZ_PACKAGE_VERSION="mingw-w64-x86_64-xz-5.2.5-2-any.pkg.tar.zst"
|
||||
|
||||
if [ -f "${XZ_DIR}/version" ]; then
|
||||
XZ_PACKAGE_INSTALLED_VERSION=$(<$XZ_PACKAGE_VERSION_FILE)
|
||||
else
|
||||
XZ_PACKAGE_INSTALLED_VERSION=""
|
||||
fi
|
||||
|
||||
if [ "${XZ_PACKAGE_VERSION}" != "${XZ_PACKAGE_INSTALLED_VERSION}" ]; then
|
||||
rm -rf ${XZ_DIR}
|
||||
mkdir ${XZ_DIR}
|
||||
(cd mingw-w64-x86_64-xz && \
|
||||
wget -qO- https://mirror.msys2.org/mingw/mingw64/${XZ_PACKAGE_VERSION} | \
|
||||
unzstd - | \
|
||||
tar -xf -)
|
||||
echo ${XZ_PACKAGE_VERSION} > ${XZ_PACKAGE_VERSION_FILE}
|
||||
fi
|
||||
|
||||
export MINGWPATHS="-Imingw-w64-x86_64-xz/mingw64/include -Lmingw-w64-x86_64-xz/mingw64/lib"
|
||||
|
||||
case "$(uname -s)" in
|
||||
Linux)
|
||||
export CC="x86_64-w64-mingw32-gcc"
|
||||
export CXX="x86_64-w64-mingw32-g++"
|
||||
;;
|
||||
|
||||
MINGW*)
|
||||
export CC="gcc"
|
||||
export CXX="g++"
|
||||
;;
|
||||
esac
|
||||
|
||||
make clean
|
||||
make
|
Loading…
Reference in New Issue
Block a user