26
26
import time
27
27
28
28
RAYLIB_PLATFORM = os .getenv ("RAYLIB_PLATFORM" , "Desktop" )
29
- USE_SDL2 = True if RAYLIB_PLATFORM == "SDL" else False
30
29
31
30
def check_raylib_installed ():
32
31
return subprocess .run (['pkg-config' , '--exists' , 'raylib' ], text = True , stdout = subprocess .PIPE ).returncode == 0
@@ -108,7 +107,7 @@ def build_unix():
108
107
if not check_raylib_installed ():
109
108
raise Exception ("ERROR: raylib not found by pkg-config. Please install pkg-config and Raylib." )
110
109
111
- if USE_SDL2 and not check_SDL_installed ():
110
+ if RAYLIB_PLATFORM == "SDL" and not check_SDL_installed ():
112
111
raise Exception ("ERROR: SDL2 not found by pkg-config. Please install pkg-config and SDL2." )
113
112
114
113
raylib_h = get_the_include_path () + "/raylib.h"
@@ -131,7 +130,7 @@ def build_unix():
131
130
"""
132
131
133
132
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 ):
135
134
ffi_includes += """
136
135
#include "GLFW/glfw3.h"
137
136
"""
@@ -159,7 +158,7 @@ def build_unix():
159
158
ffibuilder .cdef (pre_process_header (raygui_h ))
160
159
if os .path .isfile (physac_h ):
161
160
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 ):
163
162
ffibuilder .cdef (pre_process_header (glfw3_h ))
164
163
165
164
@@ -168,7 +167,7 @@ def build_unix():
168
167
extra_link_args = [get_the_lib_path () + '/libraylib.a' , '-framework' , 'OpenGL' , '-framework' , 'Cocoa' ,
169
168
'-framework' , 'IOKit' , '-framework' , 'CoreFoundation' , '-framework' ,
170
169
'CoreVideo' ]
171
- if USE_SDL2 :
170
+ if RAYLIB_PLATFORM == "SDL" :
172
171
extra_link_args += ['/usr/local/lib/libSDL2.a' , '-framework' , 'CoreHaptics' , '-framework' , 'ForceFeedback' ,
173
172
'-framework' , 'GameController' ]
174
173
libraries = []
@@ -177,7 +176,7 @@ def build_unix():
177
176
print ("BUILDING FOR LINUX" )
178
177
extra_link_args = get_lib_flags () + [ '-lm' , '-lpthread' , '-lGL' ,
179
178
'-lrt' , '-lm' , '-ldl' , '-lX11' , '-lpthread' , '-latomic' ]
180
- if USE_SDL2 :
179
+ if RAYLIB_PLATFORM == "SDL" :
181
180
extra_link_args += ['-lSDL2' ]
182
181
extra_compile_args = ["-Wno-incompatible-pointer-types" , "-D_CFFI_NO_LIMITED_API" ]
183
182
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():
198
197
def build_windows ():
199
198
print ("BUILDING FOR WINDOWS" )
200
199
ffibuilder .cdef (open ("raylib/raylib.h.modified" ).read ())
201
- if not USE_SDL2 :
200
+ if RAYLIB_PLATFORM == "Desktop" :
202
201
ffibuilder .cdef (open ("raylib/glfw3.h.modified" ).read ())
203
202
ffibuilder .cdef (open ("raylib/rlgl.h.modified" ).read ())
204
203
ffibuilder .cdef (open ("raylib/raygui.h.modified" ).read ())
@@ -211,7 +210,7 @@ def build_windows():
211
210
#include "raymath.h"
212
211
"""
213
212
214
- if not USE_SDL2 :
213
+ if RAYLIB_PLATFORM == "Desktop" :
215
214
ffi_includes += """
216
215
#include "GLFW/glfw3.h"
217
216
"""
@@ -224,7 +223,7 @@ def build_windows():
224
223
#include "physac.h"
225
224
"""
226
225
libraries = ['raylib' , 'gdi32' , 'shell32' , 'user32' , 'OpenGL32' , 'winmm' ]
227
- if USE_SDL2 :
226
+ if RAYLIB_PLATFORM == "SDL" :
228
227
libraries += ['SDL2' ]
229
228
230
229
print ("libraries: " + str (libraries ))
0 commit comments