
#Set up visual studio filters

# *.h
SOURCE_GROUP(KDIS FILES ${KDIS_SRC_BASE_H})
SOURCE_GROUP(KDIS\\DataTypes FILES ${KDIS_SRC_DATATYPES_H})
SOURCE_GROUP(KDIS\\DataTypes\\Enums FILES ${KDIS_SRC_ENUMS_H})
SOURCE_GROUP(KDIS\\PDU FILES ${KDIS_SRC_PDU_BASE_H})
SOURCE_GROUP(KDIS\\PDU\\Distributed_Emission_Regeneration FILES ${KDIS_SRC_PDU_DER_H})
SOURCE_GROUP(KDIS\\PDU\\Entity_Info_Interaction FILES ${KDIS_SRC_PDU_EII_H})
SOURCE_GROUP(KDIS\\PDU\\Entity_Management FILES ${KDIS_SRC_PDU_EM_H})
SOURCE_GROUP(KDIS\\PDU\\Live_Entity FILES ${KDIS_SRC_PDU_LE_H})
SOURCE_GROUP(KDIS\\PDU\\Logistics FILES ${KDIS_SRC_PDU_L_H})
SOURCE_GROUP(KDIS\\PDU\\Minefield FILES ${KDIS_SRC_PDU_M_H})
SOURCE_GROUP(KDIS\\PDU\\Radio_Communications FILES ${KDIS_SRC_PDU_R_H})
SOURCE_GROUP(KDIS\\PDU\\Simulation_Management FILES ${KDIS_SRC_PDU_SM_H})
SOURCE_GROUP(KDIS\\PDU\\Simulation_Management_With_Reliability FILES ${KDIS_SRC_PDU_SMWR_H})
SOURCE_GROUP(KDIS\\PDU\\Synthetic_Environment FILES ${KDIS_SRC_PDU_SE_H})
SOURCE_GROUP(KDIS\\PDU\\Warfare FILES ${KDIS_SRC_PDU_W_H})
SOURCE_GROUP(KDIS\\PDU\\Information_Operations FILES ${KDIS_SRC_PDU_IO_H})
SOURCE_GROUP(KDIS\\Extras FILES ${KDIS_SRC_EX_H})
SOURCE_GROUP(KDIS\\Network FILES ${KDIS_SRC_NET_H})

# *.cpp
SOURCE_GROUP(KDIS FILES ${KDIS_SRC_BASE_CPP})
SOURCE_GROUP(KDIS\\DataTypes FILES ${KDIS_SRC_DATATYPES_CPP})
SOURCE_GROUP(KDIS\\DataTypes\\Enums FILES ${KDIS_SRC_ENUMS_CPP})
SOURCE_GROUP(KDIS\\PDU FILES ${KDIS_SRC_PDU_BASE_CPP})
SOURCE_GROUP(KDIS\\PDU\\Distributed_Emission_Regeneration FILES ${KDIS_SRC_PDU_DER_CPP})
SOURCE_GROUP(KDIS\\PDU\\Entity_Info_Interaction FILES ${KDIS_SRC_PDU_EII_CPP})
SOURCE_GROUP(KDIS\\PDU\\Entity_Management FILES ${KDIS_SRC_PDU_EM_CPP})
SOURCE_GROUP(KDIS\\PDU\\Live_Entity FILES ${KDIS_SRC_PDU_LE_CPP})
SOURCE_GROUP(KDIS\\PDU\\Logistics FILES ${KDIS_SRC_PDU_L_CPP})
SOURCE_GROUP(KDIS\\PDU\\Minefield FILES ${KDIS_SRC_PDU_M_CPP})
SOURCE_GROUP(KDIS\\PDU\\Radio_Communications FILES ${KDIS_SRC_PDU_R_CPP})
SOURCE_GROUP(KDIS\\PDU\\Simulation_Management FILES ${KDIS_SRC_PDU_SM_CPP})
SOURCE_GROUP(KDIS\\PDU\\Simulation_Management_With_Reliability FILES ${KDIS_SRC_PDU_SMWR_CPP})
SOURCE_GROUP(KDIS\\PDU\\Synthetic_Environment FILES ${KDIS_SRC_PDU_SE_CPP})
SOURCE_GROUP(KDIS\\PDU\\Warfare FILES ${KDIS_SRC_PDU_W_CPP})
SOURCE_GROUP(KDIS\\PDU\\Information_Operations FILES ${KDIS_SRC_PDU_IO_CPP})
SOURCE_GROUP(KDIS\\Extras FILES ${KDIS_SRC_EX_CPP})
SOURCE_GROUP(KDIS\\Network FILES ${KDIS_SRC_NET_CPP})

#Include directories in project settings

INCLUDE_DIRECTORIES(${KDIS_SOURCE_DIR})
INCLUDE_DIRECTORIES(${KDIS_SOURCE_DIR}/Examples)

#Create the project

SET(KDIS_FILES_H
    ${KDIS_SRC_BASE_H} 
    ${KDIS_SRC_DATATYPES_H} 
    ${KDIS_SRC_ENUMS_H}
    ${KDIS_SRC_PDU_BASE_H}
    ${KDIS_SRC_PDU_DER_H}
    ${KDIS_SRC_PDU_EII_H}
    ${KDIS_SRC_PDU_EM_H}
    ${KDIS_SRC_PDU_LE_H}
    ${KDIS_SRC_PDU_L_H}
	${KDIS_SRC_PDU_M_H}
    ${KDIS_SRC_PDU_R_H}
    ${KDIS_SRC_PDU_SM_H}
    ${KDIS_SRC_PDU_SMWR_H}
    ${KDIS_SRC_PDU_SE_H}
    ${KDIS_SRC_PDU_W_H}
	${KDIS_SRC_PDU_IO_H}
    ${KDIS_SRC_EX_H}
	${KDIS_SRC_NET_H}
    KDIS.cpp
)

IF(NOT BUILD_EXAMPLES_TO_LINK_TO_LIB)

SET(KDIS_FILES_CPP
    ${KDIS_SRC_BASE_CPP} 
    ${KDIS_SRC_DATATYPES_CPP}
    ${KDIS_SRC_ENUMS_CPP}
    ${KDIS_SRC_PDU_BASE_CPP}
    ${KDIS_SRC_PDU_DER_CPP}
    ${KDIS_SRC_PDU_EII_CPP}
    ${KDIS_SRC_PDU_EM_CPP}
    ${KDIS_SRC_PDU_LE_CPP}
    ${KDIS_SRC_PDU_L_CPP}
	${KDIS_SRC_PDU_M_CPP}
    ${KDIS_SRC_PDU_R_CPP}
    ${KDIS_SRC_PDU_SM_CPP}
    ${KDIS_SRC_PDU_SMWR_CPP}
    ${KDIS_SRC_PDU_SE_CPP}
    ${KDIS_SRC_PDU_W_CPP}
	${KDIS_SRC_PDU_IO_CPP}
    ${KDIS_SRC_EX_CPP}
	${KDIS_SRC_NET_CPP}
)

ENDIF(NOT BUILD_EXAMPLES_TO_LINK_TO_LIB)
SET(KDIS_FILES ${KDIS_FILES_CPP} ${KDIS_FILES_H} )

SET(BIN_NAME Example_Entity_State_PDU)

ADD_EXECUTABLE(${BIN_NAME} ${KDIS_FILES})

SET_PROPERTY(TARGET Example_Entity_State_PDU PROPERTY FOLDER "Examples/PDU")

#Lower the warning level
IF(MSVC)
    ADD_DEFINITIONS(/W1)
ENDIF(MSVC)

IF(BUILD_EXAMPLES_TO_LINK_TO_LIB)

    IF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES STATIC)
        TARGET_LINK_LIBRARIES(${BIN_NAME} KDIS_LIB)
    ENDIF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES STATIC)
    
    IF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES SHARED)
        TARGET_LINK_LIBRARIES(${BIN_NAME} KDIS_DLL)
        ADD_DEFINITIONS(-D "IMPORT_KDIS")
    ENDIF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES SHARED)
    
ENDIF(BUILD_EXAMPLES_TO_LINK_TO_LIB)

IF(DIS_VERSION MATCHES 6)
	ADD_DEFINITIONS(-D "DIS_VERSION=6")
ENDIF(DIS_VERSION MATCHES 6)

IF(DIS_VERSION MATCHES 5)
	ADD_DEFINITIONS(-D "DIS_VERSION=5")
ENDIF(DIS_VERSION MATCHES 5)

IF(DIS_VERSION MATCHES 7)
	ADD_DEFINITIONS(-D "DIS_VERSION=7")
ENDIF(DIS_VERSION MATCHES 7)

IF(KDIS_USE_ENUM_DESCRIPTORS)
	ADD_DEFINITIONS(-D "KDIS_USE_ENUM_DESCRIPTORS")
ENDIF(KDIS_USE_ENUM_DESCRIPTORS) 

TARGET_LINK_LIBRARIES(${BIN_NAME} ${RT_LIBRARY})
