raylib 5.0.0.5__cp313-cp313-manylinux2014_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of raylib might be problematic. Click here for more details.

raylib/build.py ADDED
@@ -0,0 +1,224 @@
1
+ # Copyright (c) 2021 Richard Smith and others
2
+ #
3
+ # This program and the accompanying materials are made available under the
4
+ # terms of the Eclipse Public License 2.0 which is available at
5
+ # http://www.eclipse.org/legal/epl-2.0.
6
+ #
7
+ # This Source Code may also be made available under the following Secondary
8
+ # licenses when the conditions for such availability set forth in the Eclipse
9
+ # Public License, v. 2.0 are satisfied: GNU General Public License, version 2
10
+ # with the GNU Classpath Exception which is
11
+ # available at https://www.gnu.org/software/classpath/license.html.
12
+ #
13
+ # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
14
+
15
+ # Assumes raylib, GL, etc are all already installed as system libraries. We dont distribute them.
16
+ # Raylib must be installed and compiled with: cmake -DWITH_PIC=ON -DSHARED=ON -DSTATIC=ON ..
17
+
18
+ # We use /usr/local/lib/libraylib.a to ensure we link to static version
19
+ import re
20
+
21
+ from cffi import FFI
22
+ import os
23
+ import platform
24
+ import sys
25
+ import subprocess
26
+ import time
27
+
28
+
29
+
30
+
31
+ def check_raylib_installed():
32
+ return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0
33
+
34
+
35
+ def get_the_include_path():
36
+ return subprocess.run(['pkg-config', '--variable=includedir', 'raylib'], text=True,
37
+ stdout=subprocess.PIPE).stdout.strip()
38
+
39
+
40
+ def get_the_lib_path():
41
+ return subprocess.run(['pkg-config', '--variable=libdir', 'raylib'], text=True,
42
+ stdout=subprocess.PIPE).stdout.strip()
43
+
44
+ def get_lib_flags():
45
+ return subprocess.run(['pkg-config', '--libs', 'raylib'], text=True,
46
+ stdout=subprocess.PIPE).stdout.strip().split()
47
+
48
+ def pre_process_header(filename, remove_function_bodies=False):
49
+ print("Pre-processing " + filename)
50
+ file = open(filename, "r")
51
+ filetext = "".join([line for line in file if '#include' not in line])
52
+ command = ['gcc', '-CC', '-P', '-undef', '-nostdinc', '-DRL_MATRIX_TYPE',
53
+ '-DRL_QUATERNION_TYPE','-DRL_VECTOR4_TYPE','-DRL_VECTOR3_TYPE','-DRL_VECTOR2_TYPE',
54
+ '-DRLAPI=', '-DPHYSACDEF=', '-DRAYGUIDEF=','-DRMAPI=',
55
+ '-dDI', '-E', '-']
56
+ filetext = subprocess.run(command, text=True, input=filetext, stdout=subprocess.PIPE).stdout
57
+ filetext = filetext.replace("va_list", "void *")
58
+ if remove_function_bodies:
59
+ filetext = re.sub('\n{\n(.|\n)*?\n}\n', ';', filetext)
60
+ filetext = "\n".join([line for line in filetext.splitlines() if not line.startswith("#")])
61
+ file = open("raylib/"+os.path.basename(filename)+".modified", "w")
62
+ file.write(filetext)
63
+ # print(r)
64
+ return filetext
65
+
66
+
67
+ def check_header_exists(file):
68
+ if not os.path.isfile(file):
69
+ print("\n\n*************** WARNING ***************\n\n")
70
+ print(
71
+ file + " not found. Build will not contain these extra functions.\n\nPlease copy file from src/extras to " + file + " if you want them.\n\n")
72
+ print("**************************************\n\n")
73
+ time.sleep(1)
74
+ return False
75
+ return True
76
+
77
+
78
+ # def mangle(file):
79
+ # result = ""
80
+ # skip = False
81
+ # for line in open(file):
82
+ # line = line.strip().replace("va_list", "void *") + "\n"
83
+ # if skip:
84
+ # if line.startswith("#endif"):
85
+ # skip = False
86
+ # continue
87
+ # if line.startswith("#if defined(__cplusplus)"):
88
+ # skip = True
89
+ # continue
90
+ # if line.startswith("#endif // RAYGUI_H"):
91
+ # break
92
+ # if line.startswith("#"):
93
+ # continue
94
+ # if line.startswith("RLAPI"):
95
+ # line = line.replace('RLAPI ', '')
96
+ # if line.startswith("RAYGUIDEF"):
97
+ # line = line.replace('RAYGUIDEF ', '')
98
+ # if line.startswith("PHYSACDEF"):
99
+ # line = line.replace('PHYSACDEF ', '')
100
+ # result += line
101
+ # # print(line)
102
+ # return result
103
+
104
+
105
+ def build_unix():
106
+ if not check_raylib_installed():
107
+ raise Exception("ERROR: raylib not found by pkg-config. Please install pkg-config and Raylib.")
108
+
109
+ raylib_h = get_the_include_path() + "/raylib.h"
110
+ rlgl_h = get_the_include_path() + "/rlgl.h"
111
+ raymath_h = get_the_include_path() + "/raymath.h"
112
+
113
+ if not os.path.isfile(raylib_h):
114
+ raise Exception("ERROR: " + raylib_h + " not found. Please install Raylib.")
115
+
116
+ if not os.path.isfile(rlgl_h):
117
+ raise Exception("ERROR: " + rlgl_h + " not found. Please install Raylib.")
118
+
119
+ if not os.path.isfile(raymath_h):
120
+ raise Exception("ERROR: " + raylib_h + " not found. Please install Raylib.")
121
+
122
+ ffi_includes = """
123
+ #include "raylib.h"
124
+ #include "rlgl.h"
125
+ #include "raymath.h"
126
+ """
127
+
128
+ glfw3_h = get_the_include_path() + "/GLFW/glfw3.h"
129
+ if check_header_exists(glfw3_h):
130
+ ffi_includes += """
131
+ #include "GLFW/glfw3.h"
132
+ """
133
+
134
+ raygui_h = get_the_include_path() + "/raygui.h"
135
+ if check_header_exists(raygui_h):
136
+ ffi_includes += """
137
+ #define RAYGUI_IMPLEMENTATION
138
+ #define RAYGUI_SUPPORT_RICONS
139
+ #include "raygui.h"
140
+ """
141
+
142
+ physac_h = get_the_include_path() + "/physac.h"
143
+ if check_header_exists(physac_h):
144
+ ffi_includes += """
145
+ #define PHYSAC_IMPLEMENTATION
146
+ #include "physac.h"
147
+ """
148
+
149
+ ffibuilder.cdef(pre_process_header(raylib_h))
150
+ ffibuilder.cdef(pre_process_header(rlgl_h))
151
+ ffibuilder.cdef(pre_process_header(raymath_h, True))
152
+
153
+ if os.path.isfile(raygui_h):
154
+ ffibuilder.cdef(pre_process_header(raygui_h))
155
+ if os.path.isfile(physac_h):
156
+ ffibuilder.cdef(pre_process_header(physac_h))
157
+ if os.path.isfile(glfw3_h):
158
+ ffibuilder.cdef(pre_process_header(glfw3_h))
159
+
160
+
161
+ if platform.system() == "Darwin":
162
+ print("BUILDING FOR MAC")
163
+ extra_link_args = [get_the_lib_path() + '/libraylib.a', '-framework', 'OpenGL', '-framework', 'Cocoa',
164
+ '-framework', 'IOKit', '-framework', 'CoreFoundation', '-framework',
165
+ 'CoreVideo']
166
+ libraries = []
167
+ extra_compile_args = ["-Wno-error=incompatible-function-pointer-types", "-D_CFFI_NO_LIMITED_API"]
168
+ else: #platform.system() == "Linux":
169
+ print("BUILDING FOR LINUX")
170
+ extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL',
171
+ '-lrt', '-lm', '-ldl', '-lX11', '-lpthread', '-latomic']
172
+ extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
173
+ libraries = ['GL', 'm', 'pthread', 'dl', 'rt', 'X11', 'atomic']
174
+
175
+ ffibuilder.set_source("raylib._raylib_cffi",
176
+ ffi_includes,
177
+ py_limited_api=False,
178
+ include_dirs=[get_the_include_path()],
179
+ extra_link_args=extra_link_args,
180
+ extra_compile_args=extra_compile_args,
181
+ libraries=libraries)
182
+
183
+
184
+ def build_windows():
185
+ print("BUILDING FOR WINDOWS")
186
+ ffibuilder.cdef(open("raylib/raylib.h.modified").read())
187
+ ffibuilder.cdef(open("raylib/glfw3.h.modified").read())
188
+ ffibuilder.cdef(open("raylib/rlgl.h.modified").read())
189
+ ffibuilder.cdef(open("raylib/raygui.h.modified").read())
190
+ ffibuilder.cdef(open("raylib/physac.h.modified").read())
191
+ ffibuilder.cdef(open("raylib/raymath.h.modified").read())
192
+ ffibuilder.set_source("raylib._raylib_cffi", """
193
+ #include "raylib.h"
194
+ #include "rlgl.h"
195
+ #include "raymath.h"
196
+ #include "GLFW/glfw3.h"
197
+ #define RAYGUI_IMPLEMENTATION
198
+ #define RAYGUI_SUPPORT_RICONS
199
+ #include "raygui.h"
200
+ #define PHYSAC_IMPLEMENTATION
201
+ #include "physac.h"
202
+ """,
203
+ extra_link_args=['/NODEFAULTLIB:MSVCRTD'],
204
+ extra_compile_args="/D_CFFI_NO_LIMITED_API",
205
+ py_limited_api=False,
206
+ libraries=['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm'],
207
+ include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src',
208
+ 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include',
209
+ 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src',
210
+ 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\physac\\src'],
211
+ )
212
+
213
+
214
+ ffibuilder = FFI()
215
+
216
+ if platform.system() == "Windows":
217
+ build_windows()
218
+ else:
219
+ print("not windows, trying Unix build")
220
+ build_unix()
221
+
222
+
223
+ if __name__ == "__main__":
224
+ ffibuilder.compile(verbose=True)
raylib/colors.py ADDED
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2021 Richard Smith and others
2
+ #
3
+ # This program and the accompanying materials are made available under the
4
+ # terms of the Eclipse Public License 2.0 which is available at
5
+ # http://www.eclipse.org/legal/epl-2.0.
6
+ #
7
+ # This Source Code may also be made available under the following Secondary
8
+ # licenses when the conditions for such availability set forth in the Eclipse
9
+ # Public License, v. 2.0 are satisfied: GNU General Public License, version 2
10
+ # with the GNU Classpath Exception which is
11
+ # available at https://www.gnu.org/software/classpath/license.html.
12
+ #
13
+ # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
14
+
15
+ LIGHTGRAY =( 200, 200, 200, 255 )
16
+ GRAY =( 130, 130, 130, 255 )
17
+ DARKGRAY =( 80, 80, 80, 255 )
18
+ YELLOW =( 253, 249, 0, 255 )
19
+ GOLD =( 255, 203, 0, 255 )
20
+ ORANGE =( 255, 161, 0, 255 )
21
+ PINK =( 255, 109, 194, 255 )
22
+ RED =( 230, 41, 55, 255 )
23
+ MAROON =( 190, 33, 55, 255 )
24
+ GREEN =( 0, 228, 48, 255 )
25
+ LIME =( 0, 158, 47, 255 )
26
+ DARKGREEN =( 0, 117, 44, 255 )
27
+ SKYBLUE =( 102, 191, 255, 255 )
28
+ BLUE =( 0, 121, 241, 255 )
29
+ DARKBLUE =( 0, 82, 172, 255 )
30
+ PURPLE =( 200, 122, 255, 255 )
31
+ VIOLET =( 135, 60, 190, 255 )
32
+ DARKPURPLE =( 112, 31, 126, 255 )
33
+ BEIGE =( 211, 176, 131, 255 )
34
+ BROWN =( 127, 106, 79, 255 )
35
+ DARKBROWN =( 76, 63, 47, 255 )
36
+ WHITE =( 255, 255, 255, 255 )
37
+ BLACK =( 0, 0, 0, 255 )
38
+ BLANK =( 0, 0, 0, 0 )
39
+ MAGENTA =( 255, 0, 255, 255 )
40
+ RAYWHITE =( 245, 245, 245, 255 )
41
+