Skip to content

Commit

Permalink
Provide a hook for fixing broken MSVC build environments
Browse files Browse the repository at this point in the history
  • Loading branch information
culler committed May 23, 2023
1 parent da6988d commit da3f6a2
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,34 @@
break
if not compiler_set and 'build' in sys.argv:
sys.argv.append('--compiler=msvc')
try:
# To customize your msvc environment create msvc_env.py
# and define the dict dev_env to be a copy of the os.environ
# that you have when you run python in the Command Prompt for
# your installation of Visual Studio.
from msvc_env import dev_env
os.environ.update(dev_env)
MSVC_extra_objects = []
except:
# This creates a default environment which works on our CI runner
if cpu_width == '64bit':
MSVC_extra_objects = [
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\Uuid.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\kernel32.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\ucrt\x64\ucrt.lib',
]
else:
MSVC_extra_objects = [
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\Uuid.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\kernel32.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\ucrt\x86\ucrt.lib',
os.path.abspath(os.path.join('Windows', 'gcc', 'libgcc.a')),
]
else:
ext_compiler = ''

# Path setup for building with the mingw C compiler on Windows.
if sys.platform == 'win32':
if sys.platform == 'win32' and not os.path.exists('libcache/pari64'):
# We always build the Pari library with mingw, no matter which compiler
# is used for the CyPari extension.
# Make sure that our C compiler matches our python and that we can run bash
Expand Down Expand Up @@ -116,20 +139,6 @@
r'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared'
]

if cpu_width == '64bit':
MSVC_extra_objects = [
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\Uuid.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\kernel32.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\ucrt\x64\ucrt.lib',
]
else:
MSVC_extra_objects = [
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\Uuid.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\kernel32.lib',
r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\ucrt\x86\ucrt.lib',
os.path.abspath(os.path.join('Windows', 'gcc', 'libgcc.a')),
]

class CyPariClean(Command):
user_options = []
def initialize_options(self):
Expand Down

0 comments on commit da3f6a2

Please sign in to comment.