#-----------------------------------------------------------------------------
set(MODULE_NAME Home)


#-----------------------------------------------------------------------------
set(MODULE_PYTHON_SCRIPTS
  ${MODULE_NAME}.py
  )

set(MODULE_PYTHON_RESOURCES
  Resources/Icons/${MODULE_NAME}.png
  Resources/UI/${MODULE_NAME}.ui  
  Resources/Home.qss
  )

#-----------------------------------------------------------------------------
slicerMacroBuildScriptedModule(
  NAME ${MODULE_NAME}
  SCRIPTS ${MODULE_PYTHON_SCRIPTS}
  RESOURCES ${MODULE_PYTHON_RESOURCES}
  WITH_GENERIC_TESTS
  )

#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
if(BUILD_TESTING)

  # Register the unittest subclass in the main script as a ctest.
  # Note that the test will also be available at runtime.
  slicer_add_python_unittest(SCRIPT ${MODULE_NAME}.py)

  # Additional build-time testing
  add_subdirectory(Testing)
endif()

#----------------------------------------------------------------------------
# Temporary netgen install
#HACK - cannot seem to access top of superbuild from here
get_filename_component(top_level_binary ${CMAKE_BINARY_DIR} DIRECTORY )

#HACK - explicit install of tetgen and cleaver for custom apps
if(WIN32)
  set(mesher_bin_dir "${top_level_binary}/netgen-install/bin")
  install(
      FILES
        ${mesher_bin_dir}/netgen.exe
        ${mesher_bin_dir}/libgui.dll
        ${mesher_bin_dir}/ngcore.dll
        ${mesher_bin_dir}/nglib.dll
        ${mesher_bin_dir}/tcl86t.dll
        ${mesher_bin_dir}/tclsh86t.exe
        ${mesher_bin_dir}/tk86t.dll
        ${mesher_bin_dir}/togl.dll
        ${mesher_bin_dir}/wish86t.exe
        ${mesher_bin_dir}/zlib.dll
      DESTINATION bin COMPONENT Runtime)
else()
  set(mesher_bin_dir "${top_level_binary}/bin")
  install(
    FILES
      ${mesher_bin_dir}/tetgen
      ${mesher_bin_dir}/cleaver-cli
    DESTINATION bin COMPONENT Runtime)
endif()