Skip to content

Commit

Permalink
Compiles separate targets to comply with copyleft licenses (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgsellan authored Aug 9, 2022
1 parent 28b40e8 commit 3239237
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
32 changes: 23 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ add_library(cpytoolbox
src/cpp/remesher/split_edges_until_bound.h
src/cpp/remesher/split_edges.h
src/cpp/remesher/tangential_relaxation.h
src/cpp/swept_volume/fd_interpolate.cpp
src/cpp/swept_volume/gradient_descent_test.cpp
src/cpp/swept_volume/random_points_on_mesh.cpp
src/cpp/swept_volume/sparse_continuation.cpp
src/cpp/swept_volume/swept_volume.cpp
# Source
src/cpp/upper_envelope.cpp
src/cpp/ray_mesh_intersect_aabb.cpp
Expand All @@ -51,6 +46,17 @@ add_library(cpytoolbox
src/cpp/remesher/split_edges_until_bound.cpp
src/cpp/remesher/split_edges.cpp
src/cpp/remesher/tangential_relaxation.cpp
)

add_library(cpytoolbox_copyleft
SHARED
# Headers
src/cpp/swept_volume/fd_interpolate.cpp
src/cpp/swept_volume/gradient_descent_test.cpp
src/cpp/swept_volume/random_points_on_mesh.cpp
src/cpp/swept_volume/sparse_continuation.cpp
src/cpp/swept_volume/swept_volume.cpp
# Source
src/cpp/swept_volume/fd_interpolate.h
src/cpp/swept_volume/gradient_descent_test.h
src/cpp/swept_volume/random_points_on_mesh.h
Expand All @@ -59,24 +65,32 @@ add_library(cpytoolbox
)

# target_link_libraries(cpytoolbox igl::core igl_copyleft::cgal igl::embree)
target_link_libraries(cpytoolbox igl::core igl::embree igl_copyleft::cgal)
target_link_libraries(cpytoolbox igl::core igl::embree )
target_link_libraries(cpytoolbox_copyleft igl::core igl_copyleft::cgal)


npe_add_module(gpytoolbox_bindings
BINDING_SOURCES
src/cpp/binding_offset_surface.cpp
src/cpp/binding_booleans.cpp
src/cpp/binding_ray_mesh_intersect.cpp
src/cpp/binding_upper_envelope.cpp
src/cpp/binding_in_element_aabb.cpp
src/cpp/binding_decimate.cpp
src/cpp/binding_remesher_botsch.cpp
src/cpp/binding_write_obj.cpp
src/cpp/binding_read_obj.cpp
)

npe_add_module(gpytoolbox_bindings_copyleft
BINDING_SOURCES
src/cpp/binding_booleans.cpp
src/cpp/binding_swept_volume.cpp
)

# target_link_libraries(gpytoolbox_bindings PUBLIC cpytoolbox igl::core igl_copyleft::cgal)
target_link_libraries(gpytoolbox_bindings PUBLIC cpytoolbox igl::core igl_copyleft::cgal)
target_link_libraries(gpytoolbox_bindings PUBLIC cpytoolbox igl::core)

target_link_libraries(gpytoolbox_bindings_copyleft PUBLIC cpytoolbox cpytoolbox_copyleft igl::core igl_copyleft::cgal)

target_include_directories(gpytoolbox_bindings PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src/cpp")
target_include_directories(gpytoolbox_bindings PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src/cpp")
target_include_directories(gpytoolbox_bindings_copyleft PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src/cpp")
2 changes: 1 addition & 1 deletion src/gpytoolbox/copyleft/do_meshes_intersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def do_meshes_intersect(V1,F1,V2,F2):
"""

try:
from gpytoolbox_bindings import _do_meshes_intersect_cpp_impl
from gpytoolbox_bindings_copyleft import _do_meshes_intersect_cpp_impl
except:
raise ImportError("Gpytoolbox cannot import its C++ binding.")

Expand Down
6 changes: 3 additions & 3 deletions src/gpytoolbox/copyleft/mesh_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def mesh_boolean(V1,F1,V2,F2,boolean_type='union'):
"""

try:
from gpytoolbox_bindings import _mesh_union_cpp_impl
from gpytoolbox_bindings import _mesh_intersection_cpp_impl
from gpytoolbox_bindings import _mesh_difference_cpp_impl
from gpytoolbox_bindings_copyleft import _mesh_union_cpp_impl
from gpytoolbox_bindings_copyleft import _mesh_intersection_cpp_impl
from gpytoolbox_bindings_copyleft import _mesh_difference_cpp_impl
except:
raise ImportError("Gpytoolbox cannot import its C++ binding.")

Expand Down
2 changes: 1 addition & 1 deletion src/gpytoolbox/copyleft/swept_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def swept_volume(V,F,transformations=None,rotations=None,translations=None,align
"""

try:
from gpytoolbox_bindings import _swept_volume_impl
from gpytoolbox_bindings_copyleft import _swept_volume_impl
except:
raise ImportError("Gpytoolbox cannot import its C++ binding.")

Expand Down

0 comments on commit 3239237

Please sign in to comment.