Skip to content

Commit

Permalink
Introduce DEBUG var in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Baekalfen committed Feb 16, 2025
1 parent 74c5025 commit 39795c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

CYTHON = platform.python_implementation() == "CPython"
ROOT_DIR = "pyboy"
DEBUG = bool(os.getenv("GITHUB_ACTIONS"))

if not CYTHON:
setup()
Expand Down Expand Up @@ -56,6 +57,8 @@ def initialize_options(self):
multiprocessing.set_start_method("fork", force=True)

cflags = ["-O3"]
if not DEBUG:
cflags.append("-DCYTHON_WITHOUT_ASSERTIONS")
# NOTE: For performance. Check if other platforms need an equivalent change.
if sys.platform == "darwin":
cflags.append("-DCYTHON_INLINE=inline __attribute__ ((__unused__)) __attribute__((always_inline))")
Expand All @@ -66,7 +69,7 @@ def initialize_options(self):
src.split(".")[0].replace(os.sep, "."),
[src],
extra_compile_args=cflags,
extra_link_args=["-s", "-w"],
extra_link_args=[] if DEBUG else ["-s", "-w"],
include_dirs=[np.get_include()],
),
list(py_pxd_files),
Expand Down

0 comments on commit 39795c2

Please sign in to comment.