Skip to content

Commit 7d84d33

Browse files
committed
Initial build file for windows cross compile
1 parent d51072d commit 7d84d33

File tree

3 files changed

+80
-2
lines changed

3 files changed

+80
-2
lines changed

.github/workflows/windows-x64.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Windows C/C++ CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [ master ]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name : mxe repo
16+
run: >
17+
sudo apt-get update &&
18+
sudo apt-get install software-properties-common lsb-release && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9 &&
19+
sudo add-apt-repository "deb [arch=amd64] https://pkg.mxe.cc/repos/apt `lsb_release -sc` main" &&
20+
sudo apt-get update
21+
22+
- name: qt_windows_x64
23+
run: sudo apt-get install mxe-x86-64-w64-mingw32.static-gcc mxe-x86-64-w64-mingw32.static-binutils premake4 qt5-qmake mxe-x86-64-w64-mingw32.static-qtbase mxe-x86-64-w64-mingw32.static-qtsvg
24+
- name: admesh
25+
run: >
26+
export PATH=/usr/lib/mxe/usr/bin:$PATH &&
27+
sudo mkdir -p /usr/mxe-x86-64-w64-mingw32.static &&
28+
git clone https://github.com/udif/admesh.git &&
29+
cd admesh && pwd &&
30+
./autogen.sh && ./configure --host=x86_64-w64-mingw32.static --prefix=/usr/mxe-x86-64-w64-mingw32.static &&
31+
make &&
32+
mkdir -p ../release && cp -p .libs/libadmesh-1.dll ../release &&
33+
sudo make install
34+
35+
- name: stlsplit
36+
run: >
37+
export PKG_CONFIG_PATH_x86_64_w64_mingw32_static=/usr/mxe-x86-64-w64-mingw32.static/lib/pkgconfig &&
38+
export PATH=/usr/lib/mxe/usr/bin:$PATH &&
39+
git clone https://github.com/udif/stlsplit &&
40+
cd stlsplit && git checkout pr_staticlib &&
41+
premake4 gmake config=release64 &&
42+
export CXX=/usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-g++ &&
43+
make -f static-lib.make INCLUDES="-I/usr/mxe-x86-64-w64-mingw32.static/include $(x86_64-w64-mingw32.static-pkg-config libadmesh --cflags)" LIBS="$(x86_64-w64-mingw32.static-pkg-config libadmesh --libs) -ladmesh" &&
44+
sudo /usr/bin/install -c -m 644 build/libstlsplit.a /usr/mxe-x86-64-w64-mingw32.static/lib &&
45+
sudo mkdir -p /usr/mxe-x86-64-w64-mingw32.static/include/stlsplit &&
46+
sudo /usr/bin/install -c -m 644 stlsplit.h /usr/mxe-x86-64-w64-mingw32.static/include/stlsplit
47+
48+
- name: qmake
49+
run: >
50+
export PATH=/usr/lib/mxe/usr/bin:$PATH &&
51+
export PKG_CONFIG_PATH_x86_64_w64_mingw32_static=/usr/mxe-x86-64-w64-mingw32.static/lib/pkgconfig &&
52+
export CFLAGS1="$(x86_64-w64-mingw32.static-pkg-config libadmesh --cflags)" &&
53+
export CXXFLAGS=`printf "%s %s%s" ${CFLAGS1} ${CFLAGS1} '/stlsplit'`
54+
export LDFLAGS="$(x86_64-w64-mingw32.static-pkg-config libadmesh --libs) " &&
55+
/usr/lib/mxe/usr/x86_64-w64-mingw32.static/qt5/bin/qmake
56+
57+
- name: make
58+
run: export PATH=/usr/lib/mxe/usr/bin:$PATH && make
59+
60+
- name: Declare some variables
61+
id: vars
62+
shell: bash
63+
run: |
64+
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
65+
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
66+
67+
- name: upload windows
68+
uses: actions/upload-artifact@v2
69+
with:
70+
name: admeshgui-${{ steps.vars.outputs.sha_short }}
71+
path: |
72+
release/admeshgui.exe
73+
release/libadmesh-1.dll
74+

ADMeshGUI.pro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 4) {
1717
error(ADMeshGUI requires Qt 5.4 to run. Older version detected.)
1818
}
1919

20+
QMAKE_CXXFLAGS += $$(CXXFLAGS)
21+
QMAKE_CFLAGS += $$(CFLAGS)
22+
QMAKE_LFLAGS += $$(LDFLAGS)
23+
2024
TARGET = admeshgui
2125
TEMPLATE = app
2226

@@ -56,7 +60,7 @@ macx {
5660
}
5761

5862
win32 {
59-
LIBS += -lintl -liconv
63+
LIBS += -lintl -liconv -lopengl32 -ladmesh.dll
6064
RC_FILE = admeshgui.rc
6165
}
6266

admeshgui.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
IDI_ICON1 ICON DISCARDABLE "Resources/admeshgui.ico"
1+
IDI_ICON1 ICON DISCARDABLE "Distribution/admeshgui.ico"

0 commit comments

Comments
 (0)