summaryrefslogtreecommitdiff
path: root/Tests/VSWinStorePhone/CMakeLists.txt
blob: 7227fcc033c2863db9fe74e9557fd42f19ca3925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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}
    )

    set(ASSET_FILES ${ASSET_FILES}
    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} ${ASSET_FILES}
  Direct3DApp1/Direct3DApp1_TemporaryKey.pfx)

set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets")
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)
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS)
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)

set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex)
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS)
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)


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)