Use configure_file instead of file WRITE to write generated files. (#61)

This commit is contained in:
Brandon DeRosier
2019-09-24 06:00:12 -07:00
committed by widberg
parent f23cf9bf17
commit 2539947609
5 changed files with 11 additions and 4 deletions

3
.gitignore vendored
View File

@@ -10,5 +10,6 @@ Release/
*.sln
install/
install_manifest.txt
generated/
generated/*
!generated/*.in
cmake_install.cmake

View File

@@ -9,17 +9,20 @@
# this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
add_library( bgfx-vertexdecl INTERFACE )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/vertexdecl.cpp "#include \"${BGFX_DIR}/src/vertexdecl.cpp\"" )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/generated/vertexdecl.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/generated/vertexdecl.cpp )
target_sources( bgfx-vertexdecl INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/generated/vertexdecl.cpp )
target_include_directories( bgfx-vertexdecl INTERFACE ${BGFX_DIR}/include )
add_library( bgfx-shader-spirv INTERFACE )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/shader_spirv.cpp "#include \"${BGFX_DIR}/src/shader_spirv.cpp\"" )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/generated/shader_spirv.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/generated/shader_spirv.cpp )
target_sources( bgfx-shader-spirv INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/generated/shader_spirv.cpp )
target_include_directories( bgfx-shader-spirv INTERFACE ${BGFX_DIR}/include )
add_library( bgfx-bounds INTERFACE )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/bounds.cpp "#include \"${BGFX_DIR}/examples/common/bounds.cpp\"" )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/generated/bounds.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/generated/bounds.cpp )
target_sources( bgfx-bounds INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/generated/bounds.cpp )
target_include_directories( bgfx-bounds INTERFACE ${BGFX_DIR}/include )
target_include_directories( bgfx-bounds INTERFACE ${BGFX_DIR}/examples/common )

1
generated/bounds.cpp.in Normal file
View File

@@ -0,0 +1 @@
#include "@BGFX_DIR@/examples/common/bounds.cpp"

View File

@@ -0,0 +1 @@
#include "@BGFX_DIR@/src/shader_spirv.cpp"

View File

@@ -0,0 +1 @@
#include "@BGFX_DIR@/src/vertexdecl.cpp"