#
# Build PhysXCooking
#

SET(PHYSX_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../)

SET(LL_SOURCE_DIR ${PHYSX_SOURCE_DIR}/PhysXCooking/src)

SET(PHYSXCOOKING_COMPILE_DEFS
	# Common to all configurations
	${PHYSX_WINDOWS_COMPILE_DEFS};PX_PHYSX_LOADER_EXPORTS;PX_PHYSX_COOKING_EXPORTS;PX_PHYSX_CORE_EXPORTS;PX_COOKING;

	$<$<CONFIG:debug>:${PHYSX_WINDOWS_DEBUG_COMPILE_DEFS};PX_PHYSX_DLL_NAME_POSTFIX=DEBUG;>
	$<$<CONFIG:checked>:${PHYSX_WINDOWS_CHECKED_COMPILE_DEFS};PX_PHYSX_DLL_NAME_POSTFIX=CHECKED;>
	$<$<CONFIG:profile>:${PHYSX_WINDOWS_PROFILE_COMPILE_DEFS};PX_PHYSX_DLL_NAME_POSTFIX=PROFILE;>
	$<$<CONFIG:release>:${PHYSX_WINDOWS_RELEASE_COMPILE_DEFS};>

)

SET(PHYSX_COOKING_WINDOWS_SOURCE
	${LL_SOURCE_DIR}/windows/WindowsCookingDelayLoadHook.cpp
)
SOURCE_GROUP(src\\windows FILES ${PHYSX_COOKING_WINDOWS_SOURCE})

SET(PHYSX_COOKING_RESOURCE
	${PHYSX_SOURCE_DIR}/compiler/resource_${LIBPATH_SUFFIX}/PhysX3Cooking.rc
)
SOURCE_GROUP(resource FILES ${PHYSX_COOKING_RESOURCE})

SET(PHYSXCOOKING_PLATFORM_SRC_FILES 
	${PHYSX_COOKING_WINDOWS_SOURCE}
	${PHYSX_COOKING_RESOURCE}
)

SET(PHYSXCOOKING_LIBTYPE SHARED)


# include common PhysXCooking settings
INCLUDE(../common/PhysXCooking.cmake)

SET_TARGET_PROPERTIES(PhysXCooking PROPERTIES 
	LINK_FLAGS_DEBUG "/MAP /DELAYLOAD:PxFoundationDEBUG_${LIBPATH_SUFFIX}.dll /DELAYLOAD:PhysX3CommonDEBUG_${LIBPATH_SUFFIX}.dll /DEBUG"
	LINK_FLAGS_CHECKED "/MAP /DELAYLOAD:PxFoundationCHECKED_${LIBPATH_SUFFIX}.dll /DELAYLOAD:PhysX3CommonCHECKED_${LIBPATH_SUFFIX}.dll"
	LINK_FLAGS_PROFILE "/MAP /DELAYLOAD:PxFoundationPROFILE_${LIBPATH_SUFFIX}.dll /DELAYLOAD:PhysX3CommonPROFILE_${LIBPATH_SUFFIX}.dll /INCREMENTAL:NO /DEBUG"
	LINK_FLAGS_RELEASE "/MAP /DELAYLOAD:PhysX3Common_${LIBPATH_SUFFIX}.dll /DELAYLOAD:PxFoundation_${LIBPATH_SUFFIX}.dll /INCREMENTAL:NO"
)
