# This file sets up various platform specific directory paths including for Framework and lib/bins folders

# Set PROJECT_ARCH to either 32 or 64 (bits). Used to set the framework folders for Windows.
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
	set (PROJECT_ARCH 64)
else()
	set (PROJECT_ARCH 32)
endif()

if (WIN32)
#For Windows, the library paths are dependent on configuration(Debug/Release), so must depend on $<CONFIG>.
#But the Cmake files folder cannot be dependent on $<CONFIG> as the same project builds both debug and release
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/Windows_x86_${PROJECT_ARCH}/$<CONFIG>" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/Windows_x86_${PROJECT_ARCH}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/Windows_x86_${PROJECT_ARCH}" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/Windows_x86_${PROJECT_ARCH}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER_DEBUG "${SDK_ROOT}/lib/Windows_x86_${PROJECT_ARCH}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/Windows_x86_${PROJECT_ARCH}" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/$<CONFIG>" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release" CACHE INTERNAL "")
elseif (ANDROID)
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/Android/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/Android/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/Android/${ANDROID_ABI}" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/Android/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER_DEBUG "${SDK_ROOT}/lib/Android/Debug/${ANDROID_ABI}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/Android" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug/${ANDROID_ABI}" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release/${ANDROID_ABI}" CACHE INTERNAL "")
elseif (APPLE)
	if (IOS)
		set (PLATFORM_FOLDER iOS)
	else()
		set (PLATFORM_FOLDER macOS_x86)
	endif()
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/${PLATFORM_FOLDER}/$<CONFIG>" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/${PLATFORM_FOLDER}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/${PLATFORM_FOLDER}" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/${PLATFORM_FOLDER}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/${PLATFORM_FOLDER}" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/$<CONFIG>" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release" CACHE INTERNAL "")
elseif (UNIX)
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE}${WS}" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE}${WS}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER_DEBUG "${SDK_ROOT}/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/Debug/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/${CMAKE_BUILD_TYPE}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release" CACHE INTERNAL "")
else()
	message(FATAL_ERROR "UNKNOWN PLATFORM - Please set up this line with a path to where the Framework libraries must be set")
endif()

if(CMAKE_HOST_WIN32)
	set(EXTERNAL_BIN_FOLDER "${SDK_ROOT}/bin/Windows" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Release" CACHE INTERNAL "")
	set(HOST_EXECUTABLE_SUFFIX ".exe" CACHE INTERNAL "")
elseif(CMAKE_HOST_APPLE)
	set(EXTERNAL_BIN_FOLDER "${SDK_ROOT}/bin/${PLATFORM_FOLDER}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Release" CACHE INTERNAL "")
	set(HOST_EXECUTABLE_SUFFIX "" CACHE INTERNAL "")
elseif(CMAKE_HOST_UNIX)
	set(EXTERNAL_BIN_FOLDER "${SDK_ROOT}/bin/${CMAKE_HOST_SYSTEM_NAME}_${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Release" CACHE INTERNAL "")
	set(HOST_EXECUTABLE_SUFFIX "" CACHE INTERNAL "")
endif()