split project into static and dynamic modules
This commit is contained in:
parent
55dca44b4a
commit
b6b9054d0d
28 changed files with 188 additions and 161 deletions
8
raylib/static/__init__.py
Normal file
8
raylib/static/__init__.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from ._raylib_cffi import ffi, lib as rl
|
||||
from _raylib_cffi.lib import *
|
||||
from raylib.colors import *
|
||||
from .helpers import *
|
||||
|
||||
|
||||
print("RAYLIB STATIC LOADED")
|
||||
|
21455
raylib/static/_raylib_cffi.c
Normal file
21455
raylib/static/_raylib_cffi.c
Normal file
File diff suppressed because it is too large
Load diff
BIN
raylib/static/_raylib_cffi.cpython-36m-x86_64-linux-gnu.so
Executable file
BIN
raylib/static/_raylib_cffi.cpython-36m-x86_64-linux-gnu.so
Executable file
Binary file not shown.
BIN
raylib/static/_raylib_cffi.cpython-37m-darwin.so
Executable file
BIN
raylib/static/_raylib_cffi.cpython-37m-darwin.so
Executable file
Binary file not shown.
26
raylib/static/build_linux.py
Normal file
26
raylib/static/build_linux.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Linux build assumes raylib, GL, etc are all already installed as system libraries. We dont distribute them.
|
||||
|
||||
from cffi import FFI
|
||||
import os
|
||||
import platform
|
||||
ffibuilder = FFI()
|
||||
|
||||
|
||||
ffibuilder.cdef(open("../raylib_modified.h").read().replace('RLAPI ', ''))
|
||||
|
||||
|
||||
ffibuilder.set_source("_raylib_cffi",
|
||||
"""
|
||||
#include "raylib.h" // the C header, installed in the system include dir we assume
|
||||
""",
|
||||
#library_dirs=['/Volumes/Home/rich/raylib-latest/src'],
|
||||
# extra_link_args=['-Wl,-rpath,.'],
|
||||
#extra_link_args=["/usr/local/lib/libraylib.a","-framework OpenGL"]# -F/System/Library/Frameworks -framework OpenGL -framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo"]
|
||||
# library_dirs=[os.path.dirname(__file__)+"/../lib"],
|
||||
libraries=['raylib','GL','m','pthread', 'dl', 'rt', 'X11']
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
|
23
raylib/static/build_mac.py
Normal file
23
raylib/static/build_mac.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from cffi import FFI
|
||||
import os
|
||||
import platform
|
||||
ffibuilder = FFI()
|
||||
|
||||
|
||||
ffibuilder.cdef(open("../raylib_modified.h").read().replace('RLAPI ', ''))
|
||||
|
||||
|
||||
ffibuilder.set_source("_raylib_cffi",
|
||||
"""
|
||||
#include "../raylib.h" // the C header of the library, supplied by us here
|
||||
"""
|
||||
)
|
||||
|
||||
# Hack to produce static linked lib using static librarylib.a supplied by us
|
||||
command = "clang -bundle -undefined dynamic_lookup ./_raylib_cffi.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib libraylib.a -F/System/Library/Frameworks -framework OpenGL -framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo -o ./_raylib_cffi.cpython-37m-darwin.so"
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
if platform.system()=="Darwin":
|
||||
print(command)
|
||||
os.system(command)
|
17
raylib/static/build_win32.py
Normal file
17
raylib/static/build_win32.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Windows build assumes raylib, OpenGL32, etc are all already installed as system libraries. We dont distribute them.
|
||||
|
||||
from cffi import FFI
|
||||
|
||||
ffibuilder = FFI()
|
||||
ffibuilder.cdef(open("../raylib_modified.h").read().replace('RLAPI ', ''))
|
||||
ffibuilder.set_source("_raylib_cffi",
|
||||
"""
|
||||
#include "raylib.h" // THIS MIGHT NEED TO BE CHANGED TO "../raylib.h" IF RAYLIB HEADERS NOT FOUND
|
||||
""",
|
||||
extra_link_args=['/NODEFAULTLIB:MSVCRTD'],
|
||||
libraries=['raylib', 'gdi32', 'shell32', 'user32','OpenGL32', 'winmm'],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
5
raylib/static/helpers.py
Normal file
5
raylib/static/helpers.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from ._raylib_cffi import ffi
|
||||
|
||||
def Vector3(x, y, z):
|
||||
return ffi.new("struct Vector3 *", [x, y, z])[0]
|
||||
|
BIN
raylib/static/libraylib.a
Normal file
BIN
raylib/static/libraylib.a
Normal file
Binary file not shown.
Reference in a new issue