Giter Site home page Giter Site logo

louqipzy / libigl-example-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from libigl/libigl-example-project

0.0 0.0 0.0 67 KB

A blank project example showing how to use libigl and cmake.

License: Mozilla Public License 2.0

C++ 33.47% CMake 66.53%

libigl-example-project's Introduction

libigl example project

A blank project example showing how to use libigl and cmake. Feel free and encouraged to copy or fork this project as a way of starting a new personal project using libigl.

Compile

Compile this project using the standard cmake routine:

mkdir build
cd build
cmake ..
make

This should find and build the dependencies and create a example binary.

Run

From within the build directory just issue:

./example

A glfw app should launch displaying a 3D cube.

Using other modules of libigl

This example project uses the igl::opengl::glfw::Viewer, therefore it requires the glfw module of libigl. This shows up in the CMakeLists.txt

igl_include(glfw)
…
target_link_libraries(${PROJECT_NAME} PUBLIC igl::glfw)

Suppose you also wanted to use the triangle module in libigl. Then you would change these to

igl_include(glfw)
igl_include(restricted triangle)
…
target_link_libraries(${PROJECT_NAME} PUBLIC igl::glfw igl_restricted::triangle)

The "restricted" appears in this case because the triangle library has a more restricted license than libigl. See other examples commented out in CMakeLists.txt.

Dependencies

The only dependencies are STL, Eigen, libigl and the dependencies of the igl::opengl::glfw::Viewer (OpenGL, glad and GLFW).

The CMake build system will automatically download libigl and its dependencies using CMake FetchContent, thus requiring no setup on your part.

Use a local copy of libigl

You can use the CMake cache variable FETCHCONTENT_SOURCE_DIR_LIBIGL when configuring your CMake project for the first time to aim it at a local copy of libigl instead.

cmake -DFETCHCONTENT_SOURCE_DIR_LIBIGL=<path-to-libigl> ..

When changing this value, do not forget to clear your CMakeCache.txt, or to update the cache variable via cmake-gui or ccmake.

libigl-example-project's People

Contributors

alecjacobson avatar jdumas avatar danielepanozzo avatar namdhari avatar hankstag avatar bruegeln avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.