project(ServerLMS LANGUAGES CXX)

common_info_for_project(ServerLMS)

add_library(ServerLMS SHARED
  ServerLMS_global.h
  serverlmswidget.cpp
  serverlmswidget.h
  serverlmswidget.ui
  clienthandler.cpp
  clienthandler.h
  multithreadserver.cpp
  multithreadserver.h
  Data/typesDataServerClient.h
  Data/Client.h
  Data/PacketType.h
  Data/StreamingVersionData.h
  Systems/assetsmanager.cpp
  Systems/assetsmanager.h
  Systems/recognizesystem.cpp
  Systems/recognizesystem.h
  Systems/updatecontroller.cpp
  Systems/updatecontroller.h
  Systems/commonclienthandler.cpp
  Systems/commonclienthandler.h
  Systems/logger.cpp
  Systems/logger.h
  Systems/Parsers/dataparser.cpp
  Systems/Parsers/dataparser.h
  Systems/Parsers/clientanswerparser.cpp
  Systems/Parsers/clientanswerparser.h
  Systems/Parsers/dbanswerparser.cpp
  Systems/Parsers/dbanswerparser.h
  Systems/Parsers/processparser.cpp
  Systems/Parsers/processparser.h
  Systems/processingsystem.cpp
  Systems/processingsystem.h
  Systems/sendsystem.cpp
  Systems/sendsystem.h
  Systems/tools.cpp
  Systems/tools.h
  Systems/chatsystem.cpp
  Systems/chatsystem.h
  Data/usertype.h
  providerdblms.cpp
  providerdblms.h
  resources.qrc
)

target_link_libraries(ServerLMS PRIVATE Qt5::Widgets)
target_link_libraries(ServerLMS PRIVATE Qt5::Network)
target_link_libraries(ServerLMS PRIVATE Qt5::Concurrent)
target_link_libraries(ServerLMS PRIVATE Qt5::Sql)
target_link_libraries(ServerLMS PRIVATE Qt5::Xml)

target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../DataBaseLMS)
if(PROJECT_TYPE_DEBUG)
    target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/DataBaseLMS)
else()
    target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Release64/DataBaseLMS)
endif()
target_link_libraries(ServerLMS PRIVATE libDataBaseLMS.dll)

target_compile_definitions(ServerLMS PRIVATE SERVERLMS_LIBRARY)

if(PROJECT_TYPE_DEBUG)
    add_custom_command(TARGET ServerLMS
	               POST_BUILD
		       COMMAND ${CMAKE_COMMAND} -E copy_if_different
		      ${REPO_PATH}/BUILDS/Debug64/ServerLMS/libServerLMS.dll
		      ${REPO_PATH}/BUILDS/Debug64/TestServerLMS)
else()
    add_custom_command(TARGET ServerLMS
	               POST_BUILD
		       COMMAND ${CMAKE_COMMAND} -E copy_if_different
		      ${REPO_PATH}/BUILDS/Release64/ServerLMS/libServerLMS.dll
		      ${REPO_PATH}/BUILDS/Release64/TestServerLMS)
endif()
