#################################################
#   ___________    ____ ______  __ __  _____    #
#   \____ \__  \ _/ ___\\____ \|  |  \/  ___/   #
#   |  |_> > __ \\  \___|  |_> >  |  /\___ \    #
#   |   __(____  /\___  >   __/|____//____  >   #
#   |__|       \/     \/|__|              \/    #
#                                               #
#################################################
project(DBITEPlayer)

# ========================================
# Compiler definitions
# ========================================
add_definitions(
    ${QT_DEFINITIONS}
)

# ========================================
# Include directories
# ========================================
include_directories(
    ${CMAKE_BINARY_DIR}/DBITEPlayer
    ${QT_INCLUDE_DIR}
)

# ========================================
# Link directories
# ========================================
link_directories(
    ${PROJECT_BINARY_DIR}/../PacpusLib
    ${PROJECT_BINARY_DIR}/../FileLib
    ${PROJECT_BINARY_DIR}/../DBITEPlayerLib
	${PROJECT_BINARY_DIR}/../PacpusTools
	${PROJECT_BINARY_DIR}/../RoadTime
)

# ========================================
# List of sources
# ========================================
set(
    PROJECT_SRCS
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/cstdint.h
    ${PACPUS_INCLUDE_DIR}/Pacpus//kernel/ComponentBase.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/ComponentFactory.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/ComponentFactoryBase.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/ComponentManager.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/Log.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/pacpus.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/road_time.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/XmlComponentConfig.h
    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/XmlConfigFile.h
    ./ComponentBase.cpp
    ./ComponentFactoryBase.cpp
    ./ComponentManager.cpp
    ./Log.cpp
    ./XmlComponentConfig.cpp
    ./XmlConfigFile.cpp
)

# ========================================
# Build an executable
# ========================================
pacpus_add_executable(
    ${PROJECT_NAME}
    ./src/main.cpp
)

# ========================================
# Libraries & Dependencies
# ========================================

set(OPT_LIBRARIES
    optimized dbiteplayerlib debug dbiteplayerlib_d
    optimized FileLib debug FileLib_d
    optimized PacpusLib debug PacpusLib_d
)

# Windows platform
if(WIN32)
    LIST(APPEND OPT_LIBRARIES
        optimized ROAD_TIME debug ROAD_TIME_d
        Winmm
    )
endif()

if(UNIX)
    LIST(APPEND OPT_LIBRARIES
        pthread
    )
endif()

# All the platform
target_link_libraries(
    ${PROJECT_NAME}
    ${QT_LIBRARIES}
    ${OPT_LIBRARIES}
    ${PACPUS_DEPENDENCIES_LIB}
)

# ========================================
# Install
# ========================================
pacpus_install(${PROJECT_NAME})

# ========================================
# Folder
# ========================================
pacpus_folder(${PROJECT_NAME} "tools")
