if (${CMAKE_BUILD_TYPE} STREQUAL "MINSIZEREL" AND EXISTS "${PROJECT_SOURCE_DIR}/src/linux/ConnectionServer.profdata")
	add_compile_options(-fprofile-instr-use=${PROJECT_SOURCE_DIR}/src/linux/ConnectionServer.profdata)
endif()

set(SHARED_SOURCES
    shared/CentralConnection.cpp
    shared/CentralConnection.h
    shared/ChatServerConnection.cpp
    shared/ChatServerConnection.h
    shared/ClientConnection.cpp
    shared/ClientConnection.h
    shared/Client.cpp
    shared/Client.h
    shared/ConfigConnectionServer.cpp
    shared/ConfigConnectionServer.h
    shared/ConnectionServer.cpp
    shared/ConnectionServer.h
    shared/ConnectionServerMetricsData.cpp
    shared/ConnectionServerMetricsData.h
    shared/CustomerServiceConnection.cpp
    shared/CustomerServiceConnection.h
    shared/FirstConnectionServer.h
    shared/GameConnection.cpp
    shared/GameConnection.h
    shared/SessionApiClient.cpp
    shared/SessionApiClient.h
    shared/PseudoClientConnection.cpp
    shared/PseudoClientConnection.h
)

if(WIN32)
	set(PLATFORM_SOURCES
        win32/FirstConnectionServer.cpp
        win32/WinMain.cpp
	)
else()
	set(PLATFORM_SOURCES
		linux/main.cpp
	)
endif()

include_directories(
	${CMAKE_CURRENT_SOURCE_DIR}/shared
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedCompression/include/public
	${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
	${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
	${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
	
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedThread/include/public
    ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedUtility/include/public
    ${SWG_ENGINE_SOURCE_DIR}/server/library/serverKeyShare/include/public
    ${SWG_ENGINE_SOURCE_DIR}/server/library/serverMetrics/include/public
    ${SWG_ENGINE_SOURCE_DIR}/server/library/serverNetworkMessages/include/public
    ${SWG_ENGINE_SOURCE_DIR}/server/library/serverUtility/include/public
	${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include
    ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localization/include
    ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localizationArchive/include/public
    ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include
    ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include
    ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public
    ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects
    ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils
    ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary
	${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI
)

add_executable(ConnectionServer
	${SHARED_SOURCES}
	${PLATFORM_SOURCES}
)

target_link_libraries(ConnectionServer
    sharedCompression
    sharedDebug
    sharedFile
    sharedFoundation
    sharedGame
    sharedLog
    sharedMath
    
    sharedMessageDispatch
    sharedNetwork
    sharedNetworkMessages
    sharedRandom
    sharedSynchronization
    sharedThread
    sharedUtility
    serverKeyShare
    serverMetrics
    serverNetworkMessages
    serverUtility
    archive
    crypto
    fileInterface
    localization
    localizationArchive
    unicode
    unicodeArchive
    Base
    CommonAPI
    LoginAPI
	webAPI
	${CURL_LIBRARIES}
    ${CMAKE_DL_LIBS}
)
