2024-01-28 15:16:11 +00:00
|
|
|
# SPDX-FileCopyrightText: © 2022-2024 Decompollaborate
|
2022-06-04 16:28:51 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2022-06-06 21:14:17 +00:00
|
|
|
from setuptools import setup, Extension
|
2023-04-18 02:40:07 +00:00
|
|
|
from pathlib import Path
|
2023-04-30 13:47:00 +00:00
|
|
|
import platform
|
2022-06-04 15:19:03 +00:00
|
|
|
|
2023-04-18 02:40:07 +00: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 21:03:27 +00:00
|
|
|
headersList = [str(x) for x in bindingsPath.glob("**/*.h")] + [str(x) for x in srcPath.glob("**/*.h")]
|
2022-06-04 15:19:03 +00:00
|
|
|
|
2023-04-30 13:47:00 +00:00
|
|
|
extraCompileArgs = ["-std=c11", "-Wall", "-g",]
|
|
|
|
if platform.system() == "Linux":
|
2023-04-30 14:00:04 +00:00
|
|
|
extraCompileArgs += ["-Os", "-Wextra",]
|
2023-04-30 13:47:00 +00: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"]
|
|
|
|
|
2022-06-04 15:19:03 +00:00
|
|
|
setup(
|
|
|
|
ext_modules=[
|
|
|
|
Extension(
|
2022-06-10 18:50:23 +00:00
|
|
|
name="rabbitizer",
|
2023-04-18 02:40:07 +00:00
|
|
|
sources=sourcesList,
|
2023-05-02 23:01:54 +00:00
|
|
|
include_dirs=["include", "rabbitizer", "tables"],
|
2023-04-30 13:47:00 +00:00
|
|
|
extra_compile_args = extraCompileArgs,
|
2023-09-22 21:03:27 +00:00
|
|
|
depends=headersList,
|
2022-06-04 15:19:03 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|