Skip to content

Commit 9726a8b

Browse files
committed
Use build arg instead of env variable to enable dev features
Signed-off-by: Greg Bonik <gbonik@nvidia.com>
1 parent cd70462 commit 9726a8b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ else()
3030
endif()
3131
endif()
3232

33+
option(ENABLE_DEV_FEATURES "Enable development-only features" OFF)
34+
3335
option(ENABLE_COVERAGE_FOR_TESTS "Enable code coverage for tests" OFF)
3436
set(test_coverage_options)
3537

cext/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ target_link_options(_cext PUBLIC ${cext_link_flags} ${nostdlib_flags})
5252

5353
set_target_properties(_cext PROPERTIES SKIP_BUILD_RPATH TRUE)
5454

55-
if ("$ENV{CUDA_TILE_ENABLE_DEV_FEATURES}")
55+
if (ENABLE_DEV_FEATURES)
5656
target_compile_definitions(_cext PRIVATE CUDA_TILE_ENABLE_DEV_FEATURES)
5757
endif()
5858

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
class BuildExtWithCmake(build_ext):
1717
user_options = build_ext.user_options + [
1818
('disable-internal', None, 'Disable building internal extension'),
19+
('enable-dev-features', None, 'Enable development-only features'),
1920
]
2021

2122
def initialize_options(self):
2223
super().initialize_options()
2324
self.disable_internal = False
25+
self.enable_dev_features = False
2426

2527
def finalize_options(self):
2628
super().finalize_options()
@@ -43,6 +45,8 @@ def _cmake(self, build_dir: str, build_type: str, dlpack_path: str):
4345
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5"]
4446
if self.disable_internal:
4547
cmake_cmd.append("-DDISABLE_INTERNAL=1")
48+
if self.enable_dev_features:
49+
cmake_cmd.append("-DENABLE_DEV_FEATURES=1")
4650
self.spawn(cmake_cmd)
4751

4852
def run(self):

0 commit comments

Comments
 (0)