Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove options from setup.py #1288

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 1 addition & 48 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,6 @@
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext

if "--debug" in sys.argv:
DEBUG_MODE = True
sys.argv.remove("--debug")
else:
DEBUG_MODE = False

if "--enable-profiling" in sys.argv:
ENABLE_PROFILING = True
sys.argv.remove("--enable-profiling")
else:
ENABLE_PROFILING = False

if "--skip_tests" in sys.argv:
SKIP_BUILDING_TESTS = True
sys.argv.remove("--skip_tests")
else:
SKIP_BUILDING_TESTS = False

if "--disable_lto" in sys.argv:
SKIP_LTO = True
sys.argv.remove("--disable_lto")
else:
SKIP_LTO = False

if "--cpp17" in sys.argv:
USE_CPP17 = True
sys.argv.remove("--cpp17")
else:
USE_CPP17 = False

# if '--assert' in sys.argv:
# ASSERT_MODE = True
# sys.argv.remove('--assert')
# else:
# ASSERT_MODE = False


class CMakeExtension(Extension):
def __init__(self, name, sourcedir=""):
Expand Down Expand Up @@ -81,7 +45,7 @@ def build_extension(self, ext):
"-DCMAKE_BUILD=OFF",
]

cfg = "Debug" if DEBUG_MODE is True else "Release"
cfg = "Release"

build_args = ["--config", cfg]

Expand All @@ -96,24 +60,13 @@ def build_extension(self, ext):
cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]
build_args += ["--", "-j2"]

if ENABLE_PROFILING is True:
cmake_args += ["-DENABLE_PROFILING=ON"]

env = os.environ.copy()
env["CXXFLAGS"] = '{} -DVERSION_INFO=\\"{}\\"'.format(
env.get("CXXFLAGS", ""), self.distribution.get_version()
)

if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
if SKIP_BUILDING_TESTS is True:
cmake_args.append("-DBUILD_PYTHON_UNIT_TESTS=OFF")

if SKIP_LTO is True:
cmake_args.append("-DDISABLE_LTO=ON")

if USE_CPP17 is True:
cmake_args.append("-DUSECPP17=ON")

subprocess.check_call(
["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env
Expand Down