cmake_minimum_required(VERSION 3.0) project(VSWinStorePhone) if(MSVC_VERSION GREATER 1700) set(COMPILER_VERSION "12") elseif(MSVC_VERSION GREATER 1600) set(COMPILER_VERSION "11") endif() set (APP_MANIFEST_NAME Package.appxmanifest) if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone") set(PLATFORM WP) add_definitions("-DPHONE") if("${CMAKE_SYSTEM_VERSION}" STREQUAL "8.0") set(APP_MANIFEST_NAME WMAppManifest.xml) set(WINDOWS_PHONE8 1) endif() elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") set(PLATFORM STORE) else() set(PLATFORM DESKTOP) message(FATAL_ERROR "This app supports Store / Phone only. Please edit the target platform.") endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(EXE_NAME Direct3DApp1) set(SHORT_NAME ${EXE_NAME}) set(PACKAGE_GUID "6514377e-dfd4-4cdb-80df-4e0366346efc") if (NOT "${PLATFORM}" STREQUAL "DESKTOP") configure_file( cmake/Package_vc${COMPILER_VERSION}.${PLATFORM}.appxmanifest.in ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} @ONLY) endif() set(SOURCE_FILES Direct3DApp1/CubeRenderer.cpp Direct3DApp1/Direct3DApp1.cpp Direct3DApp1/Direct3DBase.cpp Direct3DApp1/pch.cpp ) set(HEADER_FILES Direct3DApp1/BasicTimer.h Direct3DApp1/CubeRenderer.h Direct3DApp1/Direct3DApp1.h Direct3DApp1/Direct3DBase.h Direct3DApp1/DirectXHelper.h Direct3DApp1/pch.h ) set(PIXELSHADER_FILES Direct3DApp1/SimplePixelShader.hlsl ) set(VERTEXSHADER_FILES Direct3DApp1/SimpleVertexShader.hlsl ) set(CONTENT_FILES ${PIXELSHADER_FILES} ${VERTEXSHADER_FILES}) if (WINDOWS_PHONE8) set(CONTENT_FILES ${CONTENT_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png Direct3DApp1/Assets/Tiles/IconicTileSmall.png Direct3DApp1/Assets/ApplicationIcon.png ) # Windows Phone 8.0 needs to copy all the images. # It doesn't know to use relative paths. file(COPY Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png Direct3DApp1/Assets/Tiles/IconicTileSmall.png Direct3DApp1/Assets/ApplicationIcon.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP") set(CONTENT_FILES ${CONTENT_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} Direct3DApp1/Assets/Logo.png Direct3DApp1/Assets/SmallLogo.png Direct3DApp1/Assets/SplashScreen.png Direct3DApp1/Assets/StoreLogo.png ) endif() set(RESOURCE_FILES ${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} Direct3DApp1/Direct3DApp1_TemporaryKey.pfx) set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) set_property(SOURCE ${DEBUG_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $) set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $,$,$>) set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel) set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex) source_group("Source Files" FILES ${SOURCE_FILES}) source_group("Header Files" FILES ${HEADER_FILES}) source_group("Resource Files" FILES ${RESOURCE_FILES}) add_executable(${EXE_NAME} WIN32 ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES}) set_property(TARGET ${EXE_NAME} PROPERTY VS_WINRT_COMPONENT TRUE) target_link_libraries(${EXE_NAME} d3d11)