From 87759f1c11daf024bfb97ee4c46e062371ebc04d Mon Sep 17 00:00:00 2001 From: Joshua Brookover Date: Thu, 22 Jun 2017 21:49:51 -0500 Subject: [PATCH] Fixed issues with amalgamated builds --- cmake/bgfx.cmake | 6 +++++- cmake/shared.cmake | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmake/bgfx.cmake b/cmake/bgfx.cmake index 40a7a1f..2ae4a5c 100755 --- a/cmake/bgfx.cmake +++ b/cmake/bgfx.cmake @@ -23,7 +23,11 @@ if(BGFX_AMALGAMATED) set_source_files_properties( ${BGFX_SRC} PROPERTIES HEADER_FILE_ONLY ON ) endforeach() else() - set_source_files_properties( ${BGFX_DIR}/src/amalgamated.cpp PROPERTIES HEADER_FILE_ONLY ON ) + if(APPLE) + set_source_files_properties( ${BGFX_DIR}/src/amalgamated.mm PROPERTIES HEADER_FILE_ONLY ON ) + else() + set_source_files_properties( ${BGFX_DIR}/src/amalgamated.cpp PROPERTIES HEADER_FILE_ONLY ON ) + endif() endif() # Create the bgfx target diff --git a/cmake/shared.cmake b/cmake/shared.cmake index 5cff1de..2812767 100644 --- a/cmake/shared.cmake +++ b/cmake/shared.cmake @@ -9,15 +9,18 @@ # this software. If not, see . add_library( bgfx-vertexdecl INTERFACE ) -target_sources( bgfx-vertexdecl INTERFACE ${BGFX_DIR}/src/vertexdecl.cpp ) +file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/vertexdecl.cpp "#include \"${BGFX_DIR}/src/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 ) -target_sources( bgfx-shader-spirv INTERFACE ${BGFX_DIR}/src/shader_spirv.cpp ) +file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/shader_spirv.cpp "#include \"${BGFX_DIR}/src/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 ) -target_sources( bgfx-bounds INTERFACE ${BGFX_DIR}/examples/common/bounds.cpp ) +file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/bounds.cpp "#include \"${BGFX_DIR}/examples/common/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 )