cmake_minimum_required(VERSION 3.5)
project(doc)

include(${CMAKE_SOURCE_DIR}/tools/safe_dep_glob.cmake)
include(${CMAKE_SOURCE_DIR}/tools/Protobuf.cmake)

# DEPENDENCIES
set(DOC_GLOBS
  *.md
  *.jpeg
  *.png
  *.html
  *.css
  *.js
  *.eot
  favicon.ico
  )
file (GLOB_RECURSE All_Deps RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${DOC_GLOBS})
set (All_Deps ${All_Deps} ${CMAKE_CURRENT_SOURCE_DIR}/build.sh)
update_deps_file("${All_Deps}")
# END DEPENDENCIES

add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/web/docs/index.html
  COMMAND /bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/build.sh
  ARGS ${CMAKE_BINARY_DIR}/web/docs/ ${CMAKE_BINARY_DIR}
  COMMENT "Building Manual UI"
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  DEPENDS ${All_Deps})

add_custom_target(doc_manual_bundle ALL DEPENDS ${CMAKE_BINARY_DIR}/web/docs/index.html)

