add_subdirectory( icons       )
add_subdirectory( elementpics )
add_subdirectory( data        )
tde_conditional_add_subdirectory( WITH_OCAML_SOLVER solver )

include_directories(
  ${CMAKE_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${TDE_INCLUDE_DIR}
  ${TQT_INCLUDE_DIRS}
  ${CMAKE_SOURCE_DIR}/libtdeedu/tdeeduplot
  ${CMAKE_SOURCE_DIR}/libtdeedu/tdeeduui
)

link_directories(
  ${TQT_LIBRARY_DIRS}
  ${TDE_LIB_DIR}
  ${OCAML_LIBRARY_DIR}
)

if( WITH_OCAML_SOLVER )
  set( OCAML_LIBRARIES asmrun nums m ${CMAKE_DL_LIBS} )
  set( OCAML_SOLVER
    ${CMAKE_CURRENT_BINARY_DIR}/solver/modwrap.o
    ${CMAKE_CURRENT_BINARY_DIR}/solver/solver.o
  )
else( )
  add_custom_target( kalzium_solver COMMENT "Empty kalzium solver" )
endif( )


##### kalzium (executable)

tde_add_executable( kalzium AUTOMOC

  SOURCES
        prefs.kcfgc
        settings_colors.ui
        settings_misc.ui
        settings_units.ui
        plotsetupwidget.ui
        molcalcwidgetbase.ui
        timewidget.ui
        somwidget.ui
        spectrumview.ui
        eqresult.cpp
        eqchemview.cpp
        kalzium.cpp
        main.cpp
        periodictableview.cpp
        element.cpp
        detailinfodlg.cpp
        orbitswidget.cpp
        plotwidget.cpp
        elementdataviewer.cpp
        detailedgraphicaloverview.cpp
        molcalcwidget.cpp
        timewidget_impl.cpp
        somwidget_impl.cpp
        kalziumtip.cpp
        spectrum.cpp
        isotope.cpp
        kalziumdataobject.cpp
        spectrumwidget.cpp
        exporter.cpp
        spectrumviewimpl.cpp
        kalziumutils.cpp
        parser.cpp
        moleculeparser.cpp
        tempunit.cpp
  LINK
     tdecore-shared
     tdeui-shared
     tdeio-shared
     tdehtml-shared
     tdeeduplot-shared
     tdeeduui-shared
     ${OCAML_SOLVER}
     ${OCAML_LIBRARIES}

  DEPENDENCIES
     kalzium_solver

  DESTINATION ${BIN_INSTALL_DIR}
)


##### icons

tde_install_icons( )


##### other data

install(
    FILES kalziumui.rc
    DESTINATION ${DATA_INSTALL_DIR}/kalzium
)

tde_create_translated_desktop( kalzium.desktop )

install(
    FILES kalzium.kcfg
    DESTINATION ${KCFG_INSTALL_DIR}
)
