# NOTE: Not sure why, but we need to use these files to override the default
#   memory management for the PS4 tests
#
#   From: ${PS4_SDK_DIR}/target/samples/sample_code/system/tutorial_malloc_replace
set(appSources
  ASanUtils.h
  main.cpp
  user_malloc
  user_malloc_for_tls.c
  user_new.cpp
)

#prepend_file_paths(${CMAKE_CURRENT_SOURCE_DIR} appSources)

add_executable(integrationTestRunner
	${appSources}
)

target_link_libraries(integrationTestRunner
  json11
  optionparser
  gtest
  nativeplayer
  testenv
  util
  integrationtest
) 

#This is not working properly - So going hardcore mode
#set_target_properties(integrationTestRunner PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data")
file( WRITE "${CMAKE_CURRENT_BINARY_DIR}/integrationTestRunner.vcxproj.user"
	"<?xml version=\"1.0\" encoding=\"utf-8\"?>
	<Project ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
	<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Orbis'\">
		<LocalDebuggerWorkingDirectory>${CMAKE_SOURCE_DIR}/examples/ps4/data</LocalDebuggerWorkingDirectory>
		<DebuggerFlavor>ORBISDebugger</DebuggerFlavor>
	</PropertyGroup>
	<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Orbis'\">
		<LocalDebuggerWorkingDirectory>${CMAKE_SOURCE_DIR}/examples/ps4/data</LocalDebuggerWorkingDirectory>
		<DebuggerFlavor>ORBISDebugger</DebuggerFlavor>
	</PropertyGroup>
	</Project>"
	)
 
add_custom_command(TARGET integrationTestRunner POST_BUILD
  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/config/ $<TARGET_FILE_DIR:integrationTestRunner>
)

set_folder_property(integrationTestRunner)
