Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build python bindings #1008

Merged
merged 7 commits into from Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmake/LibiglDownloadExternal.cmake
Expand Up @@ -35,7 +35,7 @@ endfunction()
function(igl_download_comiso)
igl_download_project(CoMISo
GIT_REPOSITORY https://github.com/libigl/CoMISo.git
GIT_TAG fea3ee0ba7d42ee3eca202d484e4fad855e4d6aa
GIT_TAG 1f9618cf9b7bd77370d817976470d59091928606
)
endfunction()

Expand Down Expand Up @@ -69,7 +69,7 @@ endfunction()
function(igl_download_glad)
igl_download_project(glad
GIT_REPOSITORY https://github.com/libigl/libigl-glad.git
GIT_TAG 71e35fe685a0cc160068a2f2f971c40b82d14af0
GIT_TAG 09b4969c56779f7ddf8e6176ec1873184aec890f
)
endfunction()

Expand Down Expand Up @@ -105,15 +105,15 @@ endfunction()
function(igl_download_stb)
igl_download_project(stb
GIT_REPOSITORY https://github.com/libigl/libigl-stb.git
GIT_TAG e671ceb3def5e7029a23de14c55dc16301ad4dab
GIT_TAG edfa26e389060c21b9dd7812a0b19c00208b7224
)
endfunction()

## TetGen
function(igl_download_tetgen)
igl_download_project(tetgen
GIT_REPOSITORY https://github.com/libigl/tetgen.git
GIT_TAG d2dcc33cb8551f16e302c8130ce12fa52992cd09
GIT_REPOSITORY https://github.com/jdumas/tetgen.git
GIT_TAG 63b4bdc5b947f9db75f01e0da36af54074ace5c9
)
endfunction()

Expand All @@ -128,8 +128,8 @@ endfunction()
## Triangle
function(igl_download_triangle)
igl_download_project(triangle
GIT_REPOSITORY https://github.com/libigl/triangle.git
GIT_TAG d6761dd691e2e1318c83bf7773fea88d9437464a
GIT_REPOSITORY https://github.com/jdumas/triangle.git
GIT_TAG 2cd0672ff1f67f9f6bb8e556e84901293e637b76
)
endfunction()

Expand Down
11 changes: 2 additions & 9 deletions cmake/libigl.cmake
Expand Up @@ -83,15 +83,8 @@ if(MSVC)
endif()
endif()

if(BUILD_SHARED_LIBS)
# Generate position independent code
set_target_properties(igl_common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON)
endif()

if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif()
# Generate position independent code
set_target_properties(igl_common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON)

# Eigen
if(TARGET Eigen3::Eigen)
Expand Down
24 changes: 14 additions & 10 deletions python/CMakeLists.txt
@@ -1,6 +1,19 @@
cmake_minimum_required(VERSION 2.8.12)
project(pyigl)

### Adding libIGL: choose the path to your local copy libIGL
if(NOT TARGET igl::core)
### Prefer header-only mode for compiling Python bindings
if(NOT LIBIGL_WITH_PYTHON OR NOT LIBIGL_USE_STATIC_LIBRARY)
message(FATAL_ERROR
"Trying to compile Python bindings without -DLIBIGL_WITH_PYTHON=ON. "
"Either enable manually all the necessary options, or compile from "
"the root folder with -DLIBIGL_USE_STATIC_LIBRARY=OFF")
endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../cmake")
include(libigl)
endif()

# Force a specific python version
# set(PYTHON_LIBRARIES "D:/Python34/libs/python34.lib")
# set(PYTHON_INCLUDE_DIR "D:/Python34/include")
Expand All @@ -13,22 +26,13 @@ set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)


string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
if(NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -flto")
endif()
endif()

## libigl
if(NOT TARGET igl::core)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../cmake")
include(libigl)
endif()

## include pybind
set(PYBIND11_DIR ${PROJECT_SOURCE_DIR}/../external/pybind11 CACHE PATH "Path to pybind11")
add_subdirectory(${PYBIND11_DIR} pybind11)
Expand All @@ -42,7 +46,7 @@ pybind11_add_module(pyigl
)

## Add dependencies
target_include_directories(pyigl PUBLIC igl::core)
target_link_libraries(pyigl PUBLIC igl::core)

## Optional modules
if(LIBIGL_WITH_OPENGL_GLFW)
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/001_BasicTypes.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/101_FileIO.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/102_DrawMesh.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/102_DrawMesh_TCP.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/103_Events.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/104_Colors.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/105_Overlays.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/201_Normals.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/202_GaussianCurvature.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/203_CurvatureDirections.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/204_Gradient.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/205_Laplacian.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/301_Slice.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/302_Sort.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/303_LaplaceEquation.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/304_LinearEqualityConstraints.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/305_QuadraticProgramming.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/306_EigenDecomposition.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/401_BiharmonicDeformation.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/402_PolyharmonicDeformation.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/403_BoundedBiharmonicWeights.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/404_DualQuaternionSkinning.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/405_AsRigidAsPossible.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/501_HarmonicParam.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/502_LSCMParam.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/503_ARAPParam.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/504_NRosyDesign.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/505_MIQ.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/507_Planarization.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/604_Triangle.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/605_Tetgen.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/606_AmbientOcclusion.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/607_ScreenCapture.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/609_Boolean.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/701_Statistics.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/702_WindingNumber.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/704_SignedDistance.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/705_MarchingCubes.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/706_FacetOrientation.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/707_SweptVolume.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions python/tutorial/708_Picking.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down
4 changes: 3 additions & 1 deletion python/tutorial/709_VectorFieldVisualizer.py 100644 → 100755
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
Expand Down Expand Up @@ -130,4 +132,4 @@ def main():
viewer.launch()

if __name__ == "__main__":
main()
main()
2 changes: 1 addition & 1 deletion python/tutorial/shared.py
Expand Up @@ -9,7 +9,7 @@
import sys
import os

TUTORIAL_SHARED_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../tutorial/shared/")
TUTORIAL_SHARED_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../tutorial/data/")

def check_dependencies(deps):
available = [hasattr(igl, m) for m in deps]
Expand Down