Skip to content

Commit

Permalink
attemping to fix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dderiso committed Aug 26, 2024
1 parent f43f1c9 commit c3aacbd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel twine numpy
- name: Install Visual C++ Build Tools
uses: microsoft/[email protected]

- name: Build wheel
run: |
python setup.py bdist_wheel
env:
PYTHONPATH: ${{ env.pythonLocation }}
DISTUTILS_USE_SDK: "1"
MSSdk: "1"

- name: Debug output
run: |
dir /s build
type build\temp.win-amd64-cpython-311\Release\gdtw\gdtwcpp.cp311-win_amd64.lib
- name: Publish Wheel
env:
Expand Down
10 changes: 10 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,27 @@ def build_extensions(self):
cc = None
if "CC" in os.environ:
cc = os.environ["CC"]

elif sys.platform == 'darwin':
cc = "g++"
self.compiler.compiler_so.append('-stdlib=libc++')
self.compiler.compiler.append('-stdlib=libc++')
# self.compiler.compiler_so.append('-target x86_64-apple-macos')
# self.compiler.compiler.append('-target x86_64-apple-macos')

elif sys.platform == "linux":
cc = "g++"
if '-Wstrict-prototypes' in self.compiler.compiler_so:
self.compiler.compiler_so.remove('-Wstrict-prototypes') # gets rid of a useless warning
self.compiler.compiler_so.append('-Wno-maybe-uninitialized')

elif sys.platform == "win32":
cc = "cl"
self.compiler.compiler_so.extend(['/EHsc', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD'])
# Ensure Visual C++ Build Tools are available
if not any(os.path.exists(os.path.join(path, 'cl.exe')) for path in os.environ['PATH'].split(os.pathsep)):
raise RuntimeError("Visual C++ Build Tools not found. Please ensure they are installed and properly set up.")

if cc is not None:
self.compiler.compiler_so[0] = cc
self.compiler.compiler[0] = cc
Expand Down

0 comments on commit c3aacbd

Please sign in to comment.