Skip to content

Commit 1bad6aa

Browse files
committed
Compiles on macOS w/ Apple Silicon (not tested any further than that)
1 parent b53d67d commit 1bad6aa

File tree

7 files changed

+93
-4
lines changed

7 files changed

+93
-4
lines changed

engine/CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ if (WIN32)
2626
win32/q_shwin.cpp
2727
win32/snd_win.cpp
2828
)
29+
elseif (APPLE)
30+
file(GLOB ENGINE_PLATFORM_SOURCE
31+
null/cd_null.cpp
32+
null/snd_null.cpp
33+
linux/glob.cpp
34+
linux/net_udp.cpp
35+
linux/q_shlinux.cpp
36+
)
2937
elseif (UNIX)
3038
file(GLOB ENGINE_PLATFORM_SOURCE
3139
linux/cd_linux.cpp
@@ -130,6 +138,9 @@ target_include_directories(engine PRIVATE
130138
)
131139

132140
find_package(SDL2 CONFIG REQUIRED)
141+
target_link_libraries(engine SDL2::SDL2-static)
142+
143+
find_package(OpenGL REQUIRED)
133144

134145
if (WIN32)
135146
if (MSVC)
@@ -143,19 +154,20 @@ if (WIN32)
143154
)
144155
endif ()
145156
target_link_libraries(engine
146-
SDL2::SDL2main
147-
SDL2::SDL2
148157
Imm32
149158
Setupapi
150159
Version
151160
Opengl32
152161
Ws2_32
153162
Winmm
154163
)
155-
elseif (UNIX)
164+
elseif(APPLE)
165+
target_link_libraries(engine
166+
${OPENGL_LIBRARIES}
167+
)
168+
elseif (UNIX AND NOT APPLE)
156169
target_link_libraries(engine
157170
dl
158171
GL
159-
SDL2
160172
)
161173
endif ()

engine/null/cd_null.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
// Copyright © 2022 Mark E Sowden <[email protected]>
3+
4+
void CDAudio_Init()
5+
{
6+
}
7+
8+
void CDAudio_Play( int, bool )
9+
{
10+
}
11+
12+
void CDAudio_Stop()
13+
{
14+
}
15+
16+
void CDAudio_Update()
17+
{
18+
}
19+
20+
void CDAudio_Shutdown()
21+
{
22+
}

engine/null/snd_null.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
// Copyright © 2022 Mark E Sowden <[email protected]>
3+
4+
void SNDDMA_Init()
5+
{
6+
}
7+
8+
void SNDDMA_Submit()
9+
{
10+
}
11+
12+
void SNDDMA_GetDMAPos()
13+
{
14+
}
15+
16+
void SNDDMA_BeginPainting()
17+
{
18+
}
19+
20+
void SNDDMA_Shutdown()
21+
{
22+
}

readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ If you have experience with either C/C++, have a passion for programming and fam
5757

5858
Alternatively, feel free to ping me an email at [[email protected]](mailto:[email protected]).
5959

60+
## Building
61+
62+
**(these instructions aren't necessarily up-to-date)**
63+
64+
### Windows
65+
66+
#### Visual Studio
67+
68+
1. Use `vcpkg_setup_msvc.bat`; this will fetch vcpkg and install the dependencies
69+
2. Now use `cmake_generate_vs2022-x64.bat` which will generate the Visual Studio solution for you under a new `build` directory
70+
71+
### macOS w/ Apple Silicon
72+
73+
No plans to support "legacy" x86/x64 based devices right now unless someone else steps in to do it.
74+
macOS support is generally going to be at the bottom of my priority list for supported platforms.
75+
76+
1. If you don't have vcpkg installed already, use `vcpkg_setup_apple.sh`; this will fetch vcpkg and install the dependencies
77+
2. Use CMake as usual, but pass `-DCMAKE_TOOLCHAIN_FILE=vcpkg\scripts\buildsystems\vcpkg.cmake` as an argument so it can find packages provided by vcpkg
78+
6079
## Resources
6180

6281
- [Anachrodox](https://anachrodox.talonbrave.info/)

vcpkg_setup_apple.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
VCDIR="./vcpkg/"
4+
VCEXE="./vcpkg/vcpkg"
5+
6+
if [ ! -d "$VCDIR" ]; then
7+
git clone https://github.com/Microsoft/vcpkg.git
8+
fi
9+
if [ ! -f "$VCEXE" ]; then
10+
vcpkg/bootstrap-vcpkg.sh -disableMetrics
11+
fi
12+
13+
# now install what we need
14+
vcpkg/vcpkg install sdl2:arm64-osx
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)