project(PML)

cmake_minimum_required(VERSION 2.6)

if (PACKAGING_NSIS)
    set(LIB_NAME library_pml)
else()
    set(LIB_NAME library-pml)
endif()

# Is this tool is compiled inside or outside CAMITK (as a standalone)?
if (NOT CEP_NAME STREQUAL "modeling")
  # if this tool is compiled independantly from CamiTK
  set(PML_STANDALONE ON CACHE BOOL "ON only if PML compiled outside CAMITK SDK")
  message(SEND_ERROR "Compilation of PML outside CamiTK SDK not implemented yet. Please contact authors")
endif()

set(VERSION_STRING "pml - ${CAMITK_VERSION_STRING} (c) UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525")
configure_file(${PML_SOURCE_DIR}/PhysicalModelVersion.h.in ${PML_BINARY_DIR}/PhysicalModelVersion.h)

# Sets the variables for required include subdirectories :
set (PhysicalModelProperties_DIR ${PML_SOURCE_DIR}/PhysicalProperties)

set(    HEADERS
        Atom.h
        BasicAtomProperties.h
        Cell.h
        BasicCellProperties.h
        Component.h
        MultiComponent.h
        PhysicalModel.h
        ${PML_BINARY_DIR}/PhysicalModelVersion.h
        PhysicalModelIO.h
        Properties.h
        StructuralComponent.h
        BasicSCProperties.h
        Structure.h
        StructureProperties.h
        PMLAbortException.h
        PMLTransform.h
        RenderingMode.h
        ${PhysicalModelProperties_DIR}/AtomProperties.h
        ${PhysicalModelProperties_DIR}/CellProperties.h
        ${PhysicalModelProperties_DIR}/StructuralComponentProperties.h
)

set(SRCS 
    Atom.cpp
    BasicAtomProperties.cpp
    Cell.cpp
    Component.cpp
    BasicCellProperties.cpp
    MultiComponent.cpp
    PhysicalModel.cpp
    StructuralComponent.cpp
    BasicSCProperties.cpp
    Structure.cpp
    StructureProperties.cpp
    PMLTransform.cpp
    ${PhysicalModelProperties_DIR}/AtomProperties.cpp
    ${PhysicalModelProperties_DIR}/CellProperties.cpp
    ${PhysicalModelProperties_DIR}/StructuralComponentProperties.cpp
    Properties.cpp
    ${HEADERS}
)


camitk_library(STATIC
               SOURCES ${SRCS}
               INCLUDE_DIRECTORIES ${PhysicalModelProperties_DIR}
               NEEDS_LIBXML2
               HEADERS_TO_INSTALL  ${HEADERS} 
               CEP_NAME CEP_MODELING
               DESCRIPTION "Tools to describes a biomechanical model."
)

#-----------
# testing
#-----------
add_subdirectory(test)

#-----------
# tools
#-----------
add_subdirectory(tools)

# lib installation
# install(TARGETS pml
        # ARCHIVE DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}
        # COMPONENT pml
# )

#-------------------
# api documentation
#-------------------

option(APIDOC_GENERATE_FOR_PML "Build API documentation for PML" OFF)

if(APIDOC_GENERATE_FOR_PML)
  find_package(Doxygen REQUIRED)
  if (DOXYGEN)
      add_subdirectory(api-doc)
  else ()
      message(STATUS "WARNING: Doxygen not found - PML API documentation and reference manual will not be created")
  endif ()
endif()
