You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2021/09/03 22:02:30 UTC

[datasketches-cpp] branch pybind_build_dependency updated (0d3635f -> 40342e5)

This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a change to branch pybind_build_dependency
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git.


    from 0d3635f  fix python compile issues on ubuntu+gcc10 docker by redefining constants in namespaces rather than inside class template
     add 5f970e5  add sdist build to workflow
     add 0c3535b  grab dependencies in sdist build
     add 594a903  add wheel to sdist build since the log complains about it missing
     new 18fbdcf  Merge branch 'pybind_build_dependency' of github.com:apache/datasketches-cpp into pybind_build_dependency
     new 40342e5  Changes to support wheels on Windows

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/build_wheels.yml | 33 +++++++++++++++++++++++++++++----
 CMakeLists.txt                     |  2 ++
 pyproject.toml                     |  7 ++++---
 python/CMakeLists.txt              | 17 +++++++++--------
 python/pybind11Path.cmd            |  3 +++
 setup.py                           |  7 ++++---
 6 files changed, 51 insertions(+), 18 deletions(-)
 create mode 100644 python/pybind11Path.cmd

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[datasketches-cpp] 02/02: Changes to support wheels on Windows

Posted by jm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch pybind_build_dependency
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit 40342e5a025cf0d18578ed600a380ed7c8bbf780
Author: Jon Malkin <jm...@users.noreply.github.com>
AuthorDate: Fri Sep 3 15:02:14 2021 -0700

    Changes to support wheels on Windows
---
 CMakeLists.txt          |  2 ++
 pyproject.toml          |  7 ++++---
 python/CMakeLists.txt   | 17 +++++++++--------
 python/pybind11Path.cmd |  3 +++
 setup.py                |  7 ++++---
 5 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e87448e..c1b8e80 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,8 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
 #set(CMAKE_VERBOSE_MAKEFILE ON)
 set(CMAKE_MACOSX_RPATH ON)
 
+set(CMAKE_CXX_STANDARD 11)
+
 # enable compiler warnings globally
 # derived from https://foonathan.net/blog/2018/10/17/cmake-warnings.html
 # and https://arne-mertz.de/2018/07/cmake-properties-options/
diff --git a/pyproject.toml b/pyproject.toml
index a989be3..eabadd4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,9 +1,10 @@
 [build-system]
 requires = ["wheel",
             "setuptools >= 30.3.0",
-            "setuptools_scm",
             "cmake >= 3.12",
-            "pybind11[global] >= 2.6.0"]
+            "pip >= 10.0",
+            "pybind11 >= 2.6.0"]
+build-backend = "setuptools.build_meta"
 
 [tool.tox]
 legacy_tox_ini = """
@@ -13,7 +14,7 @@ envlist = py3
 [testenv]
 deps = pytest
        numpy
-       pybind11[global] >= 2.6.0
+       pybind11 >= 2.6.0
 changedir = python/tests
 commands = pytest
 """
\ No newline at end of file
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 4da7b9d..f541b93 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -15,18 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# TODO: Can we force python version >= 3.0?
+find_package(Python3 COMPONENTS Interpreter Development)
+
+# only Windows+MSVC seems to have trouble locating pybind11
 if (MSVC)
-  set(PYBIND11_CPP_STANDARD /std:c++11)
-else()
-  set(PYBIND11_CPP_STANDARD -std=c++11)
+  execute_process(COMMAND cmd.exe /c ${CMAKE_CURRENT_SOURCE_DIR}/pybind11Path.cmd "${Python3_EXECUTABLE}"
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+      OUTPUT_VARIABLE EXTRA_PACKAGE_PATH)
+  set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${EXTRA_PACKAGE_PATH})
 endif()
 
-find_package(Python3 COMPONENTS Interpreter Development)
-find_package(pybind11 CONFIG)
-#add_subdirectory(pybind11)
+find_package(pybind11 CONFIG REQUIRED)
 
-#pybind11_add_module(python MODULE EXCLUDE_FROM_ALL SYSTEM THIN_LTO)
 pybind11_add_module(python MODULE EXCLUDE_FROM_ALL THIN_LTO)
 
 target_link_libraries(python
diff --git a/python/pybind11Path.cmd b/python/pybind11Path.cmd
new file mode 100644
index 0000000..650625b
--- /dev/null
+++ b/python/pybind11Path.cmd
@@ -0,0 +1,3 @@
+@echo off
+:: Takes path to the Python interpreter and returns the path to pybind11
+%1 -m pip show pybind11 | %1 -c "import sys,re;[sys.stdout.write(re.sub('^Location:\\s+','',line)) for line in sys.stdin if re.search('^Location:\\s+',line)]"
diff --git a/setup.py b/setup.py
index a84954e..d3d89e5 100644
--- a/setup.py
+++ b/setup.py
@@ -60,7 +60,8 @@ class CMakeBuild(build_ext):
                            cfg.upper(),
                            extdir)]
             if sys.maxsize > 2**32:
-                cmake_args += ['-A', 'x64']
+                cmake_args += ['-T', 'host=x64']
+                cmake_args += ['DCMAKE_GENERATOR_PLATFORM=x64']
                 build_args += ['--', '/m']
         else:
             cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
@@ -75,7 +76,7 @@ class CMakeBuild(build_ext):
         subprocess.check_call(['cmake', ext.sourcedir] + cmake_args,
                               cwd=self.build_temp, env=env)
         subprocess.check_call(['cmake', '--build', '.', '--target', 'python'] + build_args,
-                              cwd=self.build_temp)
+                              cwd=self.build_temp, env=env)
         print() # add an empty line to pretty print
 
 setup(
@@ -92,6 +93,6 @@ setup(
     # may need to add all source paths for sdist packages w/o MANIFEST.in
     ext_modules=[CMakeExtension('datasketches')],
     cmdclass={'build_ext': CMakeBuild},
-    setup_requires=['setuptools_scm','tox-setuptools'],
+    install_requires=['numpy', 'pybind11 >= 2.6.0'],
     zip_safe=False
 )

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[datasketches-cpp] 01/02: Merge branch 'pybind_build_dependency' of github.com:apache/datasketches-cpp into pybind_build_dependency

Posted by jm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch pybind_build_dependency
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit 18fbdcf0c30c5ee9599732b5fb88961dcef8c494
Merge: 594a903 0d3635f
Author: Jon Malkin <jm...@users.noreply.github.com>
AuthorDate: Fri Sep 3 12:12:58 2021 -0700

    Merge branch 'pybind_build_dependency' of github.com:apache/datasketches-cpp into pybind_build_dependency

 .gitmodules                                     |  3 ---
 common/include/common_defs.hpp                  |  2 ++
 cpc/include/cpc_common.hpp                      | 13 ++++++++++---
 cpc/include/cpc_sketch.hpp                      |  2 +-
 cpc/include/cpc_union.hpp                       |  2 +-
 kll/include/kll_sketch.hpp                      |  9 +++++++--
 pyproject.toml                                  |  4 +++-
 python/CMakeLists.txt                           |  7 +++++--
 python/pybind11                                 |  1 -
 python/src/cpc_wrapper.cpp                      |  2 +-
 python/src/kll_wrapper.cpp                      |  2 +-
 python/src/theta_wrapper.cpp                    |  4 ++--
 python/src/vector_of_kll.cpp                    | 16 +++++++++++-----
 sampling/include/var_opt_sketch.hpp             | 15 ++++++++++-----
 sampling/include/var_opt_sketch_impl.hpp        |  2 +-
 setup.py                                        |  3 ++-
 theta/include/theta_constants.hpp               | 13 +++++++++----
 theta/include/theta_update_sketch_base.hpp      |  7 +++++--
 theta/include/theta_update_sketch_base_impl.hpp |  6 +++++-
 19 files changed, 76 insertions(+), 37 deletions(-)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org