# Global compiler options
add_definitions(
    -D_ALLOW_KEYWORD_MACROS
    -D_CRT_SECURE_NO_WARNINGS
    -D_POSIX_PRIORITY_SCHEDULING=1
    -D_SCL_SECURE_NO_WARNINGS
    -D_USE_MATH_DEFINES
    -DCURL_STATICLIB
    -DEGLAPI=
    -DEGLAPIENTRY=
    -DLIBXML_STATIC
    -DNOMINMAX
    -DOPENVG_STATIC_LIBRARY
    -DORTP_STATIC
    -DOSIP_MT
    -DPTW32_STATIC_LIB
    -DUPNP_STATIC_LIB
)

if (CMAKE_BUILD_TYPE STREQUAL Debug)
    add_definitions(
        -D_CRTDBG_MAP_ALLOC
        -DENABLE_TRACE
    )
endif()

if (DEFINED CFG_WIN32_SIMULATOR)
    add_definitions(
        -DCFG_WIN32_SIMULATOR
        )
endif()

if (DEFINED CFG_WIN32_FS_HW)
    add_definitions(
        -DCFG_WIN32_FS_HW
    )
endif()

if (DEFINED CFG_WIN32_LWIP_ADAPTER)
    add_definitions(
        -DCFG_WIN32_LWIP_ADAPTER=${CFG_WIN32_LWIP_ADAPTER}
    )
endif()

include_directories(
    ${CMAKE_CURRENT_BINARY_DIR}/$ENV{CFG_PLATFORM}/include
)

# Compiler flags
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MP4 /MTd")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP4 /MTd")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_DEBUG} /MT")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} /MT")
