summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2017-12-14 17:15:24 +0000
committerEgor Yusov <egor.yusov@gmail.com>2017-12-14 17:15:24 +0000
commit8f945015c913842bc3d4c24fa80fcd8d16bb032f (patch)
treefb306a23148f9f83a7217bb1a6cb1f782edd916a
parentFixed angle brackets in readme (diff)
downloadDiligentEngine-8f945015c913842bc3d4c24fa80fcd8d16bb032f.tar.gz
DiligentEngine-8f945015c913842bc3d4c24fa80fcd8d16bb032f.zip
Replaced FXC command with VS_SHADER_* properties. No need to specify FXC when generating VS solution anymore
-rw-r--r--CMakeLists.txt2
m---------DiligentCore0
m---------DiligentTools0
-rw-r--r--Projects/Asteroids/CMakeLists.txt62
-rw-r--r--README.md10
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt2
-rw-r--r--unityplugin/GhostCubeScene/CMakeLists.txt2
-rw-r--r--unityplugin/UnityEmulator/CMakeLists.txt2
8 files changed, 28 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81ff385..efd8325 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.8)
+cmake_minimum_required (VERSION 3.10)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
diff --git a/DiligentCore b/DiligentCore
-Subproject a11be18c81e81210984508f5f86911ef453cbb3
+Subproject ac5ba64bd9afd46d85897ac77c44bbd4df0ed0d
diff --git a/DiligentTools b/DiligentTools
-Subproject 2d81c45170588995c346bf324b2154c4ef59efb
+Subproject aebb318b6354fae79a6416dbb15e766f2b237b1
diff --git a/Projects/Asteroids/CMakeLists.txt b/Projects/Asteroids/CMakeLists.txt
index 0849b38..94def22 100644
--- a/Projects/Asteroids/CMakeLists.txt
+++ b/Projects/Asteroids/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.8)
+cmake_minimum_required (VERSION 3.10)
project(Asteroids CXX)
@@ -34,17 +34,30 @@ set(INCLUDE
src/util.h
)
-set(SHADERS
+set(PIXEL_SHADERS
src/asteroid_ps.hlsl
src/asteroid_ps_d3d11.hlsl
- src/asteroid_vs.hlsl
src/font_ps.hlsl
src/skybox_ps.hlsl
- src/skybox_vs.hlsl
src/sprite_ps.hlsl
+)
+
+set(VERTEX_SHADERS
+ src/asteroid_vs.hlsl
+ src/skybox_vs.hlsl
src/sprite_vs.hlsl
)
+set(SHADERS ${PIXEL_SHADERS} ${VERTEX_SHADERS})
+
+set_property(SOURCE ${PIXEL_SHADERS} PROPERTY VS_SHADER_TYPE Pixel)
+set_property(SOURCE ${VERTEX_SHADERS} PROPERTY VS_SHADER_TYPE Vertex)
+set_property(SOURCE ${SHADERS} PROPERTY VS_SHADER_ENTRYPOINT "%(Filename)")
+set_property(SOURCE ${SHADERS} PROPERTY VS_SHADER_MODEL 5.0)
+set_property(SOURCE src/asteroid_ps.hlsl ps_5_1 PROPERTY VS_SHADER_MODEL 5.1)
+set_property(SOURCE ${SHADERS} PROPERTY VS_SHADER_VARIABLE_NAME "g_%(Filename)")
+set_property(SOURCE ${SHADERS} PROPERTY VS_SHADER_OUTPUT_HEADER_FILE "${CMAKE_CURRENT_BINARY_DIR}/CompiledShaders/%(Filename).h")
+
set(GUI
src/font.h
src/gui.h
@@ -83,47 +96,11 @@ else()
message(FATAL_ERROR "Unsupported platform")
endif()
-
-add_custom_target(AsteroidsShaders)
-
-set(SHADER_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/Shaders)
-file(MAKE_DIRECTORY ${SHADER_OUTPUT_DIR})
-
-macro(COMPILE_SHADER FILE SHADER_MODEL)
- get_filename_component(FILE_NAME_WE ${FILE} NAME_WE)
- get_filename_component(FILE_NAME ${FILE} NAME)
- set(OUT_FILE ${SHADER_OUTPUT_DIR}/${FILE_NAME_WE}.h)
-
- add_custom_command(TARGET AsteroidsShaders
- # Unfortunately it is not possible to set TARGET directly to GraphicsEngineD3D12-static/shared
- # because PRE_BUILD is only supported on Visual Studio 8 or later. For all other generators
- # PRE_BUILD is treated as PRE_LINK.
- COMMAND ${FXC} /T ${SHADER_MODEL} ${FILE_NAME} /E ${FILE_NAME_WE} /O3 /Vn g_${FILE_NAME_WE} /Fh ${OUT_FILE} /nologo
- MAIN_DEPENDENCY ${FILE} # the primary input source file to the command
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src
- COMMENT "Compiling shader ${FILE}"
- VERBATIM
- )
-endmacro()
-
-COMPILE_SHADER(src/asteroid_ps.hlsl ps_5_1)
-COMPILE_SHADER(src/asteroid_ps_d3d11.hlsl ps_5_0)
-COMPILE_SHADER(src/asteroid_vs.hlsl vs_5_0)
-COMPILE_SHADER(src/font_ps.hlsl ps_5_0)
-COMPILE_SHADER(src/skybox_ps.hlsl ps_5_0)
-COMPILE_SHADER(src/skybox_vs.hlsl vs_5_0)
-COMPILE_SHADER(src/sprite_ps.hlsl ps_5_0)
-COMPILE_SHADER(src/sprite_vs.hlsl vs_5_0)
-
-add_dependencies(Asteroids AsteroidsShaders)
-
-target_compile_definitions(Asteroids PRIVATE NOMINMAX)
-
target_include_directories(Asteroids
PRIVATE
Src
SDK/Include
- ${CMAKE_CURRENT_BINARY_DIR}/Shaders
+ ${CMAKE_CURRENT_BINARY_DIR}/CompiledShaders
)
target_link_libraries(Asteroids
@@ -148,8 +125,7 @@ PRIVATE
set_common_target_properties(Asteroids)
if(MSVC)
- set_header_file_only_property("${SHADERS}")
-
+ target_compile_definitions(Asteroids PRIVATE NOMINMAX)
# Disable MSVC-specific warnings
# - w4201: nonstandard extension used: nameless struct/union
# - w4324: structure was padded due to alignment specifier
diff --git a/README.md b/README.md
index 388a69b..6b86bfa 100644
--- a/README.md
+++ b/README.md
@@ -90,11 +90,11 @@ Reworking Diligent Engine build system with CMake is in progress.
## Win32
-To generate build files for Windows desktop platform, use either CMake GUI or command line tool. The build system uses standalone
-effect compiler, path to which needs to be specified via FXC variable. For example, to generate Visual Studio 2017 64-bit
-solution and project files in *cmk_build/Win64* folder, navigate to the engine's root folder and run the following command:
+To generate build files for Windows desktop platform, use either CMake GUI or command line tool. For example, to generate
+Visual Studio 2017 64-bit solution and project files in *cmk_build/Win64* folder, navigate to the engine's root folder and
+run the following command:
-*cmake -D FXC="C:/Program Files (x86)/Windows Kits/10/bin/x86/fxc.exe" -H. -B./cmk_build/Win64 -G "Visual Studio 15 2017 Win64"*
+*cmake -H. -B./cmk_build/Win64 -G "Visual Studio 15 2017 Win64"*
**WARNING!** In current implementation, full path to cmake build folder **must not contain white spaces**. (If anybody knows a way
to add quotes to CMake's custom commands, please let me know!)
@@ -112,7 +112,7 @@ To generate build files for Universal Windows platform, you need to define the f
For example, to generate Visual Studio 2017 64-bit solution and project files in *cmk_build/UWP64* folder, run the following command
from the engine's root folder:
-*cmake -D FXC="C:/Program Files (x86)/Windows Kits/10/bin/x86/fxc.exe" -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0.15063.0 -H. -B./cmk_build/UWP64 -G "Visual Studio 15 2017 Win64"*
+*cmake -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0.15063.0 -H. -B./cmk_build/UWP64 -G "Visual Studio 15 2017 Win64"*
## Android
diff --git a/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt b/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt
index 3430357..4ead45b 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt
+++ b/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.8)
+cmake_minimum_required (VERSION 3.10)
project(GhostCubePlugin CXX)
diff --git a/unityplugin/GhostCubeScene/CMakeLists.txt b/unityplugin/GhostCubeScene/CMakeLists.txt
index b78fb54..81d263a 100644
--- a/unityplugin/GhostCubeScene/CMakeLists.txt
+++ b/unityplugin/GhostCubeScene/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.8)
+cmake_minimum_required (VERSION 3.10)
project(GhostCubeScene CXX)
diff --git a/unityplugin/UnityEmulator/CMakeLists.txt b/unityplugin/UnityEmulator/CMakeLists.txt
index 21b59a9..f44d0bf 100644
--- a/unityplugin/UnityEmulator/CMakeLists.txt
+++ b/unityplugin/UnityEmulator/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.8)
+cmake_minimum_required (VERSION 3.10)
project(UnityEmulator CXX)