From 4e9314476c62884ae496e405feb799de52396c98 Mon Sep 17 00:00:00 2001 From: Niko Fink Date: Thu, 16 Nov 2023 15:43:10 +0100 Subject: [PATCH] new attempt at windows build --- .github/workflows/wheels.yml | 2 +- fix_Array_windows.patch | 219 +++++++++++++++++------------------ hatch_build.py | 17 ++- 3 files changed, 121 insertions(+), 117 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 116e495..4e13bf1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest ] # windows-latest + os: [ ubuntu-latest, macos-latest, windows-latest ] steps: - uses: actions/checkout@v3 diff --git a/fix_Array_windows.patch b/fix_Array_windows.patch index 95ad360..9b68596 100644 --- a/fix_Array_windows.patch +++ b/fix_Array_windows.patch @@ -4,76 +4,76 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/include/ogdf/basic/Array2D.h b/include/ogdf/basic/Array2D.h ---- a/include/ogdf/basic/Array2D.h (revision 7596a518d2b8a964523c2bbd86af360aa405c6cf) -+++ b/include/ogdf/basic/Array2D.h (date 1669110068224) -@@ -197,10 +197,11 @@ - void copy(const Array2D &array2); +--- a/include/ogdf/basic/Array2D.h (revision a4546cc009a133e174dceea02bca6eb45126e35a) ++++ b/include/ogdf/basic/Array2D.h (date 1700144964118) +@@ -201,9 +201,11 @@ + void copy(const Array2D& array2); }; +} - ++ //! Constructs the array with index set [\p a, ..., \p b]*[\p c, ..., \p d]. template --void Array2D::construct(int a, int b, int c, int d) -+void ogdf::Array2D::construct(int a, int b, int c, int d) - { +-void Array2D::construct(int a, int b, int c, int d) { ++void ogdf::Array2D::construct(int a, int b, int c, int d) { m_a = a; m_b = b; -@@ -227,7 +228,7 @@ + m_c = c; +@@ -229,7 +231,7 @@ //! Initializes the array with default constructor of \a E. template --void Array2D::initialize() -+void ogdf::Array2D::initialize() - { - E *pDest = m_pStart; +-void Array2D::initialize() { ++void ogdf::Array2D::initialize() { + E* pDest = m_pStart; try { -@@ -244,7 +245,7 @@ + for (; pDest < m_pStop; pDest++) { +@@ -246,7 +248,7 @@ //! Initializes the array with \p x. template --void Array2D::initialize(const E &x) -+void ogdf::Array2D::initialize(const E &x) - { - E *pDest = m_pStart; +-void Array2D::initialize(const E& x) { ++void ogdf::Array2D::initialize(const E& x) { + E* pDest = m_pStart; try { -@@ -261,7 +262,7 @@ + for (; pDest < m_pStop; pDest++) { +@@ -263,7 +265,7 @@ //! Call destructor of all elements. template --void Array2D::deconstruct() -+void ogdf::Array2D::deconstruct() - { +-void Array2D::deconstruct() { ++void ogdf::Array2D::deconstruct() { if (!std::is_trivially_destructible::value) { - for (E *pDest = m_pStart; pDest < m_pStop; pDest++) -@@ -272,7 +273,7 @@ + for (E* pDest = m_pStart; pDest < m_pStop; pDest++) { + pDest->~E(); +@@ -274,7 +276,7 @@ //! Copy \p array2. template --void Array2D::copy(const Array2D &array2) -+void ogdf::Array2D::copy(const ogdf::Array2D &array2) - { +-void Array2D::copy(const Array2D& array2) { ++void ogdf::Array2D::copy(const ogdf::Array2D& array2) { construct(array2.m_a, array2.m_b, array2.m_c, array2.m_d); -@@ -287,7 +288,7 @@ + if (m_pStart != 0) { +@@ -288,7 +290,7 @@ //! Computes the determinant via row expansion. template --float Array2D::det() const -+float ogdf::Array2D::det() const - { +-float Array2D::det() const { ++float ogdf::Array2D::det() const { // matrix must be quadratic OGDF_ASSERT(size1() == size2()); -@@ -315,7 +316,7 @@ + +@@ -315,7 +317,7 @@ // Expanding along the first row (Laplace's Formula) default: -- Array2D remMatrix(0, n-2, 0, n-2); // the remaining matrix -+ ogdf::Array2D remMatrix(0, n-2, 0, n-2); // the remaining matrix - for(column = c; column <= d; column++) { +- Array2D remMatrix(0, n - 2, 0, n - 2); // the remaining matrix ++ ogdf::Array2D remMatrix(0, n - 2, 0, n - 2); // the remaining matrix + for (column = c; column <= d; column++) { int rem_i = 0; int rem_j = 0; -@@ -340,4 +341,3 @@ +@@ -339,4 +341,3 @@ return determinant; } @@ -84,9 +84,9 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/include/ogdf/basic/Array.h b/include/ogdf/basic/Array.h ---- a/include/ogdf/basic/Array.h (revision 7596a518d2b8a964523c2bbd86af360aa405c6cf) -+++ b/include/ogdf/basic/Array.h (date 1669110428195) -@@ -772,9 +772,11 @@ +--- a/include/ogdf/basic/Array.h (revision a4546cc009a133e174dceea02bca6eb45126e35a) ++++ b/include/ogdf/basic/Array.h (date 1700145012037) +@@ -800,9 +800,11 @@ OGDF_NEW_DELETE }; @@ -94,105 +94,102 @@ diff --git a/include/ogdf/basic/Array.h b/include/ogdf/basic/Array.h + // enlarges storage for array and moves old entries template --void Array::expandArray(INDEX add) -+void ogdf::Array::expandArray(INDEX add) - { +-void Array::expandArray(INDEX add) { ++void ogdf::Array::expandArray(INDEX add) { INDEX sOld = size(), sNew = sOld + add; -@@ -793,7 +795,7 @@ + // expand allocated memory block +@@ -822,7 +824,7 @@ // enlarges array by add elements and sets new elements to x template --void Array::grow(INDEX add, const E &x) -+void ogdf::Array::grow(INDEX add, const E &x) - { - if(add == 0) return; - -@@ -807,7 +809,7 @@ +-void Array::grow(INDEX add, const E& x) { ++void ogdf::Array::grow(INDEX add, const E& x) { + if (add == 0) { + return; + } +@@ -838,7 +840,7 @@ // enlarges array by add elements (initialized with default constructor) template --void Array::grow(INDEX add) -+void ogdf::Array::grow(INDEX add) - { - if(add == 0) return; - -@@ -820,7 +822,7 @@ +-void Array::grow(INDEX add) { ++void ogdf::Array::grow(INDEX add) { + if (add == 0) { + return; + } +@@ -853,7 +855,7 @@ } template --void Array::construct(INDEX a, INDEX b) -+void ogdf::Array::construct(INDEX a, INDEX b) - { - m_low = a; m_high = b; - INDEX s = b-a+1; -@@ -839,7 +841,7 @@ - +-void Array::construct(INDEX a, INDEX b) { ++void ogdf::Array::construct(INDEX a, INDEX b) { + m_low = a; + m_high = b; + INDEX s = b - a + 1; +@@ -873,7 +875,7 @@ + } template --void Array::initialize() -+void ogdf::Array::initialize() - { - E *pDest = m_pStart; +-void Array::initialize() { ++void ogdf::Array::initialize() { + E* pDest = m_pStart; try { -@@ -855,7 +857,7 @@ - + for (; pDest < m_pStop; pDest++) { +@@ -889,7 +891,7 @@ + } template --void Array::initialize(const E &x) -+void ogdf::Array::initialize(const E &x) - { - E *pDest = m_pStart; +-void Array::initialize(const E& x) { ++void ogdf::Array::initialize(const E& x) { + E* pDest = m_pStart; try { -@@ -871,7 +873,7 @@ - + for (; pDest < m_pStop; pDest++) { +@@ -905,7 +907,7 @@ + } template --void Array::initialize(std::initializer_list initList) -+void ogdf::Array::initialize(std::initializer_list initList) - { - E *pDest = m_pStart; +-void Array::initialize(std::initializer_list initList) { ++void ogdf::Array::initialize(std::initializer_list initList) { + E* pDest = m_pStart; try { -@@ -888,7 +890,7 @@ - + for (const E& x : initList) { +@@ -921,7 +923,7 @@ + } template --void Array::deconstruct() -+void ogdf::Array::deconstruct() - { +-void Array::deconstruct() { ++void ogdf::Array::deconstruct() { if (!std::is_trivially_destructible::value) { - for (E *pDest = m_pStart; pDest < m_pStop; pDest++) -@@ -899,7 +901,7 @@ - + for (E* pDest = m_pStart; pDest < m_pStop; pDest++) { + pDest->~E(); +@@ -931,7 +933,7 @@ + } template --void Array::copy(const Array &array2) -+void ogdf::Array::copy(const ogdf::Array &array2) - { +-void Array::copy(const Array& array2) { ++void ogdf::Array::copy(const ogdf::Array& array2) { construct(array2.m_low, array2.m_high); -@@ -918,7 +920,7 @@ + if (m_pStart != nullptr) { +@@ -948,7 +950,7 @@ // permutes array a from a[l] to a[r] randomly template template --void Array::permute (INDEX l, INDEX r, RNG &rng) -+void ogdf::Array::permute (INDEX l, INDEX r, RNG &rng) - { +-void Array::permute(INDEX l, INDEX r, RNG& rng) { ++void ogdf::Array::permute(INDEX l, INDEX r, RNG& rng) { OGDF_ASSERT(low() <= l); OGDF_ASSERT(l <= high()); -@@ -933,9 +935,10 @@ + OGDF_ASSERT(low() <= r); +@@ -962,6 +964,8 @@ + } } - -+namespace ogdf{ - //! Prints array \p a to output stream \p os using delimiter \p delim. ++namespace ogdf { ++ + //! Prints array \p a to output stream \p os using delimiter \p delim. template --void print(std::ostream &os, const Array &a, char delim = ' ') -+void print(std::ostream &os, const ogdf::Array &a, char delim = ' ') - { - for (int i = a.low(); i <= a.high(); i++) { - if (i > a.low()) os << delim; -@@ -956,11 +959,10 @@ + void print(std::ostream& os, const Array& a, char delim = ' ') { +@@ -984,11 +988,10 @@ #include @@ -200,18 +197,18 @@ diff --git a/include/ogdf/basic/Array.h b/include/ogdf/basic/Array.h //! shift all items up to the last element of \p ind to the left template --void Array::leftShift(ArrayBuffer &ind) { -+void ogdf::Array::leftShift(ogdf::ArrayBuffer &ind) { +-void Array::leftShift(ArrayBuffer& ind) { ++void ogdf::Array::leftShift(ogdf::ArrayBuffer& ind) { const INDEX nInd = ind.size(); - if (nInd == 0) return; - -@@ -983,9 +985,7 @@ + if (nInd == 0) { + return; +@@ -1015,9 +1018,7 @@ } template --Array::Array(const ArrayBuffer &A) { -+ogdf::Array::Array(const ogdf::ArrayBuffer &A) { - construct(0,-1); +-Array::Array(const ArrayBuffer& A) { ++ogdf::Array::Array(const ogdf::ArrayBuffer& A) { + construct(0, -1); A.compactCopy(*this); } - diff --git a/hatch_build.py b/hatch_build.py index 4bed1cf..1c863ff 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -121,13 +121,20 @@ def initialize(self, version, build_data): CONFIG = "Debug" flags = [ - "-DCMAKE_BUILD_TYPE=" + CONFIG, "-DBUILD_SHARED_LIBS=ON", "-DCMAKE_INSTALL_PREFIX=%s" % self.cmake_install_dir, - "-DOGDF_USE_ASSERT_EXCEPTIONS=ON", # "-DOGDF_USE_ASSERT_EXCEPTIONS_WITH=ON_LIBUNWIND", - "-DOGDF_MEMORY_MANAGER=POOL_TS", - # "-DOGDF_MEMORY_MANAGER=MALLOC_TS", "-DOGDF_LEAK_CHECK=ON", + "-DCMAKE_BUILD_TYPE=" + CONFIG, "-DBUILD_SHARED_LIBS=ON", + "-DCMAKE_INSTALL_PREFIX=%s" % self.cmake_install_dir, "-DOGDF_WARNING_ERRORS=OFF", - "-DCMAKE_BUILD_RPATH=$ORIGIN;@loader_path", "-DCMAKE_INSTALL_RPATH=$ORIGIN;@loader_path", "-DMACOSX_RPATH=TRUE", + "-DCMAKE_BUILD_RPATH=$ORIGIN;@loader_path", "-DCMAKE_INSTALL_RPATH=$ORIGIN;@loader_path", + "-DMACOSX_RPATH=TRUE", ] + if CONFIG == "Debug" and not is_windows(): + flags.extend([ + "-DOGDF_USE_ASSERT_EXCEPTIONS=ON", # "-DOGDF_USE_ASSERT_EXCEPTIONS_WITH=ON_LIBUNWIND", + ]) + flags.extend([ + "-DOGDF_MEMORY_MANAGER=POOL_TS", + # "-DOGDF_MEMORY_MANAGER=MALLOC_TS", "-DOGDF_LEAK_CHECK=ON", + ]) self.run("cmake", self.ogdf_src_dir, *flags) # import IPython