From 035dd284b70429c7a59237c1e6debc1663bd7e15 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 15 Dec 2017 21:23:06 -0800 Subject: CMake: enabling Android build --- Graphics/HLSL2GLSLConverterLib/CMakeLists.txt | 48 ++++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'Graphics/HLSL2GLSLConverterLib') diff --git a/Graphics/HLSL2GLSLConverterLib/CMakeLists.txt b/Graphics/HLSL2GLSLConverterLib/CMakeLists.txt index a2146be9..b3194592 100644 --- a/Graphics/HLSL2GLSLConverterLib/CMakeLists.txt +++ b/Graphics/HLSL2GLSLConverterLib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.3) +cmake_minimum_required (VERSION 3.6) project(HLSL2GLSLConverterLib CXX) @@ -42,25 +42,36 @@ PRIVATE GraphicsTools ) -# Create custom target to convert GLSLDefinitions.h to GLSLDefinitions_inc.h -add_custom_target(ProcessGLSLDefinitions -SOURCES - include/GLSLDefinitions.h -) -add_dependencies(ProcessGLSLDefinitions File2String) +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + # Create custom target to convert GLSLDefinitions.h to GLSLDefinitions_inc.h + add_custom_target(ProcessGLSLDefinitions + SOURCES + include/GLSLDefinitions.h + ) -add_custom_command(TARGET ProcessGLSLDefinitions - # Unfortunately it is not possible to set TARGET directly to GraphicsEngineD3DBase - # because PRE_BUILD is only supported on Visual Studio 8 or later. For all other generators - # PRE_BUILD is treated as PRE_LINK. - COMMAND COMMAND $ include/GLSLDefinitions.h include/GLSLDefinitions_inc.h - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Processing GLSLDefinitions.h" - VERBATIM -) + if(PLATFORM_WIN32) + set(FILE2STRING_PATH $) + add_dependencies(ProcessGLSLDefinitions File2String) + else() + # We cannot run File2String utility and will use prebuilt Win32 version + set(FILE2STRING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../Utilities/File2Include/bin/Win32/File2String.exe") + endif() -add_dependencies(HLSL2GLSLConverterLib ProcessGLSLDefinitions) + add_custom_command(TARGET ProcessGLSLDefinitions + # Unfortunately it is not possible to set TARGET directly to GraphicsEngineD3DBase + # because PRE_BUILD is only supported on Visual Studio 8 or later. For all other generators + # PRE_BUILD is treated as PRE_LINK. + COMMAND COMMAND ${FILE2STRING_PATH} include/GLSLDefinitions.h include/GLSLDefinitions_inc.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Processing GLSLDefinitions.h" + VERBATIM + ) + add_dependencies(HLSL2GLSLConverterLib ProcessGLSLDefinitions) + set_target_properties(ProcessGLSLDefinitions PROPERTIES + FOLDER Core/Graphics/Helper + ) +endif() source_group("src" FILES ${SOURCE}) source_group("include" FILES ${INCLUDE}) @@ -70,6 +81,3 @@ source_group("generated" FILES include/GLSLDefinitions_inc.h) set_target_properties(HLSL2GLSLConverterLib PROPERTIES FOLDER Core/Graphics ) -set_target_properties(ProcessGLSLDefinitions PROPERTIES - FOLDER Core/Graphics/Helper -) \ No newline at end of file -- cgit v1.2.3