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

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

# ========================================
# Include directories
# ========================================
include_directories(
	${PROJECT_BINARY_DIR}
	${QT_INCLUDE_DIR}
)
# ========================================
# Link directories
# ========================================
link_directories(
	${PROJECT_BINARY_DIR}/../PacpusLib
	${PROJECT_BINARY_DIR}/../FileLib
	${PROJECT_BINARY_DIR}/../RoadTime
)

# ========================================
# List of sources
# ========================================
set(
	PROJECT_SRCS
	src/ui/pacpusmainwindow.cpp
	src/ui/pacpusmainwindow.h
	src/main.cpp
)

# ========================================
# Qt4 stuff
# ========================================
set(SENSOR_UI_CLASSES src/ui/pacpusmainwindow.ui)
set(SENSOR_MOC_CLASSES src/ui/pacpusmainwindow.h)

qt_wrap_ui(SENSOR_UI_SOURCES_H ${SENSOR_UI_CLASSES})
qt_wrap_cpp(SENSOR_MOC_SOURCES ${SENSOR_MOC_CLASSES})

source_group(Main_ui FILES ${PROJECT_SRCS})
source_group(moc FILES ${SENSOR_MOC_SOURCES} ${SENSOR_UI_SOURCES_H})

# ========================================
# Build an executable
# ========================================
pacpus_add_executable(
	${PROJECT_NAME}
	./src/main.cpp
	./src/ui/pacpusmainwindow.cpp
	./src/ui/pacpusmainwindow.h
	../ico/heudiasycIco.rc
	${SENSOR_MOC_SOURCES}
	${SENSOR_UI_CLASSES}
)

# ========================================
# Libraries
# ========================================

set(OPT_LIBRARIES
	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}
	${PACPUS_DEPENDENCIES_LIB}
	${OPT_LIBRARIES}
	${QT_LIBRARIES}
)

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

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