if (${CMAKE_BUILD_TYPE} STREQUAL "MINSIZEREL" AND EXISTS "${PROJECT_SOURCE_DIR}/src/linux/TaskManager.profdata")
	add_compile_options(-fprofile-instr-use=${PROJECT_SOURCE_DIR}/src/linux/TaskManager.profdata)
endif()
    
set(SHARED_SOURCES
    shared/CentralConnection.cpp
    shared/CentralConnection.h
    shared/ConfigTaskManager.cpp
    shared/ConfigTaskManager.h
    shared/ConsoleConnection.cpp
    shared/ConsoleConnection.h
    shared/Console.cpp
    shared/Console.h
    shared/ConsoleImplementation.cpp
    shared/ConsoleImplementation.h
    shared/DatabaseConnection.cpp
    shared/DatabaseConnection.h
    shared/EnvironmentVariable.h
    shared/FirstTaskManager.cpp
    shared/FirstTaskManager.h
    shared/GameConnection.cpp
    shared/GameConnection.h
    shared/Locator.cpp
    shared/Locator.h
    shared/ManagerConnection.cpp
    shared/ManagerConnection.h
    shared/MetricsServerConnection.cpp
    shared/MetricsServerConnection.h
    shared/PlanetConnection.cpp
    shared/PlanetConnection.h
    shared/ProcessSpawner.h
    shared/TaskConnection.cpp
    shared/TaskConnection.h
    shared/TaskHandler.cpp
    shared/TaskHandler.h
    shared/TaskManager.cpp
    shared/TaskManager.h
    shared/TaskManagerSysInfo.h
)

if(WIN32)
	set(PLATFORM_SOURCES
        win32/ConsoleInput.cpp
        win32/EnvironmentVariable.cpp
        win32/ProcessSpawner.cpp
        win32/TaskManagerSysInfo.cpp
        win32/WinMain.cpp
	)
else()
	set(PLATFORM_SOURCES
        linux/ConsoleInput.cpp
        linux/EnvironmentVariable.cpp
		linux/main.cpp
        linux/ProcessSpawner.cpp
        linux/TaskManagerSysInfo.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/sharedLog/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}/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/fileInterface/include/public
    ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include
)

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

target_link_libraries(TaskManager
    sharedCompression
    sharedDebug
    sharedFile
    sharedFoundation
    sharedLog
    sharedMath
    
    sharedMessageDispatch
    sharedNetwork
    sharedNetworkMessages
    sharedRandom
    sharedSynchronization
    sharedThread
    sharedUtility
    serverNetworkMessages
    serverUtility
    archive
    fileInterface
    localization
    localizationArchive
    unicode
    unicodeArchive
    ${CMAKE_DL_LIBS}
)
