From a1393414a714546cd8f0fa83c6f5446a6762ecb2 Mon Sep 17 00:00:00 2001 From: Yixing Lao Date: Mon, 8 Oct 2018 18:38:48 -0700 Subject: [PATCH] windows compatibility fix --- src/Python/CMakeLists.txt | 2 +- src/Python/install_pip_wheel.cmake | 33 ++++++++++++++++++++++++++++ src/Python/make_all_pip_wheels.cmake | 8 +++---- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 src/Python/install_pip_wheel.cmake diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt index 51a6f59d108a..696f8b034d98 100644 --- a/src/Python/CMakeLists.txt +++ b/src/Python/CMakeLists.txt @@ -106,7 +106,7 @@ add_custom_target(all-pip-wheels COMMAND ${CMAKE_COMMAND} -DPYTHON_PACKAGE_SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}/Package -DPYTHON_PACKAGE_DST_DIR=${PYTHON_PACKAGE_DST_DIR} - -DPYTHON_COMPILED_MODULE_PATH=${PYTHON_COMPILED_MODULE_DIR}/$ + -DPYTHON_COMPILED_MODULE_PATH=$ -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DPROJECT_EMAIL=${PROJECT_EMAIL} -DPROJECT_HOME=${PROJECT_HOME} diff --git a/src/Python/install_pip_wheel.cmake b/src/Python/install_pip_wheel.cmake new file mode 100644 index 000000000000..2f91caf39bfb --- /dev/null +++ b/src/Python/install_pip_wheel.cmake @@ -0,0 +1,33 @@ +# ---------------------------------------------------------------------------- +# - Open3D: www.open3d.org - +# ---------------------------------------------------------------------------- +# The MIT License (MIT) +# +# Copyright (c) 2018 www.open3d.org +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# ---------------------------------------------------------------------------- + +# We need this file for cross-platform support on Windows +# For Ubuntu/Mac, we can simply do `pip install ${PYTHON_PACKAGE_DST_DIR}/dist/*.whl -U` + +# Note: Since `make python-package` clears PYTHON_COMPILED_MODULE_DIR every time, +# it is guaranteed that there is only one wheel in ${PYTHON_PACKAGE_DST_DIR}/dist/*.whl +file(GLOB WHEEL_FILE "${PYTHON_PACKAGE_DST_DIR}/dist/*.whl") +execute_process(COMMAND pip install ${WHEEL_FILE} -U) diff --git a/src/Python/make_all_pip_wheels.cmake b/src/Python/make_all_pip_wheels.cmake index 62107d61dbf7..d448db8ab100 100644 --- a/src/Python/make_all_pip_wheels.cmake +++ b/src/Python/make_all_pip_wheels.cmake @@ -24,10 +24,10 @@ # IN THE SOFTWARE. # ---------------------------------------------------------------------------- -# Create python pacakge. It contains -# 1) Pure-python code and misc files, copied from src/Python/Package -# 2) The compiled python-C++ module, i.e. open3d.so (or the equivalents) -# 3) Configured files and supporting files +# Warning: Internal use only, consider droping this in the future +# Use `make all-pip-wheels` to create the pip package in the build directory +# This creates: open3d-python, py3d, open3d-original, open3d-official, open-3d +# pip wheels # Clean up directory file(REMOVE_RECURSE ${PYTHON_PACKAGE_DST_DIR})