cmake_minimum_required(VERSION 3.0)
project(qglengine_core)
if (POLICY CMP0017)
	cmake_policy(SET CMP0017 NEW)
endif()
qad_find_qt(Core Gui OpenGL OpenGLWidgets Xml)
find_package(OpenGL REQUIRED)
qad_sources(SRC)
set(_includes "${_qglengine_root_build}")
foreach (_d "formats" "core" "scene" "render" "view")
	qad_sources(FSRC DIR "${_d}")
	list(APPEND SRC ${FSRC})
	list(APPEND _includes "${CMAKE_CURRENT_SOURCE_DIR}/${_d}")
endforeach()
qad_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
file(GLOB PHS "*_p.h")
list(REMOVE_ITEM out_HDR "${PHS}")
import_version(${PROJECT_NAME} QGLEngine)
set_deploy_property(${PROJECT_NAME} ${QGLEngine_LIB_TYPE}
	LABEL "QGLEngine core library"
	FULLNAME "${QGLEngine_DOMAIN}.qglengine_core"
	COMPANY  "${QGLEngine_COMPANY}"
	INFO "QGLEngine core library")
make_rc(${PROJECT_NAME} _RC)
pip_code_model(CCM "render/renderer.h" OPTIONS "-DQGLENGINE_CORE_EXPORT" "-Es")
qad_add_library(${PROJECT_NAME} ${QGLEngine_LIB_TYPE} out_CPP ${_RC} ${CCM})
qad_generate_export_header(${PROJECT_NAME})
list(APPEND out_HDR "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h")
qad_target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ${_includes})
qad_target_link_libraries(${PROJECT_NAME} QAD::Widgets QAD::PIQtUtils assimp ${OPENGL_LIBRARIES})
message(STATUS "Building QGLEngine version ${QGLEngine_VERSION} (${QGLEngine_LIB_TYPE_MSG}) for ${QtVersions}")

list(APPEND QT_MULTILIB_LIST ${PROJECT_NAME})
shstk_copy_to_parent()
#message(STATUS "Building ${PROJECT_NAME}")
shstk_qad_install("qglengine" FALSE "${PROJECT_NAME}" "${out_HDR}" "out_QM")
