Skip to content

Commit

Permalink
Cython setup: include /EHsc compiler flag for Windows to specify the …
Browse files Browse the repository at this point in the history
…exception handling model so we print full exception info with traceback in case GH action fails.
  • Loading branch information
jfranmatheu committed Mar 6, 2025
1 parent 29b0ba5 commit 2bb8842
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions cy_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,20 @@ def build_for_architecture(arch):

# Base compiler flags for all platforms
compiler_flags = {
'Windows': ['/O2', '/std:c++17'], # MSVC flags
'Darwin': ['-O3', '-std=c++17'], # macOS/Clang flags
'Linux': ['-O3', '-std=c++17'] # Linux/GCC flags
'Windows': ['/O2', '/std:c++17', '/EHsc'], # Added /EHsc for Windows
'Darwin': ['-O3', '-std=c++17'],
'Linux': ['-O3', '-std=c++17']
}

# Get base optimization flag for current platform
extra_compile_args = compiler_flags.get(platform.system(), ['-O3', '-std=c++17'])
system = platform.system()
extra_compile_args = compiler_flags.get(system, ['-O3', '-std=c++17'])
extra_link_args = []

# Add debug output
print(f"System: {system}")
print(f"Compiler flags: {extra_compile_args}")

# Add architecture flags only for macOS
if platform.system() == 'Darwin' and arch:
# Let ARCHFLAGS environment variable handle the architecture
Expand Down Expand Up @@ -123,11 +128,17 @@ def create_extensions_from_pyx_files():
'language_level': 3,
'boundscheck': False,
'wraparound': False,
}),
},
# Add verbose output for debugging
force=True,
),
zip_safe=False,
)
except Exception as e:
print(f"Error: {e}")
print(f"Error during setup: {str(e)}")
print("Exception details:", e.__class__.__name__)
import traceback
traceback.print_exc()
failed = True

if not failed:
Expand Down

0 comments on commit 2bb8842

Please sign in to comment.