Skip to content

Commit b0da316

Browse files
try
1 parent 2154d36 commit b0da316

File tree

5 files changed

+105
-176
lines changed

5 files changed

+105
-176
lines changed

raylib/build.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import time
2727

2828
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
29-
USE_SDL2 = True if RAYLIB_PLATFORM == "SDL" else False
3029

3130
def check_raylib_installed():
3231
return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0
@@ -108,7 +107,7 @@ def build_unix():
108107
if not check_raylib_installed():
109108
raise Exception("ERROR: raylib not found by pkg-config. Please install pkg-config and Raylib.")
110109

111-
if USE_SDL2 and not check_SDL_installed():
110+
if RAYLIB_PLATFORM=="SDL" and not check_SDL_installed():
112111
raise Exception("ERROR: SDL2 not found by pkg-config. Please install pkg-config and SDL2.")
113112

114113
raylib_h = get_the_include_path() + "/raylib.h"
@@ -131,7 +130,7 @@ def build_unix():
131130
"""
132131

133132
glfw3_h = get_the_include_path() + "/GLFW/glfw3.h"
134-
if not USE_SDL2 and check_header_exists(glfw3_h):
133+
if RAYLIB_PLATFORM=="Desktop" and check_header_exists(glfw3_h):
135134
ffi_includes += """
136135
#include "GLFW/glfw3.h"
137136
"""
@@ -159,7 +158,7 @@ def build_unix():
159158
ffibuilder.cdef(pre_process_header(raygui_h))
160159
if os.path.isfile(physac_h):
161160
ffibuilder.cdef(pre_process_header(physac_h))
162-
if not USE_SDL2 and os.path.isfile(glfw3_h):
161+
if RAYLIB_PLATFORM=="Desktop" and os.path.isfile(glfw3_h):
163162
ffibuilder.cdef(pre_process_header(glfw3_h))
164163

165164

@@ -168,7 +167,7 @@ def build_unix():
168167
extra_link_args = [get_the_lib_path() + '/libraylib.a', '-framework', 'OpenGL', '-framework', 'Cocoa',
169168
'-framework', 'IOKit', '-framework', 'CoreFoundation', '-framework',
170169
'CoreVideo']
171-
if USE_SDL2:
170+
if RAYLIB_PLATFORM=="SDL":
172171
extra_link_args += ['/usr/local/lib/libSDL2.a', '-framework', 'CoreHaptics', '-framework', 'ForceFeedback',
173172
'-framework', 'GameController']
174173
libraries = []
@@ -177,7 +176,7 @@ def build_unix():
177176
print("BUILDING FOR LINUX")
178177
extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL',
179178
'-lrt', '-lm', '-ldl', '-lX11', '-lpthread', '-latomic']
180-
if USE_SDL2:
179+
if RAYLIB_PLATFORM=="SDL":
181180
extra_link_args += ['-lSDL2']
182181
extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
183182
libraries = [] # Not sure why but we put them in extra_link_args instead so *shouldnt* be needed here
@@ -198,7 +197,7 @@ def build_unix():
198197
def build_windows():
199198
print("BUILDING FOR WINDOWS")
200199
ffibuilder.cdef(open("raylib/raylib.h.modified").read())
201-
if not USE_SDL2:
200+
if RAYLIB_PLATFORM=="Desktop":
202201
ffibuilder.cdef(open("raylib/glfw3.h.modified").read())
203202
ffibuilder.cdef(open("raylib/rlgl.h.modified").read())
204203
ffibuilder.cdef(open("raylib/raygui.h.modified").read())
@@ -211,7 +210,7 @@ def build_windows():
211210
#include "raymath.h"
212211
"""
213212

214-
if not USE_SDL2:
213+
if RAYLIB_PLATFORM=="Desktop":
215214
ffi_includes += """
216215
#include "GLFW/glfw3.h"
217216
"""
@@ -224,7 +223,7 @@ def build_windows():
224223
#include "physac.h"
225224
"""
226225
libraries = ['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm']
227-
if USE_SDL2:
226+
if RAYLIB_PLATFORM=="SDL":
228227
libraries += ['SDL2']
229228

230229
print("libraries: "+str(libraries))

0 commit comments

Comments
 (0)