CMakeLists.txt 2.4 KB

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