forked from tcobbs/ldview
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (135 loc) · 6.51 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Build, check and LDView
# Trevor SANDY <[email protected]>
# Last Update: September 10, 2024
# Copyright (C) 2022 - 2024 by Trevor SANDY
#
name: Build LDView
on:
push:
branches:
- lpub3d-build
jobs:
build-linux:
# if: ${{ false }} # uncomment to disable
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Work Paths
run: |
echo "LDRAWDIR=${HOME}/ldraw" >> ${GITHUB_ENV}
echo "LDV_DIST_DIR=lpub3d_linux_3rdparty" >> ${GITHUB_ENV}
echo "LDV_DIST_DIR_CREATE=${HOME}/work/ldview/ldview/lpub3d_linux_3rdparty" >> ${GITHUB_ENV}
- name: Development Packages
run: |
echo "Install development packages..."
$(cd QT; sed -e '/libqt4-dev/d' -e '/qt6-base-dev/d' -e '/^#Qt/d' -e '/qtbase5/s/^#//' -i debian/control)
chmod a+x QT/docker/install-devel-packages.sh && sudo ./QT/docker/install-devel-packages.sh
- name: Cache LDraw
id: cache-ldraw
uses: actions/cache@v4
with:
path: ${{ env.LDRAWDIR }}
key: ldraw-lib
- name: LDraw Library
run: |
if [ ! -d ${LDRAWDIR}/parts ]; then
echo "LDraw library not found at ${LDRAWDIR}. Downloading library..."
curl -s -O https://library.ldraw.org/library/updates/complete.zip
unzip -d ~/ -q complete.zip; rm complete.zip
if test -d ${LDRAWDIR}; then echo "LDraw library extracted, LDRAWDIR defined."; fi
else
echo "LDraw library defined at ${LDRAWDIR}."
fi
- name: Stdlib Patch
run: |
echo "Apply stdlib error patch to LDViewGlobal.pri..."
sed s/' # detect system libraries paths'/' # Suppress fatal error: stdlib.h: No such file or directory\n QMAKE_CFLAGS_ISYSTEM = -I\n\n # detect system libraries paths'/ -i LDViewGlobal.pri
- name: Build LDView
run: |
if [ ! -d "${LDV_DIST_DIR_CREATE}" ]; then mkdir -p "${LDV_DIST_DIR_CREATE}" && echo "${LDV_DIST_DIR_CREATE} created."; fi
qmake -v; $(cd QT ; sed -i 's/kdelibs5-dev, //g' debian/control)
qmake CONFIG+=3RD_PARTY_INSTALL=../${LDV_DIST_DIR} CONFIG+=release CONFIG+=BUILD_CUI_ONLY CONFIG+=USE_SYSTEM_LIBS CONFIG+=BUILD_CHECK
make && make install
build-windows:
# if: ${{ false }} # uncomment to disable
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Work Paths
run: |
Echo "LP3D_DIST_DIR_PATH=$(Join-Path (resolve-path ..\) 'lpub3d_windows_3rdparty')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Echo "LP3D_LDRAW_DIR_PATH=$(Join-Path (resolve-path $Env:USERPROFILE\) 'ldraw')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Echo "LP3D_3RD_PARTY_PATH=$(resolve-path ..\)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
If ( -Not (Test-Path -Path $(Join-Path (resolve-path ..\) 'lpub3d_windows_3rdparty') ) ) { New-Item -ItemType directory -Path $(Join-Path (resolve-path ..\) 'lpub3d_windows_3rdparty') }
- name: Cache LDraw
id: cache-ldraw
uses: actions/cache@v4
with:
path: ${{ env.LP3D_LDRAW_DIR_PATH }}
key: ldraw-lib
- name: VC 140 Build Tools
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$ComponentsToAdd= @(
"Microsoft.VisualStudio.Component.VC.140"
"Microsoft.VisualStudio.Component.WinXP"
)
[string]$WorkloadArgs = $ComponentsToAdd | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$WorkloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$Process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$Process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
shell: powershell
- name: Windows 8.1 SDK
run: |
Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile sdksetup.exe -UseBasicParsing
Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit"
shell: powershell
- name: Build LDView
shell: cmd
run: .\build.cmd -all -chk -minlog
build-macos:
# if: ${{ false }} # uncomment to disable
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Work Paths
run: |
echo "LDRAWDIR=${HOME}/Library/ldraw" >> ${GITHUB_ENV}
echo "LDV_DIST_DIR=lpub3d_macos_3rdparty" >> ${GITHUB_ENV}
echo "LDV_DIST_DIR_CREATE=${HOME}/work/ldview/ldview/lpub3d_macos_3rdparty" >> ${GITHUB_ENV}
- name: Development Packages
run: |
echo "/usr/local/opt/ccache/libexec" >> ${GITHUB_PATH}
echo "Install development packages..."
brew install grep ccache tinyxml gl2ps minizip qt@5
brew link --force qt@5;
if [[ -d /usr/X11/lib && /usr/X11/include ]]; then echo "Good to go - X11 found."; else brew install --cask xquartz; fi
- name: Cache LDraw
id: cache-ldraw
uses: actions/cache@v4
with:
path: ${{ env.LDRAWDIR }}
key: ldraw-lib
- name: LDraw Library
run: |
if [ ! -d ${LDRAWDIR}/parts ]; then
echo "LDraw library not found at ${LDRAWDIR}. Downloading library..."
curl -s -O https://library.ldraw.org/library/updates/complete.zip
unzip -d ~/Library -q complete.zip; rm complete.zip
if test -d ${LDRAWDIR}; then echo "LDraw library extracted, LDRAWDIR defined."; fi
fi
echo "set LDRAWDIR in environment.plist..."
chmod a+x QT/set-ldrawdir.command && sudo ./QT/set-ldrawdir.command
grep -A1 -e 'LDRAWDIR' ~/.MacOSX/environment.plist
echo "LDraw library defined at ${LDRAWDIR}."
- name: Build LDView
run: |
if [ ! -d "${LDV_DIST_DIR_CREATE}" ]; then mkdir -p "${LDV_DIST_DIR_CREATE}" && echo "${LDV_DIST_DIR_CREATE} created."; fi
qmake -v
qmake CONFIG+=3RD_PARTY_INSTALL=../${LDV_DIST_DIR} CONFIG+=release CONFIG+=BUILD_CUI_ONLY CONFIG+=USE_SYSTEM_LIBS CONFIG+=BUILD_CHECK
make && make install