Skip to content

Commit 2c3068c

Browse files
committed
[Native Windows Build] WLA-DX support
[Native Windows] [bugfix] removing carriage return [Native Windows] force forward slashes WLA on windows produces backwards slashes which was confusing msys make Update LibGME for Win Native build support [Native Windows] Add Build Doc
1 parent 6c4feaf commit 2c3068c

File tree

5 files changed

+107
-7
lines changed

5 files changed

+107
-7
lines changed

Building.md

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Alternatively, you may perform any of the following compilation scenarios:
1111
- compile native on OS X
1212
- compile native on Linux
1313
- cross-compile for Windows from Linux
14+
- Compile native on Windows
1415

1516
In order to compile, certain library dependencies must be installed on your system first. In general, it is preferred to install these libraries through your package manager if available.
1617

@@ -159,7 +160,6 @@ cp /usr/i686-w64-mingw32/usr/{bin/SDL2.dll,lib/libboost_filesystem.dll} /usr/lib
159160
Some of these library files are version dependent (eg. 9.2.0), so until an
160161
automation strategy is discovered (static build?), be careful.
161162

162-
163163
### Ubuntu
164164

165165
#### 64-bit
@@ -213,6 +213,101 @@ involves installing `i686-w64-mingw32-g++` package and adapting the 64-bit
213213
instructions in a similar fashion as can be observed from the Gentoo
214214
instructions.
215215

216+
Windows Native
217+
--------------
218+
219+
Building from Windows is now a thing! It's done using the msys mingw-w64 environment.
220+
221+
222+
Install Msys2 https://www.msys2.org/
223+
- Download and run the installer. After it's installed run Msys2 (Choose the msys2 mingw-w64 64-bit shell)
224+
- Update the shell tools:
225+
226+
```
227+
pacman -Syu
228+
# If needed, close MSYS2, run it again from Start menu. Update the rest with:
229+
pacman -Su
230+
```
231+
232+
- Install the tools
233+
234+
```
235+
pacman -S git mingw-w64-x86_64-gcc
236+
pacman -S make mingw-w64-x86_64-make
237+
pacman -S mingw-w64-x86_64-pkg-config # needed for SNES Tracker SDL2 flags
238+
pacman -S mingw64/mingw-w64-x86_64-cmake # Needed to build wla-dx
239+
pacman -S mingw-w64-x86_64-imagemagick # needed to build icons
240+
241+
# Optional CCACHE
242+
pacman -S mingw64/mingw-w64-x86_64-ccache
243+
echo 'export PATH="/mingw64/lib/ccache/bin:$PATH"' >> ~/.bashrc
244+
245+
# Optional GDB
246+
pacman -S mingw-w64-x86_64-gdb
247+
248+
# Note to self: Hacks for the use of CROSS_COMPILE prefix to get SNES Tracker to compile natively on Windows with the least amount of build system modification)
249+
250+
# Needed for libjdkmidi
251+
ln -s /mingw64/bin/{ar.exe,x86_64-w64-mingw32-ar.exe}
252+
ln -s /mingw64/bin/{ranlib.exe,x86_64-w64-mingw32-ranlib.exe}
253+
254+
# Needed to build icons
255+
ln -s /mingw64/bin/{windres.exe,x86_64-w64-mingw32-windres.exe}
256+
```
257+
258+
259+
## Library Dependencies
260+
261+
Compiling natively on Windows actually uses SNES Tracker's cross compilation build system.
262+
We are compiling these dependencies manually for a few reasons.
263+
- To have consistent results as the cross-compile build system expects.
264+
- To get certain library support that the official packages don't have (eg. Direct3D on SDL2)
265+
266+
### SDL
267+
268+
```
269+
wget http://libsdl.org/release/SDL2-2.0.12.tar.gz
270+
tar -zxf SDL2-2.0.12.tar.gz
271+
cd SDL2-2.0.12
272+
./configure --prefix=/c/bazzsys/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-sdl2-config=no
273+
make && make install
274+
```
275+
276+
### Boost
277+
278+
Note: Make sure your msys path is the same as mine below (C:/msys64), or adjust it as necessary.
279+
```
280+
wget https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2
281+
tar -jxf boost_1_72_0.tar.bz2
282+
cd boost_1_72_0/
283+
echo "using gcc : : x86_64-w64-mingw32-g++.exe ;" > user-config.jam
284+
./bootstrap.sh
285+
./b2 --prefix=C:/msys64/mingw64/x86_64-w64-mingw32 --with-system --with-filesystem --user-config=user-config.jam toolset=gcc target-os=windows variant=debug link=shared threading=multi address-model=64 install
286+
287+
# the SNES Tracker build system wants to see libboost_filesystem.dll naming convention like it's used on most other compilation scenarios, but the runtime
288+
# dependency on the dll will use the crazy name.
289+
pushd /mingw64/x86_64-w64-mingw32/include/
290+
mv boost-*/boost .
291+
cd ../lib
292+
cp libboost_filesystem*.dll libboost_filesystem.dll
293+
cp libboost_system*.dll libboost_system.dll
294+
popd
295+
```
296+
297+
### Get and Compile SNES Tracker
298+
299+
```
300+
git clone https://github.com/bazzinotti/snestracker.git
301+
cd snestracker
302+
./build-submodules.sh
303+
304+
prefix=/c/bazzsys/usr/x86_64-w64-mingw32 CROSS_COMPILE=x86_64-w64-mingw32- make
305+
cp /mingw64/bin/{libstdc++-6.dll,libgcc_s_seh-1.dll} \
306+
/mingw64/x86_64-w64-mingw32/{lib/libboost_{system,filesystem}-*.dll,bin/SDL2.dll} \
307+
/mingw64/bin/libwinpthread-1.dll pc/bin
308+
```
309+
310+
216311
Internal Dependencies
217312
---------------------
218313

build-submodules.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ echo
77
echo Building custom wla-dx
88
echo ----------------------
99
pushd submodules/wla-dx
10-
mkdir -p build-wla && cd build-wla &&
11-
cmake .. && cmake --build . --config Debug || (echo "CRITICAL ERROR" && exit 1)
10+
mkdir -p build-wla && cd build-wla
11+
# Conditional settings for compiling directly on Windows with MSYS
12+
cmakeFlags=
13+
if [[ "$OSTYPE" == "msys" ]]; then
14+
cmakeFlags="-G 'MSYS Makefiles'"
15+
fi
16+
cmake .. ${cmakeFlag} && cmake --build . --config Debug || (echo "CRITICAL ERROR" && exit 1)
1217
popd
1318

1419
echo

snes_driver/gen_spc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if [[ $1 = "" ]]; then
1010
exit 1
1111
fi
1212

13-
codestart=$(($(${wlaprefix}wla-spc700 -t apu/memorymap_defs.i 2>/dev/null | cut -f3 -d' ')))
13+
codestart=$(($(${wlaprefix}wla-spc700 -t apu/memorymap_defs.i 2>/dev/null | cut -f3 -d' ' | tr -d '\r')))
1414

1515

1616
total=$((0x10200))

snes_driver/genmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ $(OBJDIR)/apu/%.o: apu/%.s
124124
echo '#------------------------------'
125125
echo '#APU SIDE'
126126
echo '#------------------------------'
127-
cat /tmp/apu
127+
sed 's#\\\(.\)#/\1#g' /tmp/apu
128128
echo '#------------------------------'
129129
echo '#CPU SIDE'
130130
echo '#------------------------------'
131-
cat /tmp/cpu
131+
sed 's#\\\(.\)#/\1#g' /tmp/cpu
132132
echo '
133133
include Makefile.gfx
134134

submodules/libgme_m

0 commit comments

Comments
 (0)