Skip to content

Commit ab4cd9d

Browse files
committed
reduce shared library file size
1 parent ba9cfab commit ab4cd9d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
def get_extensions():
2020
Extension = CppExtension
2121
define_macros = []
22-
extra_compile_args = {'cxx': []}
22+
extra_compile_args = {'cxx': ['-O2']}
23+
extra_link_args = ['-s']
2324

2425
if WITH_CUDA:
2526
Extension = CUDAExtension
2627
define_macros += [('WITH_CUDA', None)]
2728
nvcc_flags = os.getenv('NVCC_FLAGS', '')
2829
nvcc_flags = [] if nvcc_flags == '' else nvcc_flags.split(' ')
29-
nvcc_flags += ['-arch=sm_35', '--expt-relaxed-constexpr']
30+
nvcc_flags += ['-arch=sm_35', '--expt-relaxed-constexpr', '-O2']
3031
extra_compile_args['nvcc'] = nvcc_flags
3132

3233
extensions_dir = osp.join(osp.dirname(osp.abspath(__file__)), 'csrc')
@@ -51,6 +52,7 @@ def get_extensions():
5152
include_dirs=[extensions_dir],
5253
define_macros=define_macros,
5354
extra_compile_args=extra_compile_args,
55+
extra_link_args=extra_link_args,
5456
)
5557
extensions += [extension]
5658

0 commit comments

Comments
 (0)