Closed ReMiOS closed 1 year ago
This doesn't work on my machine, it selects clang as compiler for all files and then fails with
error: invalid argument '-std=c++11' not allowed with 'C'
So instead of removing we can try to refine the check inside setup.py
clang [...] -c src/freetype/src/autofit/autofit.c -o build/temp.macosx-13-arm64-cpython-310/src/freetype/src/autofit/autofit.o -DFT2_BUILD_LIBRARY -std=c++11
That's not nice .. Too bad i don't have an apple workstation
Does this work for you ?
class custom_build_ext(build_ext): def build_extensions(self): self.compiler.set_executable("compiler_so",self.compiler.executable_filename) build_ext.build_extensions(self)
These are the members of build_ext.compiler on Windows MEMBER ('init', <bound method MSVCCompiler.init object ) MEMBER ('_check_macro_definitions', <bound method CCompiler._check_macro_definitions object ) MEMBER ('_compile', <bound method CCompiler._compile object ) MEMBER ('_configure', <bound method MSVCCompiler._configure of <class 'distutils._msvccompiler.MSVCCompiler'>>) MEMBER ('_fallback_spawn', <bound method MSVCCompiler._fallback_spawn object ) MEMBER ('_find_macro', <bound method CCompiler._find_macro object ) MEMBER ('_fix_compile_args', <bound method CCompiler._fix_compile_args object ) MEMBER ('_fix_lib_args', <bound method CCompiler._fix_lib_args object ) MEMBER ('_fix_object_args', <bound method CCompiler._fix_object_args object ) MEMBER ('_get_cc_args', <bound method CCompiler._get_cc_args object ) MEMBER ('_make_out_path', <bound method CCompiler._make_out_path object ) MEMBER ('_need_link', <bound method CCompiler._need_link object ) MEMBER ('_prep_compile', <bound method CCompiler._prep_compile object ) MEMBER ('_setup_compile', <bound method CCompiler._setup_compile object ) MEMBER ('add_include_dir', <bound method CCompiler.add_include_dir object ) MEMBER ('add_library', <bound method CCompiler.add_library object ) MEMBER ('add_library_dir', <bound method CCompiler.add_library_dir object ) MEMBER ('add_link_object', <bound method CCompiler.add_link_object object ) MEMBER ('add_runtime_library_dir', <bound method CCompiler.add_runtime_library_dir object ) MEMBER ('announce', <bound method CCompiler.announce object ) MEMBER ('compile', <bound method MSVCCompiler.compile object ) MEMBER ('create_static_lib', <bound method MSVCCompiler.create_static_lib object ) MEMBER ('debug_print', <bound method CCompiler.debug_print object ) MEMBER ('define_macro', <bound method CCompiler.define_macro object ) MEMBER ('detect_language', <bound method CCompiler.detect_language object ) MEMBER ('executable_filename', <bound method CCompiler.executable_filename object ) MEMBER ('execute', <bound method CCompiler.execute object ) MEMBER ('find_library_file', <bound method MSVCCompiler.find_library_file object ) MEMBER ('has_function', <bound method CCompiler.has_function object ) MEMBER ('initialize', <bound method MSVCCompiler.initialize object ) MEMBER ('library_dir_option', <bound method MSVCCompiler.library_dir_option object ) MEMBER ('library_filename', <bound method CCompiler.library_filename object ) MEMBER ('library_option', <bound method MSVCCompiler.library_option object ) MEMBER ('link', <bound method MSVCCompiler.link object ) MEMBER ('link_executable', <bound method CCompiler.link_executable object ) MEMBER ('link_shared_lib', <bound method CCompiler.link_shared_lib object ) MEMBER ('link_shared_object', <bound method CCompiler.link_shared_object object ) MEMBER ('mkpath', <bound method CCompiler.mkpath object ) MEMBER ('move_file', <bound method CCompiler.move_file object ) MEMBER ('object_filenames', <bound method CCompiler.object_filenames object ) MEMBER ('preprocess', <bound method CCompiler.preprocess object ) MEMBER ('runtime_library_dir_option', <bound method MSVCCompiler.runtime_library_dir_option object ) MEMBER ('set_executable', <bound method CCompiler.set_executable object ) MEMBER ('set_executables', <bound method CCompiler.set_executables object ) MEMBER ('set_include_dirs', <bound method CCompiler.set_include_dirs object ) MEMBER ('set_libraries', <bound method CCompiler.set_libraries object ) MEMBER ('set_library_dirs', <bound method CCompiler.set_library_dirs object ) MEMBER ('set_link_objects', <bound method CCompiler.set_link_objects object ) MEMBER ('set_runtime_library_dirs', <bound method CCompiler.set_runtime_library_dirs object ) MEMBER ('shared_object_filename', <bound method CCompiler.shared_object_filename object ) MEMBER ('spawn', <bound method MSVCCompiler.spawn object ) MEMBER ('undefine_macro', <bound method CCompiler.undefine_macro object ) MEMBER ('warn', <bound method CCompiler.warn object )
Hey @ReMiOS, I've just wrapped the compiler manipulation part in a try/except clause for now, so it should work again for you as well
Hey Matthijs,
Thanks ! The try, except clause fixed building on Windows
I would like to fix a Warning as well (syntax is different on windows) cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
Could you add the following in setup.py ? if os.name == 'nt': linker_libs = ['Ole32','AdvAPI32','shell32'] extra_compile_args = [ "-DFT2_BUILD_LIBRARY", "/std:c++latest" ] else: linker_libs = [] extra_compile_args = [ "-DFT2_BUILD_LIBRARY", "-std=c++11" ]
cXpdfPython = Extension( .. snip code .. libraries = linker_libs, extra_compile_args = extra_compile_args, .. snip code .. )
Closed request to make new changes possible
Unfortunately can't sync the fork ... "protected branch 'main' check failed: Changes must be made through a pull request. Cannot force-push to this branch"
Can you discard the Pull Request ?
I made the changes you requested!
Thanks !
setup.py AttributeError: 'MSVCCompiler' object has no attribute 'compiler_cxx'
src\PdfLoader.cc src\xpydf\PdfLoader.cc(167): error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
Tested on Both Windows (MVSC) and Ubuntu (GCC)