CMakeLists.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. cmake_minimum_required(VERSION 3.1)
  2. project(libigl)
  3. # Detects whether this is a top-level project
  4. if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
  5. set(LIBIGL_TOPLEVEL_PROJECT ON)
  6. else()
  7. set(LIBIGL_TOPLEVEL_PROJECT OFF)
  8. endif()
  9. # Build tests, tutorials and python bindings
  10. option(LIBIGL_BUILD_TESTS "Build libigl unit test" ${LIBIGL_TOPLEVEL_PROJECT})
  11. option(LIBIGL_BUILD_TUTORIALS "Build libigl tutorial" ${LIBIGL_TOPLEVEL_PROJECT})
  12. option(LIBIGL_BUILD_PYTHON "Build libigl python bindings" ${LIBIGL_TOPLEVEL_PROJECT})
  13. # USE_STATIC_LIBRARY speeds up the generation of multiple binaries,
  14. # at the cost of a longer initial compilation time
  15. # (by default, static build is off since libigl is a header-only library)
  16. option(LIBIGL_USE_STATIC_LIBRARY "Use LibIGL as static library" ON)
  17. # All dependencies that are downloaded as cmake projects and tested on the auto-builds are ON
  18. # (by default, all build options are off)
  19. option(LIBIGL_WITH_COMISO "Use CoMiso" ON)
  20. option(LIBIGL_WITH_EMBREE "Use Embree" ON)
  21. option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
  22. option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON)
  23. option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" ON)
  24. option(LIBIGL_WITH_PNG "Use PNG" ON)
  25. option(LIBIGL_WITH_TETGEN "Use Tetgen" ON)
  26. option(LIBIGL_WITH_TRIANGLE "Use Triangle" ON)
  27. option(LIBIGL_WITH_XML "Use XML" ON)
  28. option(LIBIGL_WITH_PYTHON "Use Python" ${LIBIGL_BUILD_PYTHON})
  29. ### End
  30. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  31. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  32. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  33. ### conditionally compile certain modules depending on libraries found on the system
  34. list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
  35. ### Adding libIGL: choose the path to your local copy libIGL
  36. include(libigl)
  37. if(LIBIGL_BUILD_TUTORIALS)
  38. add_subdirectory(tutorial)
  39. endif()
  40. if(LIBIGL_BUILD_TESTS)
  41. enable_testing()
  42. add_subdirectory(tests)
  43. endif()
  44. if(LIBIGL_WITH_PYTHON)
  45. add_subdirectory(python)
  46. endif()