mirror of https://github.com/mgba-emu/mgba.git
Python: Python 3 support
This commit is contained in:
parent
0723646354
commit
33295b1297
|
@ -1,3 +1,5 @@
|
||||||
|
find_program(PYTHON python)
|
||||||
|
|
||||||
set(PY_INCLUDE_DIRS -I${CMAKE_SOURCE_DIR}/src)
|
set(PY_INCLUDE_DIRS -I${CMAKE_SOURCE_DIR}/src)
|
||||||
get_property(INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
get_property(INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||||
get_property(COMPILE_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
|
get_property(COMPILE_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
|
||||||
|
@ -15,13 +17,13 @@ add_custom_command(OUTPUT _builder.h
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.h)
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.h)
|
||||||
add_custom_target(_builder.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_builder.h)
|
add_custom_target(_builder.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_builder.h)
|
||||||
|
|
||||||
add_custom_target(${BINARY_NAME}-pylib COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py ${PY_COMPILE_DEFS} ${PY_INCLUDE_DIRS}
|
add_custom_target(${BINARY_NAME}-pylib COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py ${PY_COMPILE_DEFS} ${PY_INCLUDE_DIRS}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py
|
||||||
DEPENDS _builder.h)
|
DEPENDS _builder.h)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${BINARY_NAME}/__init__.py
|
add_custom_command(OUTPUT ${BINARY_NAME}/__init__.py
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
|
||||||
COMMAND python ${CMAKE_CURRENT_BINARY_DIR}/setup.py build
|
COMMAND ${PYTHON} ${CMAKE_CURRENT_BINARY_DIR}/setup.py build
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setup.py
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setup.py
|
||||||
DEPENDS ${BINARY_NAME}-pylib)
|
DEPENDS ${BINARY_NAME}-pylib)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
|
|
||||||
class _ARMRegisters:
|
class _ARMRegisters:
|
||||||
def __init__(self, cpu):
|
def __init__(self, cpu):
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
|
|
||||||
def find(path):
|
def find(path):
|
||||||
core = lib.mCoreFind(path.encode('UTF-8'))
|
core = lib.mCoreFind(path.encode('UTF-8'))
|
||||||
|
@ -31,7 +31,7 @@ def loadVF(vf):
|
||||||
|
|
||||||
class Core:
|
class Core:
|
||||||
def __init__(self, native):
|
def __init__(self, native):
|
||||||
self._core = ffi.gc(native, self._deinit)
|
self._core = ffi.gc(native, native.deinit)
|
||||||
success = bool(self._core.init(self._core))
|
success = bool(self._core.init(self._core))
|
||||||
if not success:
|
if not success:
|
||||||
raise RuntimeError("Failed to initialize core")
|
raise RuntimeError("Failed to initialize core")
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
|
|
||||||
class GB:
|
class GB:
|
||||||
def __init__(self, native):
|
def __init__(self, native):
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
|
|
||||||
class GBA:
|
class GBA:
|
||||||
def __init__(self, native):
|
def __init__(self, native):
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
from . import png
|
from . import png
|
||||||
|
|
||||||
class Image:
|
class Image:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
|
|
||||||
class LR35902Core:
|
class LR35902Core:
|
||||||
def __init__(self, native):
|
def __init__(self, native):
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
from . import vfs
|
from . import vfs
|
||||||
|
|
||||||
class PNG:
|
class PNG:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
from _pylib import ffi, lib
|
from ._pylib import ffi, lib
|
||||||
import mmap
|
import mmap
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import re
|
||||||
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Programming Language :: Python :: 2",
|
"Programming Language :: Python :: 2",
|
||||||
# "Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)"
|
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ setup(name="${BINARY_NAME}",
|
||||||
author_email="jeffrey@endrift.com",
|
author_email="jeffrey@endrift.com",
|
||||||
url="http://github.com/mgba-emu/mgba/",
|
url="http://github.com/mgba-emu/mgba/",
|
||||||
packages=["mgba"],
|
packages=["mgba"],
|
||||||
|
setup_requires=['cffi>=1.6'],
|
||||||
|
install_requires=['cffi>=1.6'],
|
||||||
license="MPL 2.0",
|
license="MPL 2.0",
|
||||||
classifiers=classifiers
|
classifiers=classifiers
|
||||||
)
|
)
|
Loading…
Reference in New Issue