Skip to content

Commit

Permalink
remove options from setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Apr 9, 2024
1 parent 716c732 commit f06aecb
Showing 1 changed file with 1 addition and 48 deletions.
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

0 comments on commit f06aecb

Please sign in to comment.