# -----------------------------------------------------------------------------
# Relevant source files and their virtual folders for IDE (source groups)
# -----------------------------------------------------------------------------
set(NO_GROUP_SRCS 
    "${CMAKE_CURRENT_SOURCE_DIR}/mcds_lib_decoder_demo_main.cpp"              
    "${CMAKE_SOURCE_DIR}/src/mcds_lib/mcds_lib_decoder_utils.h" 
    "${CMAKE_SOURCE_DIR}/src/mcds_lib_impl/mcds_lib_decoder.cpp"         
    "${CMAKE_SOURCE_DIR}/src/mcds_lib_impl/mcds_lib_configurator.cpp"
)
source_group("" FILES ${NO_GROUP_SRCS})

target_sources(mcds_lib_decoder_demo PRIVATE ${NO_GROUP_SRCS})

set_target_properties(mcds_lib_decoder_demo
    PROPERTIES
        VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/test/mcds_lib_demo"
)

# -----------------------------------------------------------------------------
# Find relevant dependencies
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# includes, and libraries
# -----------------------------------------------------------------------------
target_include_directories(mcds_lib_decoder_demo
    PRIVATE 
        "${CMAKE_CURRENT_SOURCE_DIR}"  
        "${CMAKE_SOURCE_DIR}/src/mcds_lib"
        "${CMAKE_SOURCE_DIR}/src/mcds_lib_impl"   
        ${elf_disasm_INCLUDE_DIRS}   
        "${CMAKE_BINARY_DIR}"
)

target_link_libraries(mcds_lib_decoder_demo elf_disasm::elf_disasm_tc nlohmann_json::nlohmann_json nlohmann_json_schema_validator)

# -----------------------------------------------------------------------------
# Dependencies
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# Compile definitions
# -----------------------------------------------------------------------------
if (MSVC)
    target_compile_definitions(mcds_lib_decoder_demo PRIVATE
        "$<$<CONFIG:Debug>:"
            "_DEBUG"
        ">"
        "$<$<CONFIG:Release>:"
            "NDEBUG"
        ">"
        "_CRT_SECURE_NO_WARNINGS"
        "_WIN32"
        "TSIM64"
        "LITTLE_ENDIAN_HOST"
    )
elseif (UNIX)
    target_compile_definitions(mcds_lib_decoder_demo PRIVATE
        "UNIX"
    )
endif()

# -----------------------------------------------------------------------------
# Compile and link options
# -----------------------------------------------------------------------------
if (MSVC)
    target_compile_options(mcds_lib_decoder_demo PRIVATE
        /W3
        /MP
        /Gd
        /TP
    )

    target_link_options(mcds_lib_decoder_demo PRIVATE
        /INCREMENTAL
        /SUBSYSTEM:CONSOLE
    )
elseif (UNIX)
    target_compile_options(mcds_lib_decoder_demo PRIVATE
        -Wall;
    )
endif()

# -----------------------------------------------------------------------------
# Install
# -----------------------------------------------------------------------------
install(TARGETS mcds_lib_decoder_demo DESTINATION bin COMPONENT applications)