Skip to content

Add Windows artifact build using Linux cross compile #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Linux C/C++ CI

on:
push:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: qt
run: sudo apt install premake4 qt5-qmake qtbase5-dev libqt5svg5-dev
- name: admesh
run: git clone https://github.com/udif/admesh.git && cd admesh && ./autogen.sh && ./configure && make && sudo make install
- name: stlsplit
run: git clone https://github.com/admesh/stlsplit && cd stlsplit && premake4 gmake && make && sudo cp stlsplit.h /usr/local/include && sudo cp -P build/libstlsplit.so* /usr/local/lib && sudo ldconfig
- name: qmake
run: qmake
- name: make
run: make

74 changes: 74 additions & 0 deletions .github/workflows/windows-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Windows C/C++ CI

on:
push:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name : mxe repo
run: >
sudo apt-get update &&
sudo apt-get install software-properties-common lsb-release && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9 &&
sudo add-apt-repository "deb [arch=amd64] https://pkg.mxe.cc/repos/apt `lsb_release -sc` main" &&
sudo apt-get update

- name: qt_windows_x64
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
- name: admesh
run: >
export PATH=/usr/lib/mxe/usr/bin:$PATH &&
sudo mkdir -p /usr/mxe-x86-64-w64-mingw32.static &&
git clone https://github.com/admesh/admesh.git &&
cd admesh && pwd &&
./autogen.sh && ./configure --host=x86_64-w64-mingw32.static --prefix=/usr/mxe-x86-64-w64-mingw32.static &&
make &&
mkdir -p ../release && cp -p .libs/libadmesh-1.dll ../release &&
sudo make install

- name: stlsplit
run: >
export PKG_CONFIG_PATH_x86_64_w64_mingw32_static=/usr/mxe-x86-64-w64-mingw32.static/lib/pkgconfig &&
export PATH=/usr/lib/mxe/usr/bin:$PATH &&
git clone https://github.com/udif/stlsplit &&
cd stlsplit && git checkout pr_staticlib &&
premake4 gmake config=release64 &&
export CXX=/usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-g++ &&
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" &&
sudo /usr/bin/install -c -m 644 build/libstlsplit.a /usr/mxe-x86-64-w64-mingw32.static/lib &&
sudo mkdir -p /usr/mxe-x86-64-w64-mingw32.static/include/stlsplit &&
sudo /usr/bin/install -c -m 644 stlsplit.h /usr/mxe-x86-64-w64-mingw32.static/include/stlsplit

- name: qmake
run: >
export PATH=/usr/lib/mxe/usr/bin:$PATH &&
export PKG_CONFIG_PATH_x86_64_w64_mingw32_static=/usr/mxe-x86-64-w64-mingw32.static/lib/pkgconfig &&
export CFLAGS1="$(x86_64-w64-mingw32.static-pkg-config libadmesh --cflags)" &&
export CXXFLAGS=`printf "%s %s%s" ${CFLAGS1} ${CFLAGS1} '/stlsplit'`
export LDFLAGS="$(x86_64-w64-mingw32.static-pkg-config libadmesh --libs) " &&
/usr/lib/mxe/usr/x86_64-w64-mingw32.static/qt5/bin/qmake

- name: make
run: export PATH=/usr/lib/mxe/usr/bin:$PATH && make

- name: Declare some variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"

- name: upload windows
uses: actions/upload-artifact@v2
with:
name: admeshgui-${{ steps.vars.outputs.sha_short }}
path: |
release/admeshgui.exe
release/libadmesh-1.dll

6 changes: 5 additions & 1 deletion ADMeshGUI.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 4) {
error(ADMeshGUI requires Qt 5.4 to run. Older version detected.)
}

QMAKE_CXXFLAGS += $$(CXXFLAGS)
QMAKE_CFLAGS += $$(CFLAGS)
QMAKE_LFLAGS += $$(LDFLAGS)

TARGET = admeshgui
TEMPLATE = app

Expand Down Expand Up @@ -56,7 +60,7 @@ macx {
}

win32 {
LIBS += -lintl -liconv
LIBS += -lintl -liconv -lopengl32 -ladmesh.dll
RC_FILE = admeshgui.rc
}

Expand Down
2 changes: 1 addition & 1 deletion admeshgui.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
IDI_ICON1 ICON DISCARDABLE "Resources/admeshgui.ico"
IDI_ICON1 ICON DISCARDABLE "Distribution/admeshgui.ico"