separate mac linux builds

This commit is contained in:
Richard Smith 2019-05-21 21:20:01 +01:00
parent c019d59298
commit f40f6aff04
5 changed files with 50 additions and 10 deletions

View file

@ -1,6 +1,6 @@
# Python Bindings for Raylib # Python Bindings for Raylib
This uses CFFI API static bindins rather than ctypes. Hopefully this will be faster, the static type knowledge from the C This uses CFFI API static bindings rather than ctypes. Hopefully this will be faster, the static type knowledge from the C
headers will result in fewer bugs, and using the original headers will make it easier to maintain. headers will result in fewer bugs, and using the original headers will make it easier to maintain.
Currently the goal is make usage as similar to the original C as CFFI will allow. There are a few differences Currently the goal is make usage as similar to the original C as CFFI will allow. There are a few differences
@ -9,9 +9,28 @@ done yet.
See test.py and examples/*.py for how to use. See test.py and examples/*.py for how to use.
# Installing
MacOS: Python 3.7: we distribute a statically linked Raylib library, so in theory the only thing you need to do is install
us from Pypi.
pip3 install -i https://test.pypi.org/simple/ raylib
Linux: Python 3.6: we dont distribute Raylib, so you must have Raylib 2.5dev already installed on your system.
pip3 install -i https://test.pypi.org/simple/ raylib
If you're using a different version of Python, or using Windows, or maybe a Linux/Mac with incompatible libraries
you will have to build.
cd raylib
python3 build_linux.py
python3 build_mac.py
# Platforms tested # Platforms tested
* MacOS 10.12.6 * MacOS 10.12.6 - Python 3.7
* Ubuntu 18.04 LTS - Python 3.6
# HELP WANTED # HELP WANTED

View file

@ -1,4 +1,4 @@
__version__ = "2.5.dev1" __version__ = "2.5.dev2"
from ._raylib_cffi import ffi, lib as rl from ._raylib_cffi import ffi, lib as rl
from _raylib_cffi.lib import * from _raylib_cffi.lib import *

View file

@ -1,3 +1,5 @@
# Linux build assumes raylib, GL, etc are all already installed as system libraries. We dont distribute them.
from cffi import FFI from cffi import FFI
import os import os
import platform import platform
@ -18,11 +20,7 @@ ffibuilder.set_source("_raylib_cffi",
libraries=['raylib','GL','m','pthread', 'dl', 'rt', 'X11'] libraries=['raylib','GL','m','pthread', 'dl', 'rt', 'X11']
) )
# Hack to produce static linked lib
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__": if __name__ == "__main__":
ffibuilder.compile(verbose=True) ffibuilder.compile(verbose=True)
if platform.system()=="Darwin":
print(command)
os.system(command)

23
raylib/build_mac.py Normal file
View 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
"""
)
# Hack to produce static linked lib
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)

View file

@ -10,13 +10,13 @@ README = (HERE / "README.md").read_text()
# This call to setup() does all the work # This call to setup() does all the work
setup( setup(
name="raylib", name="raylib",
version="2.5.dev1", version="2.5.dev2",
description="Python CFFI bindings for Raylib", description="Python CFFI bindings for Raylib",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
url="https://github.com/electronstudio/raylib-python-cffi", url="https://github.com/electronstudio/raylib-python-cffi",
author="Electron Studio", author="Electron Studio",
author_email="richard@electronstudio.co.uk", author_email="github@electronstudio.co.uk",
license="LGPLv3+", license="LGPLv3+",
classifiers=[ classifiers=[
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",