From e9cce8339575a38898655fce909262f2dfc7d2d7 Mon Sep 17 00:00:00 2001 From: heck Date: Wed, 17 Feb 2021 21:48:52 +0100 Subject: [PATCH] Fix mac/linux build / make all CFLAGS platform specific --- setup.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 0fc446b..83a73e9 100644 --- a/setup.py +++ b/setup.py @@ -81,7 +81,13 @@ class BuildExtCommand(build_ext): 'boost_python38-vc142-mt-x32-1_72', 'boost_locale-vc142-mt-x32-1_72' ] - return (home, sys_includes, sys_libdirs, libs) + compile_flags = ['/std:c++14', '/permissive'] + if self.debug: + pEpLog("debug mode") + compile_flags += ['/O0', '/g', '/UNDEBUG'] + + return (home, sys_includes, sys_libdirs, libs, compile_flags) + def get_build_info_darwin(self): home = environ.get('PER_USER_DIRECTORY') or environ.get('HOME') @@ -97,7 +103,13 @@ class BuildExtCommand(build_ext): 'boost_python38-mt', 'boost_locale-mt' ] - return (home, sys_includes, sys_libdirs, libs) + compile_flags = ['-std=c++14', '-fpermissive'] + if self.debug: + pEpLog("debug mode") + compile_flags += ['-O0', '-g', '-UNDEBUG'] + + return (home, sys_includes, sys_libdirs, libs, compile_flags) + def get_build_info_linux(self): home = environ.get('PER_USER_DIRECTORY') or environ.get('HOME') @@ -116,7 +128,13 @@ class BuildExtCommand(build_ext): 'boost_python3', 'boost_locale' ] - return (home, sys_includes, sys_libdirs, libs) + compile_flags = ['-std=c++14', '-fpermissive'] + if self.debug: + pEpLog("debug mode") + compile_flags += ['-O0', '-g', '-UNDEBUG'] + + return (home, sys_includes, sys_libdirs, libs, compile_flags) + def finalize_options(self): build_ext.finalize_options(self) @@ -125,6 +143,7 @@ class BuildExtCommand(build_ext): pEpLog("prefix: ", self.prefix) pEpLog("sys.platform: ", sys.platform) + # get build information for platform if sys.platform == 'win32': build_info = self.get_build_info_win32() @@ -136,7 +155,7 @@ class BuildExtCommand(build_ext): pEpLog("Platform not supported:" + sys.platform) exit() - (home, sys_includes, sys_libdirs, libs) = build_info + (home, sys_includes, sys_libdirs, libs, compile_flags) = build_info # Build the Includes -I and Library paths -L # Start empty @@ -162,12 +181,6 @@ class BuildExtCommand(build_ext): includes += sys_includes libdirs += sys_libdirs - # Compile flags - compile_flags = ['/std:c++14', '/permissive'] if sys.platform == 'win32' else [ '--std:c++14', '--fpermissive' ] - if self.debug: - pEpLog("debug mode") - compile_flags += ['-O0', '-g', '-UNDEBUG'] - # Apply the build information global module_pEp module_pEp.include_dirs = includes