cmake_policy(SET CMP0054 NEW)

set(testEnvSources
  testenv.hpp
  testenv.cpp
)

if( TARGET_PLATFORM STREQUAL "Android" )
  list(APPEND testEnvSources android/testenv.cpp)
elseif( TARGET_PLATFORM STREQUAL "iPhone" )
  list(APPEND testEnvSources ios/testenv.mm)
elseif( TARGET_PLATFORM STREQUAL "AppleTV" )
  list(APPEND testEnvSources ios/testenv.mm)
elseif( TARGET_PLATFORM STREQUAL "OSX" )
  list(APPEND testEnvSources macos/testenv.mm)
elseif( TARGET_PLATFORM STREQUAL "PS4" )
  list(APPEND testEnvSources ps4/testenv.cpp)
elseif( TARGET_PLATFORM STREQUAL "WinStore" )
  list(APPEND testEnvSources uwp/testenv.cpp)
elseif( TARGET_PLATFORM STREQUAL "XboxOne" )
  list(APPEND testEnvSources uwp/testenv.cpp)
elseif( TARGET_PLATFORM STREQUAL "Posix" )
  list(APPEND testEnvSources posix/testenv.cpp)
elseif( TARGET_PLATFORM STREQUAL "Web" )
  list(APPEND testEnvSources web/webtestenv.cpp)
endif()

add_library(testenv ${testEnvSources})
target_include_directories(testenv PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(testenv)

if( TARGET_PLATFORM STREQUAL "PS4" )
  target_link_libraries(testenv nativeplayer)
else()
  target_link_libraries(testenv mediaplayer)
endif()
if ( NOT TARGET_PLATFORM STREQUAL "Android" 	AND
     NOT TARGET_PLATFORM STREQUAL "iPhone" 	AND
     NOT TARGET_PLATFORM STREQUAL "AppleTV"	AND
     NOT TARGET_PLATFORM STREQUAL "OSX"
  )
  target_link_libraries(testenv platforms)
endif()
