diff --git a/setup.py b/setup.py index 36412af5ca628efd51dd1dd84d44914a69e37aad..3f7d15b0fd6e4ef22e6b4895a53451396e138e81 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,17 @@ def get_config_schema(): IncludeDir, LibraryDir, Libraries, BoostLibraries, \ Switch, StringListOption, make_boost_base_options + import sys + if 'darwin' in sys.platform: + default_libs = [] + default_cxxflags = ['-arch', 'i386', '-arch', 'x86_64', + '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk'] + default_ldflags = default_cxxflags[:] + ["-Wl,-framework,OpenCL"] + else: + default_libs = ["OpenCL"] + default_cxxflags = [] + default_ldflags = [] + return ConfigSchema(make_boost_base_options() + [ BoostLibraries("python"), BoostLibraries("thread"), @@ -18,11 +29,11 @@ def get_config_schema(): IncludeDir("CL", []), LibraryDir("CL", []), - Libraries("CL", ["OpenCL"]), + Libraries("CL", default_libs), - StringListOption("CXXFLAGS", [], + StringListOption("CXXFLAGS", default_cxxflags, help="Any extra C++ compiler options to include"), - StringListOption("LDFLAGS", [], + StringListOption("LDFLAGS", default_ldflags, help="Any extra linker options to include"), ]) @@ -55,21 +66,6 @@ def main(): if conf["SHIPPED_CL_HEADERS"]: INCLUDE_DIRS.append('src/cl') - import sys - - if 'darwin' in sys.platform: - # Build for i386 & x86_64 since OpenCL doesn't run on PPC - if "-arch" not in conf["CXXFLAGS"]: - conf["CXXFLAGS"].extend(['-arch', 'i386']) - conf["CXXFLAGS"].extend(['-arch', 'x86_64']) - if "-arch" not in conf["LDFLAGS"]: - conf["LDFLAGS"].extend(['-arch', 'i386']) - conf["LDFLAGS"].extend(['-arch', 'x86_64']) - # Compile against 10.6 SDK, first to support OpenCL - conf["CXXFLAGS"].extend(['-isysroot', '/Developer/SDKs/MacOSX10.6.sdk']) - conf["LDFLAGS"].extend(['-isysroot', '/Developer/SDKs/MacOSX10.6.sdk']) - conf["LDFLAGS"].append("-Wl,-framework,OpenCL") - ext_kwargs = dict() if conf["CL_ENABLE_GL"]: