CMakeLists.txt 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. option(LIBIGL_EXPORT_TARGETS "Export libigl CMake targets" ${LIBIGL_TOPLEVEL_PROJECT})
  14. # USE_STATIC_LIBRARY speeds up the generation of multiple binaries,
  15. # at the cost of a longer initial compilation time
  16. # (by default, static build is off since libigl is a header-only library)
  17. option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" ON)
  18. # All dependencies that are downloaded as cmake projects and tested on the auto-builds are ON
  19. # (by default, all build options are off)
  20. option(LIBIGL_WITH_COMISO "Use CoMiso" ON)
  21. option(LIBIGL_WITH_EMBREE "Use Embree" ON)
  22. option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
  23. option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON)
  24. option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" ON)
  25. option(LIBIGL_WITH_PNG "Use PNG" ON)
  26. option(LIBIGL_WITH_TETGEN "Use Tetgen" ON)
  27. option(LIBIGL_WITH_TRIANGLE "Use Triangle" ON)
  28. option(LIBIGL_WITH_XML "Use XML" ON)
  29. option(LIBIGL_WITH_PYTHON "Use Python" ${LIBIGL_BUILD_PYTHON})
  30. ### End
  31. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  32. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  33. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  34. ### conditionally compile certain modules depending on libraries found on the system
  35. list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
  36. ### Adding libIGL: choose the path to your local copy libIGL
  37. include(libigl)
  38. if(LIBIGL_BUILD_TUTORIALS)
  39. add_subdirectory(tutorial)
  40. endif()
  41. if(LIBIGL_BUILD_TESTS)
  42. include(CTest)
  43. enable_testing()
  44. add_subdirectory(tests)
  45. endif()
  46. if(LIBIGL_WITH_PYTHON)
  47. add_subdirectory(python)
  48. endif()