if(DYNAMIC_SOLID)
  set(LIBRARY_TYPE "SHARED")
  add_definitions(-DDLL_EXPORT)
else(DYNAMIC_SOLID)
  set(LIBRARY_TYPE "STATIC")
  add_definitions(-DSOLID_STATIC)
endif(DYNAMIC_SOLID)

include_directories(${PROJECT_SOURCE_DIR}/libmoto)
include_directories(${PROJECT_SOURCE_DIR}/libbroad)

set(SOLID_DEPS moto broad)

set(SOLID_PUBLIC_HEADERS
  ${PROJECT_SOURCE_DIR}/include/SOLID/broad.h
  ${PROJECT_SOURCE_DIR}/include/SOLID/solid.h
  ${PROJECT_SOURCE_DIR}/include/SOLID/types.h
)

add_library(solid2 ${LIBRARY_TYPE}
  ${SOLID_PUBLIC_HEADERS}
  AlgoTable.h
  BBox.h
  BBoxTree.cpp
  BBoxTree.h
  Box.cpp
  Box.h
  C-api.cpp
  Complex.cpp
  Complex.h
  Cone.cpp
  Cone.h
  Convex.cpp
  Convex.h
  Cylinder.cpp
  Cylinder.h
  Encounter.h
  IndexArray.h
  Object.cpp
  Object.h
  Polygon.cpp
  Polygon.h
  Polyhedron.cpp
  Polyhedron.h
  Polytope.h
  Response.cpp
  Response.h
  RespTable.cpp
  RespTable.h
  Shape.h
  Simplex.cpp
  Simplex.h
  Sphere.cpp
  Sphere.h
  Transform.cpp
  Transform.h
  VertexBase.h
)

add_dependencies(solid2 ${SOLID_DEPS})

target_link_libraries(solid2 ${SOLID_DEPS})

install(
    TARGETS solid2
    ARCHIVE DESTINATION lib${LIB_POSTFIX}
    LIBRARY DESTINATION lib${LIB_POSTFIX}
    RUNTIME DESTINATION bin
)
install(
    FILES ${SOLID_PUBLIC_HEADERS}
    DESTINATION include/SOLID
)
