Skip to content

Commit 52df62c

Browse files
committed
switch the windows build from 32 bit to 64 bit
- update CI to build with MSYS2/autotools and the FPC cross toolchain - fetch the x86_64 DLL bundle and download bass.dll separately - enable the OpenCV wrapper on Windows and link it as a DLL there - update bundled library names and versions for projectM, portaudio and freetype - remove obsolete 32 bit runtime DLLs from the repository
1 parent 504e049 commit 52df62c

27 files changed

Lines changed: 244 additions & 102 deletions

.github/workflows/main.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,43 @@ jobs:
1919
run: |
2020
$VNAME=$(cat VERSION | sed "s/+dev$/+dev-$(git rev-parse --short HEAD)/")
2121
echo "versionName=$VNAME" >> $env:GITHUB_ENV
22-
- name: Cache deps
23-
id: cache-deps
24-
uses: actions/cache@v5
22+
- name: Setup MSYS2
23+
uses: msys2/setup-msys2@v2
2524
with:
26-
key: lazarus-4.2-nsis-3.05
27-
path: |
28-
c:\lazarus
29-
c:\Program Files (x86)\NSIS
30-
- if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }}
31-
name: Install Dependencies
25+
msystem: MSYS
26+
update: false
27+
install: >-
28+
autoconf-wrapper
29+
automake-wrapper
30+
git
31+
make
32+
pkgconf
33+
mingw-w64-x86_64-gcc
34+
mingw-w64-x86_64-tools
35+
- name: Install Dependencies
3236
run: |
33-
choco install wget --no-progress
34-
wget https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Lazarus%204.2/lazarus-4.2-fpc-3.2.2-win32.exe/download -O lazarus-installer.exe --timeout 60 --progress=dot:giga
35-
Start-Process -FilePath "./lazarus-installer.exe" -ArgumentList "/verysilent" -Wait
36-
wget "https://sourceforge.net/projects/nsis/files/NSIS%203/3.05/nsis-3.05-setup.exe/download" -O nsis-3.05-setup.exe --timeout 60
37+
curl.exe -L --max-time 60 -o fpc-installer.exe "https://sourceforge.net/projects/freepascal/files/Win32/3.2.2/fpc-3.2.2.win32.and.win64.exe/download"
38+
curl.exe -L --max-time 60 -o nsis-3.05-setup.exe "https://sourceforge.net/projects/nsis/files/NSIS%203/3.05/nsis-3.05-setup.exe/download"
39+
Start-Process -FilePath ".\\fpc-installer.exe" -ArgumentList "/TYPE=full /VERYSILENT /SP- /SUPPRESSMSGBOXES /NORESTART" -Wait
3740
./nsis-3.05-setup.exe /S
38-
- name: Build
39-
run: |
40-
c:\lazarus\lazbuild src\ultrastardx-win.lpi --lazarusdir=c:\lazarus
41-
- name: Add prebuilt DLLs
41+
- name: Download prebuilt DLLs
4242
run: |
4343
python dldlls.py
44-
7z x -y usdx-dlls-i686.zip -ogame "*.dll"
44+
7z x -y usdx-dlls-x86_64.zip -ogame "*.dll"
4545
env:
4646
ARTIFACT_ACCESS_TOKEN: ${{ secrets.MxeActionsReadAccessToken }}
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
- name: Build
49+
shell: msys2 {0}
50+
run: |
51+
export PATH="/usr/bin:/mingw64/bin:/c/FPC/3.2.2/bin:/c/FPC/3.2.2/bin/i386-win32:$PATH"
52+
export MAKE="/usr/bin/make"
53+
export FPCCFG="/c/FPC/3.2.2/bin/i386-win32/fpc.cfg"
54+
export FPCDIR="/c/FPC/3.2.2"
55+
export FPCMAKE="/c/FPC/3.2.2/bin/i386-win32/fpcmake"
56+
./autogen.sh
57+
./configure
58+
make
4859
- name: Create installer
4960
run: |
5061
del game\*.debug

COMPILING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Prebuilt DLLs for SDL2, SDL2_image, FFmpeg, SQLite, PortAudio, and Lua can be fo
1818
1. Start Lazarus.
1919
2. Choose Project → Open Project … in the menu bar. A file-dialog box will show.
2020
3. Change to the src subdirectory of your USDX working copy (e.g. ultrastardx/src).
21-
* If you are running Windows, open the ultrastardx-win.lpi project-file (Preferably use the win32 verison of lazarus, as the included libraries are 32 bit).
21+
* If you are running Windows, open the ultrastardx-win.lpi project-file (use the win64 version of Lazarus, as the included libraries are 64 bit).
2222
* On Unix-like systems use the ultrastardx-unix.lpi file.
2323
4. Now you can compile USDX by choosing the menu entry Run → Build or pressing Ctrl+F9.
2424
5. If you want to compile and/or start USDX directly choose Run → Run or press F9.
@@ -43,11 +43,11 @@ Optional libraries:
4343

4444
#### Windows using MSYS2
4545
- Install [MSYS2](https://www.msys2.org)
46-
- Install [FPC](https://www.freepascal.org). You need at least a custom installation with the Free Pascal Utils (for `fpcres`) and the Units.
47-
- `pacman -S autoconf-wrapper automake-wrapper gcc git make mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_gfx mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-SDL2_net mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-lua51 pkgconf`
46+
- Install [FPC](https://www.freepascal.org). Use the Win32 cross-to-Win64 installer so you get the Win64 RTL units.
47+
- `pacman -S autoconf-wrapper automake-wrapper git make mingw-w64-x86_64-gcc mingw-w64-x86_64-tools`
4848
- Add some information to `.bash_profile`:
49-
* Path to FPC, something like `PATH="${PATH}:/c/FPC/3.2.2/bin/i386-win32"`
50-
* Path to mingw64 libraries, `PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/mingw64/lib/pkgconfig"`
49+
* Path to the cross compiler: `PATH="${PATH}:/c/FPC/3.2.2/bin/i386-win32"`
50+
* FPC config and base: `FPCCFG="/c/FPC/3.2.2/bin/i386-win32/fpc.cfg"` and `FPCDIR="/c/FPC/3.2.2"`
5151

5252
### Compile and run
5353
- `git clone https://github.com/UltraStar-Deluxe/USDX`

Makefile.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ USE_PROJECTM_CWRAPPER = @USE_PROJECTM_CWRAPPER@
8282

8383
OPENCV_CWRAPPER_DIR := $(USDX_LIB_DIR)/openCV3
8484
USE_OPENCV_CWRAPPER = @USE_OPENCV_CWRAPPER@
85+
USE_OPENCV_CWRAPPER_DLL ?= no
86+
ifeq ($(EXEEXT),.exe)
87+
USE_OPENCV_CWRAPPER_DLL := yes
88+
endif
8589

8690
#################################################
8791
# Dependencies
@@ -93,8 +97,10 @@ DEPS += $(PROJECTM_CWRAPPER_DIR)
9397
endif
9498

9599
ifeq ($(USE_OPENCV_CWRAPPER), yes)
100+
ifneq ($(USE_OPENCV_CWRAPPER_DLL), yes)
96101
DEPS += $(OPENCV_CWRAPPER_DIR)
97102
endif
103+
endif
98104

99105
#################################################
100106
# general targets

configure.ac

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ AC_ARG_WITH([local-projectM-presets],
104104
# add OpenCV option
105105
AC_ARG_WITH([opencv-cxx-api],
106106
[AS_HELP_STRING([--with-opencv-cxx-api],
107-
[use current OpenCV C++ API @<:@default=no@:>@])],
108-
[with_opencv_cxx_api=$withval], [with_opencv_cxx_api="no"])
107+
[use current OpenCV C++ API @<:@default=auto (yes on Windows, no elsewhere)@:>@])],
108+
[with_opencv_cxx_api=$withval], [with_opencv_cxx_api="auto"])
109109

110110
# print misc options header
111111
AC_ARG_WITH([cfg-dummy2], [
@@ -158,6 +158,15 @@ if [[ "$FPC_VERSION_MAJOR" -lt 3 ]]; then
158158
])
159159
fi
160160

161+
# On Windows, the OpenCV C-wrapper is required for compiling with current OpenCV.
162+
# Keep explicit user values, but auto-enable when no value was provided.
163+
if [[ "$with_opencv_cxx_api" = auto ]]; then
164+
case "$FPC_PLATFORM" in
165+
win32|win64) with_opencv_cxx_api=yes ;;
166+
*) with_opencv_cxx_api=no ;;
167+
esac
168+
fi
169+
161170
# find and test the C compiler (for C-libs and wrappers)
162171
AC_PROG_CC
163172
AC_LANG([C])
@@ -186,6 +195,15 @@ fi
186195
# check for libraries
187196
# -----------------------------------------
188197

198+
use_generated_config=yes
199+
if test x$FPC_PLATFORM = xwin32 -o x$FPC_PLATFORM = xwin64; then
200+
use_generated_config=no
201+
AC_MSG_NOTICE([Using src/config-win.inc for Windows library configuration; skipping pkg-config checks for bundled runtime DLLs.])
202+
libprojectM_USE_CWRAPPER=no
203+
AC_SUBST(USE_PROJECTM_CWRAPPER, $libprojectM_USE_CWRAPPER)
204+
opencv_USE_CWRAPPER=yes
205+
AC_SUBST(USE_OPENCV_CWRAPPER, $opencv_USE_CWRAPPER)
206+
else
189207
# find sdl2
190208
PKG_HAVE([sdl2], [sdl2], yes)
191209

@@ -433,6 +451,7 @@ fi
433451
AC_SUBST_DEFINE(HAVE_PORTMIDI, $portmidi_HAVE)
434452
AC_SUBST_DEFINE(HAVE_PORTTIME, $porttime_HAVE)
435453
AC_SUBST(porttime_LIB_NAME)
454+
fi
436455

437456
# determine linker-flags
438457
if test x$FPC_PLATFORM = xdarwin; then
@@ -448,7 +467,9 @@ AC_SUBST(LIBS)
448467

449468
AC_CONFIG_FILES([Makefile])
450469
AC_CONFIG_FILES([src/Makefile])
451-
AC_CONFIG_FILES([src/config-$FPC_PLATFORM.inc:src/config.inc.in])
470+
if [[ "$use_generated_config" = yes ]]; then
471+
AC_CONFIG_FILES([src/config-$FPC_PLATFORM.inc:src/config.inc.in])
472+
fi
452473
if [[ x$libprojectM_USE_CWRAPPER = xyes ]]; then
453474
AC_CONFIG_FILES([src/lib/projectM/cwrapper/Makefile])
454475
fi

dists/autogen/m4/fpc.m4

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,18 @@ if test x$FPC_PLATFORM = xdarwin; then
151151
fi
152152
fi
153153
154+
# The official Windows x86_64 FPC package uses the generic "fpc" driver
155+
# as a 32-bit cross-compiler targeting x86_64.
156+
case "$host_os" in
157+
mingw*|msys*|cygwin*)
158+
case "$host_cpu" in
159+
x86_64|amd64)
160+
PFLAGS+=" -Px86_64 "
161+
;;
162+
esac
163+
;;
164+
esac
165+
154166
AC_SUBST(FPC_PLATFORM)
155167
AC_SUBST(FPC_PROCESSOR)
156168
AC_SUBST(FPC_CPLATFORM)

dldlls.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
import json
66
import sys
77
import os
8+
import zipfile
89

9-
sha = '67f6a4f9305a2ee1508215ad4a861f23f7b8e3da'
10-
filename = 'usdx-dlls-i686'
10+
sha = '2a7b1fcd8bf3082bc0f0ed78404b8ecb4972669c'
11+
filename = 'usdx-dlls-x86_64'
1112
urlbase = 'https://api.github.com/repos/UltraStar-Deluxe/mxe/'
1213
headers = {
1314
'Accept': 'application/vnd.github+json',
@@ -22,6 +23,19 @@
2223

2324
print('Searching for binaries built from commit ' + sha)
2425

26+
def download_bass():
27+
bass_url = 'https://www.un4seen.com/files/bass24.zip'
28+
zip_name = 'bass24.zip'
29+
target = 'game/bass.dll'
30+
with urllib.request.urlopen(bass_url) as dl, open(zip_name, 'wb') as out:
31+
out.write(dl.read())
32+
with zipfile.ZipFile(zip_name, 'r') as zf:
33+
member = 'x64/bass.dll'
34+
with zf.open(member) as src, open(target, 'wb') as dst:
35+
dst.write(src.read())
36+
print('Downloaded ' + member + ' to ' + target)
37+
38+
2539
def search_releases():
2640
pagesuffix = ''
2741
page = 1
@@ -69,6 +83,8 @@ def search_artifacts():
6983
print('No workflow artifact matches')
7084
return None
7185

86+
download_bass()
87+
7288
dllurl = search_releases()
7389
if dllurl == None and token != None:
7490
dllurl = search_artifacts()

game/bass.dll

-136 KB
Binary file not shown.

game/cv210.dll

-1.99 MB
Binary file not shown.

game/cxcore210.dll

-2.1 MB
Binary file not shown.

game/glew32.dll

-262 KB
Binary file not shown.

0 commit comments

Comments
 (0)