2014-08-28 17:53:24 +04:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(VSWinStorePhone)
|
2015-10-02 21:34:55 +03:00
|
|
|
if(MSVC_VERSION GREATER 1899)
|
|
|
|
set(COMPILER_VERSION "14")
|
|
|
|
elseif(MSVC_VERSION GREATER 1700)
|
2014-08-28 17:53:24 +04:00
|
|
|
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}
|
2014-12-03 00:32:45 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
set(ASSET_FILES ${ASSET_FILES}
|
2014-08-28 17:53:24 +04:00
|
|
|
Direct3DApp1/Assets/Logo.png
|
|
|
|
Direct3DApp1/Assets/SmallLogo.png
|
2015-10-02 21:34:55 +03:00
|
|
|
Direct3DApp1/Assets/SmallLogo44x44.png
|
2014-08-28 17:53:24 +04:00
|
|
|
Direct3DApp1/Assets/SplashScreen.png
|
|
|
|
Direct3DApp1/Assets/StoreLogo.png
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-06-18 00:24:21 +03:00
|
|
|
set(STRING_FILES
|
|
|
|
Direct3DApp1/Strings/en-US/Resources.resw)
|
|
|
|
|
2014-08-28 17:53:24 +04:00
|
|
|
set(RESOURCE_FILES
|
2016-06-18 00:24:21 +03:00
|
|
|
${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} ${ASSET_FILES} ${STRING_FILES}
|
2014-08-28 17:53:24 +04:00
|
|
|
Direct3DApp1/Direct3DApp1_TemporaryKey.pfx)
|
|
|
|
|
|
|
|
set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
|
2014-12-03 00:32:45 +03:00
|
|
|
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
|
|
|
|
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets")
|
2016-06-18 00:24:21 +03:00
|
|
|
set_property(SOURCE ${STRING_FILES} PROPERTY VS_TOOL_OVERRIDE "PRIResource")
|
2014-08-28 17:53:24 +04:00
|
|
|
set_property(SOURCE ${DEBUG_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $<CONFIG:Debug>)
|
|
|
|
set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY
|
|
|
|
VS_DEPLOYMENT_CONTENT $<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>)
|
|
|
|
|
|
|
|
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel)
|
2014-12-02 12:41:10 +03:00
|
|
|
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS)
|
|
|
|
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
|
2015-01-26 22:16:42 +03:00
|
|
|
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"")
|
2014-12-02 12:41:10 +03:00
|
|
|
|
2014-08-28 17:53:24 +04:00
|
|
|
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex)
|
2014-12-02 12:41:10 +03:00
|
|
|
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS)
|
|
|
|
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
|
2015-01-26 22:16:42 +03:00
|
|
|
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"")
|
2014-12-02 12:41:10 +03:00
|
|
|
|
2014-08-28 17:53:24 +04:00
|
|
|
|
|
|
|
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)
|
2015-10-02 21:34:55 +03:00
|
|
|
|
|
|
|
string(SUBSTRING "${CMAKE_SYSTEM_VERSION}" 0, 4, SHORT_VERSION)
|
|
|
|
|
|
|
|
if("${SHORT_VERSION}" STREQUAL "10.0")
|
|
|
|
message(STATUS "Targeting Windows 10. Setting Extensions to version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
|
|
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
|
|
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
|
|
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
2016-06-18 00:18:39 +03:00
|
|
|
|
|
|
|
# Add a reference to an SDK
|
|
|
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_SDK_REFERENCES "Microsoft.UniversalCRT.Debug, Version=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
2015-10-02 21:34:55 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2014-08-28 17:53:24 +04:00
|
|
|
target_link_libraries(${EXE_NAME} d3d11)
|