Skip to content

Commit a4b305a

Browse files
Reworked the way File2String utility is used
1 parent 30d5e13 commit a4b305a

File tree

9 files changed

+34
-41
lines changed

9 files changed

+34
-41
lines changed

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ endif()
119119

120120
include(BuildUtils.cmake)
121121

122-
if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
123-
add_subdirectory(Utilities)
124-
endif()
125-
122+
add_subdirectory(Utilities)
126123
add_subdirectory(Primitives)
127124
add_subdirectory(Platforms)
128125
add_subdirectory(External)

Graphics/GraphicsEngineD3DBase/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ SOURCES
3636
include/HLSLDefinitions.fxh
3737
)
3838

39-
if(PLATFORM_UNIVERSAL_WINDOWS)
40-
# On Universal Windows Platform, we cannot build File2String utility and will use prebuilt Win32 version
41-
set(FILE2STRING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../Utilities/File2Include/bin/Win32/File2String.exe")
42-
else()
43-
add_dependencies(ProcessHLSLDefinitions File2String)
44-
set(FILE2STRING_PATH $<TARGET_FILE:File2String>)
45-
endif()
46-
4739
add_custom_command(TARGET ProcessHLSLDefinitions
4840
# Unfortunately it is not possible to set TARGET directly to GraphicsEngineD3DBase
4941
# because PRE_BUILD is only supported on Visual Studio 8 or later. For all other generators

Graphics/HLSL2GLSLConverterLib/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,13 @@ PUBLIC
4343
GraphicsEngineInterface
4444
)
4545

46-
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
46+
if(NOT FILE2STRING_PATH STREQUAL "")
4747
# Create custom target to convert GLSLDefinitions.h to GLSLDefinitions_inc.h
4848
add_custom_target(ProcessGLSLDefinitions
4949
SOURCES
5050
include/GLSLDefinitions.h
5151
)
5252

53-
if(PLATFORM_WIN32)
54-
set(FILE2STRING_PATH $<TARGET_FILE:File2String>)
55-
add_dependencies(ProcessGLSLDefinitions File2String)
56-
else()
57-
# We cannot build File2String utility and will use prebuilt Win32 version
58-
set(FILE2STRING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../Utilities/File2Include/bin/Win32/File2String.exe")
59-
endif()
60-
6153
add_custom_command(TARGET ProcessGLSLDefinitions
6254
# Unfortunately it is not possible to set TARGET directly to HLSL2GLSLConverterLib
6355
# because PRE_BUILD is only supported on Visual Studio 8 or later. For all other generators
@@ -72,6 +64,8 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
7264
set_target_properties(ProcessGLSLDefinitions PROPERTIES
7365
FOLDER Core/Graphics/Helper
7466
)
67+
else()
68+
message(WARNING "File2String utility is currently unavailable on this host system. This is not an issues unless you modify GLSLDefinitions.h file")
7569
endif()
7670

7771
source_group("src" FILES ${SOURCE})

Utilities/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
cmake_minimum_required (VERSION 3.3)
22

3-
if(PLATFORM_WIN32)
4-
add_subdirectory(File2Include)
5-
endif()
3+
add_subdirectory(File2Include)
Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
cmake_minimum_required (VERSION 3.10)
22

3-
project(File2Include)
3+
if(PLATFORM_WIN32)
4+
project(File2Include)
45

5-
set(SOURCE
6-
File2String.cpp
7-
)
6+
set(SOURCE
7+
File2String.cpp
8+
)
89

9-
add_executable(File2String ${SOURCE})
10+
add_executable(File2String ${SOURCE})
1011

11-
if(PLATFORM_WIN32)
12-
if(MSVC)
13-
set(MSVC_DBG_COMPILE_OPTIONS /MTd)
14-
set(MSVC_REL_COMPILE_OPTIONS /MT)
15-
target_compile_options(File2String PRIVATE "$<$<CONFIG:DEBUG>:${MSVC_DBG_COMPILE_OPTIONS}>")
16-
target_compile_options(File2String PRIVATE "$<$<CONFIG:RELEASE>:${MSVC_REL_COMPILE_OPTIONS}>")
17-
target_compile_options(File2String PRIVATE "$<$<CONFIG:MINSIZEREL>:${MSVC_REL_COMPILE_OPTIONS}>")
18-
target_compile_options(File2String PRIVATE "$<$<CONFIG:RELWITHDEBINFO>:${MSVC_REL_COMPILE_OPTIONS}>")
12+
if(PLATFORM_WIN32)
13+
if(MSVC)
14+
set(MSVC_DBG_COMPILE_OPTIONS /MTd)
15+
set(MSVC_REL_COMPILE_OPTIONS /MT)
16+
target_compile_options(File2String PRIVATE "$<$<CONFIG:DEBUG>:${MSVC_DBG_COMPILE_OPTIONS}>")
17+
target_compile_options(File2String PRIVATE "$<$<CONFIG:RELEASE>:${MSVC_REL_COMPILE_OPTIONS}>")
18+
target_compile_options(File2String PRIVATE "$<$<CONFIG:MINSIZEREL>:${MSVC_REL_COMPILE_OPTIONS}>")
19+
target_compile_options(File2String PRIVATE "$<$<CONFIG:RELWITHDEBINFO>:${MSVC_REL_COMPILE_OPTIONS}>")
20+
endif()
21+
set_target_properties(File2String PROPERTIES
22+
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin/Win32/x${ARCH}"
23+
)
1924
endif()
25+
source_group("source" FILES ${SOURCE})
26+
27+
set_target_properties(File2String PROPERTIES
28+
FOLDER Utilities
29+
)
2030
endif()
21-
source_group("source" FILES ${SOURCE})
2231

23-
set_target_properties(File2String PROPERTIES
24-
FOLDER Utilities
25-
)
32+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
33+
# Use prebuilt 32-bit version
34+
set(FILE2STRING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/Win32/x32/File2String.exe" CACHE INTERNAL "File2String utility")
35+
else()
36+
set(FILE2STRING_PATH "" CACHE INTERNAL "File2String utility unavailable on this host system")
37+
endif()
-87.5 KB
Binary file not shown.
-107 KB
Binary file not shown.
107 KB
Binary file not shown.
125 KB
Binary file not shown.

0 commit comments

Comments
 (0)