CMakeLists.txt 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. cmake_minimum_required(VERSION 3.1)
  2. # Toggles the use of the hunter package manager
  3. option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
  4. include("cmake/HunterGate.cmake")
  5. HunterGate(
  6. URL "https://github.com/ruslo/hunter/archive/v0.23.171.tar.gz"
  7. SHA1 "5d68bcca78eee347239ca5f4d34f4b6c12683154"
  8. )
  9. project(libigl)
  10. # Detects whether this is a top-level project
  11. get_directory_property(LIBIGL_PARENT_DIR PARENT_DIRECTORY)
  12. if(NOT LIBIGL_PARENT_DIR)
  13. set(LIBIGL_TOPLEVEL_PROJECT ON)
  14. else()
  15. set(LIBIGL_TOPLEVEL_PROJECT OFF)
  16. endif()
  17. # Build tests and tutorials
  18. option(LIBIGL_BUILD_TESTS "Build libigl unit test" ${LIBIGL_TOPLEVEL_PROJECT})
  19. option(LIBIGL_BUILD_TUTORIALS "Build libigl tutorial" ${LIBIGL_TOPLEVEL_PROJECT})
  20. option(LIBIGL_EXPORT_TARGETS "Export libigl CMake targets" ${LIBIGL_TOPLEVEL_PROJECT})
  21. # USE_STATIC_LIBRARY speeds up the generation of multiple binaries,
  22. # at the cost of a longer initial compilation time
  23. # (by default, static build is off since libigl is a header-only library)
  24. option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" ON)
  25. # All dependencies that are downloaded as cmake projects and tested on the auto-builds are ON
  26. # (by default, all build options are off)
  27. option(LIBIGL_WITH_COMISO "Use CoMiso" ON)
  28. option(LIBIGL_WITH_EMBREE "Use Embree" ON)
  29. option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
  30. option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON)
  31. option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" ON)
  32. option(LIBIGL_WITH_PNG "Use PNG" ON)
  33. option(LIBIGL_WITH_TETGEN "Use Tetgen" ON)
  34. option(LIBIGL_WITH_TRIANGLE "Use Triangle" ON)
  35. option(LIBIGL_WITH_PREDICATES "Use exact predicates" ON)
  36. option(LIBIGL_WITH_XML "Use XML" ON)
  37. option(LIBIGL_WITH_PYTHON "Use Python" OFF)
  38. ### End
  39. if(${LIBIGL_WITH_PYTHON})
  40. message(FATAL_ERROR "Python binding are in the process of being redone. Please use the master branch or refer to https://github.com/geometryprocessing/libigl-python-bindings for the developement version or https://anaconda.org/conda-forge/igl for the stable version.")
  41. endif()
  42. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  43. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  44. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  45. ### conditionally compile certain modules depending on libraries found on the system
  46. list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
  47. ### Adding libIGL: choose the path to your local copy libIGL
  48. include(libigl)
  49. if(LIBIGL_BUILD_TUTORIALS)
  50. add_subdirectory(tutorial)
  51. endif()
  52. if(LIBIGL_BUILD_TESTS)
  53. include(CTest)
  54. enable_testing()
  55. add_subdirectory(tests)
  56. endif()
  57. if(LIBIGL_TOPLEVEL_PROJECT)
  58. # Set folders for Visual Studio/Xcode
  59. igl_set_folders()
  60. endif()