2024-01-28 12:16:11 -03:00
|
|
|
# SPDX-FileCopyrightText: © 2022-2024 Decompollaborate
|
2022-06-04 12:28:51 -04:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2022-06-06 17:14:17 -04:00
|
|
|
from setuptools import setup, Extension
|
2023-04-17 22:40:07 -04:00
|
|
|
from pathlib import Path
|
2023-04-30 09:47:00 -04:00
|
|
|
import platform
|
2022-06-04 11:19:03 -04:00
|
|
|
|
2023-04-17 22:40:07 -04:00
|
|
|
bindingsPath = Path("rabbitizer")
|
|
|
|
srcPath = Path("src")
|
|
|
|
|
|
|
|
sourcesList = [str(x) for x in bindingsPath.glob("**/*.c")] + [str(x) for x in srcPath.glob("**/*.c")]
|
2023-09-22 18:03:27 -03:00
|
|
|
headersList = [str(x) for x in bindingsPath.glob("**/*.h")] + [str(x) for x in srcPath.glob("**/*.h")]
|
2022-06-04 11:19:03 -04:00
|
|
|
|
2023-04-30 09:47:00 -04:00
|
|
|
extraCompileArgs = ["-std=c11", "-Wall", "-g",]
|
|
|
|
if platform.system() == "Linux":
|
2023-04-30 10:00:04 -04:00
|
|
|
extraCompileArgs += ["-Os", "-Wextra",]
|
2023-04-30 09:47:00 -04:00
|
|
|
extraCompileArgs += ["-Werror=vla", "-Werror=switch", "-Werror=implicit-fallthrough", "-Werror=unused-function", "-Werror=unused-parameter", "-Werror=shadow", "-Werror=switch"]
|
|
|
|
extraCompileArgs += ["-Werror=implicit-function-declaration", "-Werror=incompatible-pointer-types"]
|
|
|
|
extraCompileArgs += ["-Werror"]
|
2024-04-03 12:41:26 -03:00
|
|
|
extraCompileArgs += ["-Wno-nonnull-compare"]
|
2023-04-30 09:47:00 -04:00
|
|
|
|
2022-06-04 11:19:03 -04:00
|
|
|
setup(
|
|
|
|
ext_modules=[
|
|
|
|
Extension(
|
2022-06-10 14:50:23 -04:00
|
|
|
name="rabbitizer",
|
2023-04-17 22:40:07 -04:00
|
|
|
sources=sourcesList,
|
2023-05-02 19:01:54 -04:00
|
|
|
include_dirs=["include", "rabbitizer", "tables"],
|
2023-04-30 09:47:00 -04:00
|
|
|
extra_compile_args = extraCompileArgs,
|
2023-09-22 18:03:27 -03:00
|
|
|
depends=headersList,
|
2022-06-04 11:19:03 -04:00
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|