rewrite build system to build separate binary wheels for each platform. only tested on Linux so far. should fix #25.
This commit is contained in:
parent
76121e34a9
commit
9eddc4e528
24 changed files with 148 additions and 25686 deletions
|
@ -1,5 +1,5 @@
|
|||
from ._raylib_cffi import ffi, lib as rl
|
||||
from _raylib_cffi.lib import *
|
||||
from raylib.static._raylib_cffi import ffi, lib as rl
|
||||
from raylib.static._raylib_cffi.lib import *
|
||||
from raylib.colors import *
|
||||
import cffi
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
87
raylib/static/build.py
Normal file
87
raylib/static/build.py
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Assumes raylib, GL, etc are all already installed as system libraries. We dont distribute them.
|
||||
# Raylib must be installed and compiled with: cmake -DWITH_PIC=ON -DSHARED=ON -DSTATIC=ON ..
|
||||
|
||||
from cffi import FFI
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
ffibuilder = FFI()
|
||||
|
||||
def build_linux():
|
||||
print("BUILDING FOR LINUX")
|
||||
ffibuilder.cdef(open("raylib/raylib_modified.h").read().replace('RLAPI ', ''))
|
||||
ffibuilder.set_source("raylib.static._raylib_cffi",
|
||||
"""
|
||||
#include "../../raylib/raylib.h"
|
||||
""",
|
||||
extra_link_args=['/usr/local/lib/libraylib.a','-lm', '-lpthread', '-lGLU', '-lGL', '-lrt', '-lm', '-ldl', '-lX11', '-lpthread'],
|
||||
libraries=['GL','m','pthread', 'dl', 'rt', 'X11']
|
||||
)
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
|
||||
def build_windows():
|
||||
print("BUILDING FOR WINDOWS")
|
||||
ffibuilder.cdef(open("raylib/raylib_modified.h").read().replace('RLAPI ', '').replace('bool','int'))
|
||||
ffibuilder.set_source("raylib.static._raylib_cffi",
|
||||
"""
|
||||
#include "../../raylib/raylib.h"
|
||||
""",
|
||||
extra_link_args=['/NODEFAULTLIB:MSVCRTD'],
|
||||
libraries=['raylib_static', 'gdi32', 'shell32', 'user32','OpenGL32', 'winmm'],
|
||||
)
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
|
||||
def build_mac():
|
||||
print("BUILDING FOR MAC")
|
||||
ffibuilder.cdef(open("raylib/raylib_modified.h").read().replace('RLAPI ', ''))
|
||||
ffibuilder.set_source("raylib.static._raylib_cffi",
|
||||
"""
|
||||
#include "./../raylib/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
|
||||
version = sys.implementation.cache_tag
|
||||
if version == 'cpython-36' or version == 'cpython-37':
|
||||
version += 'm'
|
||||
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_mac.a -F/System/Library/Frameworks -framework OpenGL -framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo -o ./_raylib_cffi."+version+"-darwin.so"
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
if platform.system()=="Darwin":
|
||||
print(command)
|
||||
os.system(command)
|
||||
|
||||
def build_rpi_nox():
|
||||
print("BUILDING FOR RASPBERRY PI")
|
||||
ffibuilder.cdef(open("raylib/raylib_modified.h").read().replace('RLAPI ', ''))
|
||||
ffibuilder.set_source("raylib.static._raylib_cffi",
|
||||
"""
|
||||
#include "./../raylib/raylib.h"
|
||||
""",
|
||||
extra_link_args=['/usr/local/lib/libraylib.a',
|
||||
'/opt/vc/lib/libEGL_static.a', '/opt/vc/lib/libGLESv2_static.a',
|
||||
'-L/opt/vc/lib', '-lvcos', '-lbcm_host', '-lbrcmEGL', '-lbrcmGLESv2',
|
||||
'-lm', '-lpthread', '-lrt'],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
|
||||
|
||||
|
||||
if platform.system()=="Darwin":
|
||||
build_mac()
|
||||
elif platform.system()=="Linux":
|
||||
if "x86" in platform.machine():
|
||||
build_linux()
|
||||
elif "arm" in platform.machine():
|
||||
build_rpi_nox()
|
||||
elif platform.system()=="Windows":
|
||||
build_windows()
|
||||
else:
|
||||
print("WARNING: UKKNOWN PLATFORM - trying Linux build")
|
||||
build_linux()
|
|
@ -1,24 +0,0 @@
|
|||
# Linux build assumes raylib, GL, etc are all already installed as system libraries. We dont distribute them.
|
||||
# Raylib must be installed the compiled with: cmake -DWITH_PIC=ON -DSHARED=ON -DSTATIC=ON ..
|
||||
|
||||
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"
|
||||
""",
|
||||
extra_link_args=['/usr/local/lib/libraylib.a','-lm', '-lpthread', '-lGLU', '-lGL', '-lrt', '-lm', '-ldl', '-lX11', '-lpthread'],
|
||||
libraries=['GL','m','pthread', 'dl', 'rt', 'X11']
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
if ! command -v pyenv &> /dev/null
|
||||
then
|
||||
echo "Pyenv required: https://github.com/pyenv/pyenv-installer"
|
||||
exit
|
||||
fi
|
||||
rm *linux-gnu.so
|
||||
pyenv install -s 3.9.1
|
||||
pyenv global 3.9.1
|
||||
pip3 install cffi
|
||||
python build_linux.py
|
||||
pyenv install -s 3.8.7
|
||||
pyenv global 3.8.7
|
||||
pip3 install cffi
|
||||
python build_linux.py
|
||||
pyenv install -s 3.7.9
|
||||
pyenv global 3.7.9
|
||||
pip3 install cffi
|
||||
python build_linux.py
|
||||
pyenv install -s 3.6.12
|
||||
pyenv global 3.6.12
|
||||
pip3 install cffi
|
||||
python build_linux.py
|
|
@ -1,27 +0,0 @@
|
|||
from cffi import FFI
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
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
|
||||
version = sys.implementation.cache_tag
|
||||
if version == 'cpython-36' or version == 'cpython-37':
|
||||
version += 'm'
|
||||
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_mac.a -F/System/Library/Frameworks -framework OpenGL -framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo -o ./_raylib_cffi."+version+"-darwin.so"
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
if platform.system()=="Darwin":
|
||||
print(command)
|
||||
os.system(command)
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
rm *darwin.so
|
||||
pyenv global 3.8.1
|
||||
pip3 install cffi
|
||||
python build_mac.py
|
||||
pyenv global 3.7.5
|
||||
pip3 install cffi
|
||||
python build_mac.py
|
||||
pyenv global 3.6.9
|
||||
pip3 install cffi
|
||||
python build_mac.py
|
22
raylib/static/build_multi.sh
Executable file
22
raylib/static/build_multi.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
if ! command -v pyenv &> /dev/null
|
||||
then
|
||||
echo "Pyenv required: https://github.com/pyenv/pyenv-installer"
|
||||
exit
|
||||
fi
|
||||
|
||||
function build() {
|
||||
echo "Building for Python $1"
|
||||
pyenv install -s $1
|
||||
pyenv global $1
|
||||
pip3 install cffi
|
||||
pip3 install wheel
|
||||
rm -rf raylib/static/_raylib_cffi.* build
|
||||
python setup.py bdist_wheel
|
||||
}
|
||||
|
||||
build 3.9.5
|
||||
build 3.8.10
|
||||
build 3.7.10
|
||||
build 3.6.13
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# Raspberry Pi native (non-X) build assumes the GPU libraries are installed in /opt/vc, as per Raspbian.
|
||||
# Raylib must be installed the compiled with: cmake -DWITH_PIC=ON -DSHARED=ON -DSTATIC=ON -DPLATFORM='Raspberry Pi' ..
|
||||
|
||||
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"
|
||||
""",
|
||||
extra_link_args=['/usr/local/lib/libraylib.a',
|
||||
'/opt/vc/lib/libEGL_static.a', '/opt/vc/lib/libGLESv2_static.a',
|
||||
'-L/opt/vc/lib', '-lvcos', '-lbcm_host', '-lbrcmEGL', '-lbrcmGLESv2',
|
||||
'-lm', '-lpthread', '-lrt'],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
if ! command -v pyenv &> /dev/null
|
||||
then
|
||||
echo "Pyenv required: https://github.com/pyenv/pyenv-installer"
|
||||
exit
|
||||
fi
|
||||
rm *arm-linux-gnueabihf.so
|
||||
pyenv install -s 3.9.1
|
||||
pyenv global 3.9.1
|
||||
pip3 install cffi
|
||||
python3 build_rpi_nox.py
|
||||
pyenv install -s 3.8.7
|
||||
pyenv global 3.8.7
|
||||
pip3 install cffi
|
||||
python3 build_rpi_nox.py
|
||||
pyenv install -s 3.7.9
|
||||
pyenv global 3.7.9
|
||||
pip3 install cffi
|
||||
python3 build_rpi_nox.py
|
||||
pyenv install -s 3.6.12
|
||||
pyenv global 3.6.12
|
||||
pip3 install cffi
|
||||
python3 build_rpi_nox.py
|
|
@ -1,17 +0,0 @@
|
|||
# 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 ', '').replace('bool','int'))
|
||||
ffibuilder.set_source("_raylib_cffi",
|
||||
"""
|
||||
#include "../raylib.h"
|
||||
""",
|
||||
extra_link_args=['/NODEFAULTLIB:MSVCRTD'],
|
||||
libraries=['raylib_static', 'gdi32', 'shell32', 'user32','OpenGL32', 'winmm'],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ffibuilder.compile(verbose=True)
|
Reference in a new issue