CMakeLists.txt 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. cmake_minimum_required(VERSION 2.8.12)
  2. project(libigl_tutorials)
  3. ### libIGL options: choose between header only and compiled static library
  4. option(LIBIGL_USE_STATIC_LIBRARY "Use LibIGL as static library" ON)
  5. option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" ON)
  6. option(LIBIGL_WITH_NANOGUI "Use Nanogui menu" OFF)
  7. ### libIGL options: choose your dependencies (by default everything is OFF, in this example we need the viewer) ###
  8. option(LIBIGL_WITH_BBW "Use BBW" ON)
  9. find_package(CGAL QUIET)
  10. option(LIBIGL_WITH_CGAL "Use CGAL" "${CGAL_FOUND}")
  11. option(LIBIGL_WITH_COMISO "Use CoMiso" ON)
  12. option(LIBIGL_WITH_CORK "Use CORK" OFF)
  13. option(LIBIGL_WITH_EMBREE "Use Embree" ON)
  14. option(LIBIGL_WITH_LIM "Use LIM" ON)
  15. find_package(MATLAB QUIET)
  16. option(LIBIGL_WITH_MATLAB "Use Matlab" "${MATLAB_FOUND}")
  17. option(LIBIGL_WITH_MOSEK "Use MOSEK" "${MOSEK_FOUND}")
  18. option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
  19. option(LIBIGL_WITH_PNG "Use PNG" ON)
  20. option(LIBIGL_WITH_TETGEN "Use Tetgen" ON)
  21. option(LIBIGL_WITH_TRIANGLE "Use Triangle" ON)
  22. option(LIBIGL_WITH_XML "Use XML" ON)
  23. ### End to be tested ----
  24. ### libIGL options: decide if you want to use the functionalities that depends on cgal
  25. if(LIBIGL_WITH_CGAL) # Do not remove or move this block, cgal strange build system fails without it
  26. find_package(CGAL REQUIRED)
  27. set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "CGAL's CMAKE Setup is super annoying ")
  28. include(${CGAL_USE_FILE})
  29. endif()
  30. ### Adding libIGL: choose the path to your local copy libIGL ###
  31. ### This is going to compile everything you requested ###
  32. add_subdirectory("${PROJECT_SOURCE_DIR}/../shared/cmake" "libigl")
  33. ### Output directories
  34. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
  35. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
  36. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
  37. ### Compilation flags: adapt to your needs ###
  38. if(MSVC)
  39. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj") ### Enable parallel compilation
  40. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
  41. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
  42. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") # disable all warnings (not ideal but...)
  43. else()
  44. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") #### Libigl requires a modern C++ compiler that supports c++11
  45. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../" )
  46. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") # disable all warnings (not ideal but...)
  47. endif()
  48. # Enable openMP if possible
  49. #find_package(OpenMP)
  50. #if (OPENMP_FOUND AND NOT WIN32)
  51. # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
  52. # set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
  53. #endif()
  54. ### Prepare the build environment
  55. include_directories(${LIBIGL_INCLUDE_DIRS})
  56. add_definitions(${LIBIGL_DEFINITIONS})
  57. ### Choose which chapters to compile ###
  58. option(TUTORIALS_CHAPTER1 "Compile chapter 1" ON)
  59. option(TUTORIALS_CHAPTER2 "Compile chapter 2" ON)
  60. option(TUTORIALS_CHAPTER3 "Compile chapter 3" ON)
  61. option(TUTORIALS_CHAPTER4 "Compile chapter 4" ON)
  62. option(TUTORIALS_CHAPTER5 "Compile chapter 5" ON)
  63. option(TUTORIALS_CHAPTER6 "Compile chapter 6" ON)
  64. option(TUTORIALS_CHAPTER7 "Compile chapter 7" ON)
  65. # Store location of tutorial/shared directory
  66. set(TUTORIAL_SHARED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/shared CACHE PATH "location of shared tutorial resources")
  67. add_definitions("-DTUTORIAL_SHARED_PATH=\"${TUTORIAL_SHARED_PATH}\"")
  68. include_directories(${CMAKE_CURRENT_SOURCE_DIR})
  69. # Chapter 1
  70. if(TUTORIALS_CHAPTER1)
  71. add_subdirectory("101_FileIO")
  72. add_subdirectory("102_DrawMesh")
  73. add_subdirectory("103_Events")
  74. add_subdirectory("104_Colors")
  75. add_subdirectory("105_Overlays")
  76. add_subdirectory("106_ViewerMenu")
  77. endif()
  78. # Chapter 2
  79. if(TUTORIALS_CHAPTER2)
  80. add_subdirectory("201_Normals")
  81. add_subdirectory("202_GaussianCurvature")
  82. add_subdirectory("203_CurvatureDirections")
  83. add_subdirectory("204_Gradient")
  84. add_subdirectory("205_Laplacian")
  85. endif()
  86. # Chapter 3
  87. if(TUTORIALS_CHAPTER3)
  88. add_subdirectory("301_Slice")
  89. add_subdirectory("302_Sort")
  90. add_subdirectory("303_LaplaceEquation")
  91. add_subdirectory("304_LinearEqualityConstraints")
  92. add_subdirectory("305_QuadraticProgramming")
  93. add_subdirectory("306_EigenDecomposition")
  94. endif()
  95. # Chapter 4
  96. if(TUTORIALS_CHAPTER4)
  97. add_subdirectory("401_BiharmonicDeformation")
  98. add_subdirectory("402_PolyharmonicDeformation")
  99. if(LIBIGL_WITH_BBW)
  100. add_subdirectory("403_BoundedBiharmonicWeights")
  101. endif()
  102. add_subdirectory("404_DualQuaternionSkinning")
  103. add_subdirectory("405_AsRigidAsPossible")
  104. add_subdirectory("406_FastAutomaticSkinningTransformations")
  105. add_subdirectory("407_BiharmonicCoordinates")
  106. endif()
  107. # Chapter 5
  108. if(TUTORIALS_CHAPTER5)
  109. add_subdirectory("501_HarmonicParam")
  110. add_subdirectory("502_LSCMParam")
  111. add_subdirectory("503_ARAPParam")
  112. if(LIBIGL_WITH_COMISO)
  113. add_subdirectory("504_NRosyDesign")
  114. add_subdirectory("505_MIQ")
  115. add_subdirectory("506_FrameField")
  116. endif()
  117. add_subdirectory("507_PolyVectorField")
  118. add_subdirectory("508_ConjugateField")
  119. add_subdirectory("509_Planarization")
  120. add_subdirectory("510_Integrable")
  121. endif()
  122. # Chapter 6
  123. if(TUTORIALS_CHAPTER6)
  124. if(LIBIGL_WITH_XML)
  125. add_subdirectory("601_Serialization")
  126. endif()
  127. if(LIBIGL_WITH_MATLAB)
  128. add_subdirectory("602_Matlab")
  129. endif()
  130. if(LIBIGL_WITH_TRIANGLE)
  131. add_subdirectory("604_Triangle")
  132. endif()
  133. if(LIBIGL_WITH_TETGEN)
  134. add_subdirectory("605_Tetgen")
  135. endif()
  136. if(LIBIGL_WITH_EMBREE)
  137. add_subdirectory("606_AmbientOcclusion")
  138. endif()
  139. if(LIBIGL_WITH_PNG)
  140. add_subdirectory("607_ScreenCapture")
  141. endif()
  142. if(LIBIGL_WITH_LIM)
  143. add_subdirectory("608_LIM")
  144. endif()
  145. if(LIBIGL_WITH_CGAL)
  146. add_subdirectory("609_Boolean")
  147. add_subdirectory("610_CSGTree")
  148. endif()
  149. endif()
  150. # Chapter 7
  151. if(TUTORIALS_CHAPTER7)
  152. add_subdirectory("701_Statistics")
  153. add_subdirectory("702_WindingNumber")
  154. add_subdirectory("703_Decimation")
  155. add_subdirectory("704_SignedDistance")
  156. add_subdirectory("705_MarchingCubes")
  157. if(LIBIGL_WITH_EMBREE)
  158. add_subdirectory("706_FacetOrientation")
  159. endif()
  160. add_subdirectory("707_SweptVolume")
  161. add_subdirectory("708_Picking")
  162. endif()