From 18f31bacc148db7d372d9807c9aa35ef28239627 Mon Sep 17 00:00:00 2001 From: Ruben Vorderman Date: Mon, 30 Jan 2023 10:18:04 +0100 Subject: [PATCH] Enable macos --- .github/workflows/ci.yml | 8 +++----- setup.py | 16 ++++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26ee812..611269d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,8 +63,8 @@ jobs: - "pypy-3.9" os: ["ubuntu-latest"] include: -# - os: "macos-latest" -# python-version: 3.7 + - os: "macos-latest" + python-version: 3.7 - os: "windows-latest" python-version: 3.7 steps: @@ -81,9 +81,7 @@ jobs: uses: ilammy/msvc-dev-cmd@v1.6.0 if: runner.os == 'Windows' - name: Install build dependencies (MacOS) - run: brew install ninja - env: - HOMEBREW_NO_INSTALL_CLEANUP: 1 + run: brew install make if: runner.os == 'macOS' - name: Run tests run: tox diff --git a/setup.py b/setup.py index 1e38e85..e6899f6 100644 --- a/setup.py +++ b/setup.py @@ -104,12 +104,16 @@ def build_zlib_ng(): build_env["CFLAGS"] = build_env.get("CFLAGS", "") + " -fPIC" # Add -fPIC flag to allow static compilation run_args = dict(cwd=build_dir, env=build_env) - subprocess.run(["cmake", build_dir], **run_args) - # Do not create test suite and do not perform tests to shorten build times. - # There is no need when stable releases of zlib-ng are used. - subprocess.run(["cmake", "--build", build_dir, "--config", "Release", - "--target", "zlibstatic", - "-j", str(cpu_count)], **run_args) + if sys.platform == "darwin": # Cmake does not work properly + subprocess.run([os.path.join(build_dir, "configure")], **run_args) + subprocess.run(["gmake", "libz-ng.a"], **run_args) + else: + subprocess.run(["cmake", build_dir], **run_args) + # Do not create test suite and do not perform tests to shorten build times. + # There is no need when stable releases of zlib-ng are used. + subprocess.run(["cmake", "--build", build_dir, "--config", "Release", + "--target", "zlibstatic", + "-j", str(cpu_count)], **run_args) if BUILD_CACHE: BUILD_CACHE_FILE.write_text(build_dir) return build_dir