brlcad_find_package(OPENNURBS REQUIRED SYSPATTERN openNURBS)

set(
  LIBBREP_SOURCES
  BBNode.cpp
  BRNode.cpp
  PullbackCurve.cpp
  Subcurve.cpp
  Subsurface.cpp
  boolean.cpp
  cdt/cdt.cpp
  cdt/fast.cpp
  cdt/surf.cpp
  cdt/cdt_util.cpp
  cdt/validate.cpp
  cdt/edge.cpp
  cdt/mesh.cpp
  cdt/ovlps_simple.cpp
  cdt/tri_isect.cpp
  debug_plot.cpp
  edit.cpp
  intersect.cpp
  quality.cpp
  tools/tools.cpp
  opennurbs_ext.cpp
  px_event.cpp
  shape_recognition/shape_recognition.cpp
  shape_recognition/cone.cpp
  shape_recognition/cylinder.cpp
  shape_recognition/pipeline.cpp
  shape_recognition/planar.cpp
  shape_recognition/sphere.cpp
  shape_recognition/sr_util.cpp
  ssx_event.cpp
  tools/tools_util.cpp
)

# OpenNURBS include paths and usage requirements are supplied by its imported
# target below.
set(BREP_INCLUDE_DIRS)

# GTE headers (in-tree custom extensions + external base) are needed by
# cdt/mesh.cpp for the LSCM patch parameterization path.
find_package_gte(REQUIRED)

# locally used but not needed by users of the library
set(BREP_LOCAL_INCLUDE_DIRS
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${REGEX_INCLUDE_DIRS}
  ${BRLCAD_SOURCE_DIR}/src/libbg/GTE
  ${GTE_INCLUDE_DIR})

# Note - libbrep_deps is defined by ${BRLCAD_SOURCE_DIR}/src/source_dirs.cmake
set(BREP_PUBLIC_LIBS ${libbrep_deps} OPENNURBS::OPENNURBS)
set(
  BREP_PRIVATE_LIBS
  ${WINSOCK_LIB}
  ${RPCRT_LIB}
  ${STDCXX_LIBRARIES}
)

brlcad_addlib(libbrep "${LIBBREP_SOURCES}" "${BREP_INCLUDE_DIRS}" "${BREP_LOCAL_INCLUDE_DIRS}"
  PUBLIC_LIBS ${BREP_PUBLIC_LIBS}
  PRIVATE_LIBS ${BREP_PRIVATE_LIBS}
)
set_target_properties(libbrep PROPERTIES VERSION 20.0.1 SOVERSION 20)

add_subdirectory(tests)

cmakefiles(
  CMakeLists.txt
  PullbackCurve.h
  brep_defines.h
  brep_except.h
  cdt/cdt.h
  cdt/mesh.h
  debug_plot.h
  quality.cpp
  shape_recognition/shape_recognition.h
  shape_recognition/torus.cpp
  tools/tools.h
)

# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
