diff --git a/README.md b/README.md index 121905df..233b8917 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ WIP... Build -------- +Mac ``` $ qmake -spec macx-xcode ``` + +Windows +``` +From Start Menu, Open Visual Studio 2017 Tools Command Prompt: +C:\Program Files\Microsoft Visual Studio\2017\Community>cd C:\Users\IEUser\Desktop\dust3d +C:\Users\IEUser\Desktop\dust3d>qmake DEFINES+=BOOST_INCLUDEDIR=C:\dev\boost_1_55_0\boost_1_55_0 DEFINES+=CGAL_DIR=C:\dev\CGAL-4.11.1 +C:\Users\IEUser\Desktop\dust3d>nmake -f Makefile.Release +``` \ No newline at end of file diff --git a/dust3d.pro b/dust3d.pro index 3591b0b3..ca705656 100644 --- a/dust3d.pro +++ b/dust3d.pro @@ -1,7 +1,18 @@ QT += core widgets opengl -CONFIG += debug +CONFIG += release RESOURCES += resources.qrc +BOOST_INCLUDEDIR = $$(BOOST_INCLUDEDIR) +CGAL_DIR = $$(CGAL_DIR) + +isEmpty(BOOST_INCLUDEDIR) { + error("No BOOST_INCLUDEDIR define found in enviroment variables") +} + +isEmpty(CGAL_DIR) { + error("No CGAL_DIR define found in enviroment variables") +} + HUMAN_VERSION = "0.0-alpha1" REPOSITORY_URL = "https://github.com/huxingyi/dust3d" ISSUES_URL = "https://github.com/huxingyi/dust3d/issues" @@ -85,19 +96,54 @@ SOURCES += src/main.cpp HEADERS += src/version.h -INCLUDEPATH += ../meshlite/include -LIBS += -L../meshlite/target/debug -lmeshlite +win32 { + contains(QMAKE_TARGET.arch, x86_64) { + MESHLITE_DIR = thirdparty/meshlite/meshlite_unstable_vc14_x64 + } else { + MESHLITE_DIR = thirdparty/meshlite/meshlite_unstable_vc14_x86 + } + MESHLITE_LIBNAME = meshlite.dll + GMP_LIBNAME = libgmp-10 + MPFR_LIBNAME = libmpfr-4 + CGAL_LIBNAME = CGAL-vc140-mt-4.11.1 + CGAL_INCLUDEDIR = $$CGAL_DIR\include + CGAL_BUILDINCLUDEDIR = $$CGAL_DIR\build\include + CGAL_LIBDIR = $$CGAL_DIR\build\lib + GMP_INCLUDEDIR = $$CGAL_DIR\auxiliary\gmp\include + GMP_LIBDIR = $$CGAL_DIR\auxiliary\gmp\lib + MPFR_INCLUDEDIR = $$GMP_INCLUDEDIR + MPFR_LIBDIR = $$GMP_LIBDIR +} -INCLUDEPATH += /usr/local/opt/boost/include +unix { + MESHLITE_DIR = thirdparty/meshlite + MESHLITE_LIBNAME = meshlite + GMP_LIBNAME = gmp + MPFR_LIBNAME = mpfr + CGAL_LIBNAME = cgal + CGAL_INCLUDEDIR = $$CGAL_DIR/include + CGAL_BUILDINCLUDEDIR = $$CGAL_DIR/build/include + CGAL_LIBDIR = $$CGAL_DIR/build/lib + GMP_INCLUDEDIR = $$CGAL_DIR/auxiliary/gmp/include + GMP_LIBDIR = $$CGAL_DIR/auxiliary/gmp/lib + MPFR_INCLUDEDIR = $$GMP_INCLUDEDIR + MPFR_LIBDIR = $$GMP_LIBDIR +} -INCLUDEPATH += /usr/local/opt/gmp/include -LIBS += -L/usr/local/opt/gmp/lib -lgmp +INCLUDEPATH += $$MESHLITE_DIR +LIBS += -L$$MESHLITE_DIR -l$$MESHLITE_LIBNAME -INCLUDEPATH += /usr/local/opt/mpfr/include -LIBS += -L/usr/local/opt/mpfr/lib -lmpfr +INCLUDEPATH += $$BOOST_INCLUDEDIR -INCLUDEPATH += /usr/local/opt/cgal/include -LIBS += -L/usr/local/opt/cgal/lib -lCGAL +INCLUDEPATH += $$GMP_INCLUDEDIR +LIBS += -L$$GMP_LIBDIR -l$$GMP_LIBNAME + +INCLUDEPATH += $$MPFR_INCLUDEDIR +LIBS += -L$$MPFR_LIBDIR -l$$MPFR_LIBNAME + +INCLUDEPATH += $$CGAL_INCLUDEDIR +INCLUDEPATH += $$CGAL_BUILDINCLUDEDIR +LIBS += -L$$CGAL_LIBDIR -l$$CGAL_LIBNAME target.path = ./ INSTALLS += target diff --git a/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.dll b/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.dll new file mode 100644 index 00000000..00eb5c5f Binary files /dev/null and b/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.dll differ diff --git a/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.dll.lib b/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.dll.lib new file mode 100644 index 00000000..4c8dfbb0 Binary files /dev/null and b/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.dll.lib differ diff --git a/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.h b/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.h new file mode 100644 index 00000000..bf3640b1 --- /dev/null +++ b/thirdparty/meshlite/meshlite_unstable_vc14_x64/meshlite.h @@ -0,0 +1,50 @@ +#ifndef MESHLITE_H +#define MESHLITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +void *meshlite_create_context(void); +int meshlite_destroy_context(void *context); +int meshlite_merge(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_import(void *context, const char *filename); +int meshlite_export(void *context, int mesh_id, const char *filename); +int meshlite_clone(void *context, int from_mesh_id); +int meshlite_triangulate(void *context, int mesh_id); +int meshlite_is_triangulated_manifold(void *context, int mesh_id); +int meshlite_subdivide(void *context, int mesh_id); +int meshlite_union(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_diff(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_intersect(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_scale(void *context, int mesh_id, float value); +int meshlite_get_vertex_count(void *context, int mesh_id); +int meshlite_get_vertex_position_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_get_face_count(void *context, int mesh_id); +int meshlite_get_face_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_triangle_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_triangle_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_get_edge_count(void *context, int mesh_id); +int meshlite_get_edge_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_edge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_get_halfedge_count(void *context, int mesh_id); +int meshlite_get_halfedge_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_halfedge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_build(void *context, float *vertex_position_buffer, int vertex_count, int *face_index_buffer, int face_index_buffer_len); +int meshlite_bmesh_create(void *context); +int meshlite_bmesh_enable_debug(void *context, int bmesh_id, int enable); +int meshlite_bmesh_add_node(void *context, int bmesh_id, float x, float y, float z, float radius); +int meshlite_bmesh_add_edge(void *context, int bmesh_id, int first_node_id, int second_node_id); +int meshlite_bmesh_generate_mesh(void *context, int bmesh_id); +int meshlite_bmesh_get_node_base_norm(void *context, int bmesh_id, int node_id, float *norm_buffer); +int meshlite_bmesh_destroy(void *context, int bmesh_id); +int meshlite_bmesh_error_count(void *context, int bmesh_id); +int meshlite_combine_adj_faces(void *context, int mesh_id); +int meshlite_combine_coplanar_faces(void *context, int mesh_id); +int meshlite_trim(void *context, int mesh_id, int normalize); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.dll b/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.dll new file mode 100644 index 00000000..7c1396a0 Binary files /dev/null and b/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.dll differ diff --git a/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.dll.lib b/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.dll.lib new file mode 100644 index 00000000..f5816438 Binary files /dev/null and b/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.dll.lib differ diff --git a/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.h b/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.h new file mode 100644 index 00000000..bf3640b1 --- /dev/null +++ b/thirdparty/meshlite/meshlite_unstable_vc14_x86/meshlite.h @@ -0,0 +1,50 @@ +#ifndef MESHLITE_H +#define MESHLITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +void *meshlite_create_context(void); +int meshlite_destroy_context(void *context); +int meshlite_merge(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_import(void *context, const char *filename); +int meshlite_export(void *context, int mesh_id, const char *filename); +int meshlite_clone(void *context, int from_mesh_id); +int meshlite_triangulate(void *context, int mesh_id); +int meshlite_is_triangulated_manifold(void *context, int mesh_id); +int meshlite_subdivide(void *context, int mesh_id); +int meshlite_union(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_diff(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_intersect(void *context, int first_mesh_id, int second_mesh_id); +int meshlite_scale(void *context, int mesh_id, float value); +int meshlite_get_vertex_count(void *context, int mesh_id); +int meshlite_get_vertex_position_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_get_face_count(void *context, int mesh_id); +int meshlite_get_face_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_triangle_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_triangle_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_get_edge_count(void *context, int mesh_id); +int meshlite_get_edge_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_edge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_get_halfedge_count(void *context, int mesh_id); +int meshlite_get_halfedge_index_array(void *context, int mesh_id, int *buffer, int max_buffer_len); +int meshlite_get_halfedge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); +int meshlite_build(void *context, float *vertex_position_buffer, int vertex_count, int *face_index_buffer, int face_index_buffer_len); +int meshlite_bmesh_create(void *context); +int meshlite_bmesh_enable_debug(void *context, int bmesh_id, int enable); +int meshlite_bmesh_add_node(void *context, int bmesh_id, float x, float y, float z, float radius); +int meshlite_bmesh_add_edge(void *context, int bmesh_id, int first_node_id, int second_node_id); +int meshlite_bmesh_generate_mesh(void *context, int bmesh_id); +int meshlite_bmesh_get_node_base_norm(void *context, int bmesh_id, int node_id, float *norm_buffer); +int meshlite_bmesh_destroy(void *context, int bmesh_id); +int meshlite_bmesh_error_count(void *context, int bmesh_id); +int meshlite_combine_adj_faces(void *context, int mesh_id); +int meshlite_combine_coplanar_faces(void *context, int mesh_id); +int meshlite_trim(void *context, int mesh_id, int normalize); + +#ifdef __cplusplus +} +#endif + +#endif