matlab.cmake 1.0 KB

12345678910111213141516171819202122232425
  1. # 1. Define module
  2. igl_add_library(igl_restricted_matlab)
  3. # 2. Include headers
  4. include(GNUInstallDirs)
  5. target_include_directories(igl_restricted_matlab ${IGL_SCOPE}
  6. $<BUILD_INTERFACE:${libigl_SOURCE_DIR}/include>
  7. $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  8. )
  9. # 3. Target sources
  10. file(GLOB INC_FILES "${libigl_SOURCE_DIR}/include/igl/matlab/*.h")
  11. file(GLOB SRC_FILES "${libigl_SOURCE_DIR}/include/igl/matlab/*.cpp")
  12. igl_target_sources(igl_restricted_matlab ${INC_FILES} ${SRC_FILES})
  13. # 4. Dependencies
  14. # MATLAB_ADDITIONAL_VERSIONS should have already been set in libigl/CMakeLists.txt
  15. find_package(Matlab REQUIRED COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY MAT_LIBRARY)
  16. # to-do detect if imported targets are available (cmake 3.22's findmatlab has
  17. # them) and use those instead of hard coding these.
  18. target_link_libraries(igl_restricted_matlab ${IGL_SCOPE} igl::core ${Matlab_LIBRARIES})
  19. target_include_directories(igl_restricted_matlab ${IGL_SCOPE} ${Matlab_INCLUDE_DIRS})
  20. # 5. Unit tests
  21. # to-do write some matlab tests