From c3aacbd9aa1a9987ea9108f4d1336603cbc52104 Mon Sep 17 00:00:00 2001 From: Dave Deriso Date: Sun, 25 Aug 2024 22:46:35 -0700 Subject: [PATCH] attemping to fix windows --- .github/workflows/build_windows.yml | 10 ++++++++++ setup.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index dcb1a51..c872c8e 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -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/setup-msbuild@v1.0.2 + - 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: diff --git a/setup.py b/setup.py index 8307274..8e085ee 100755 --- a/setup.py +++ b/setup.py @@ -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