mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 13:02:33 +01:00
Added BGFX_CUSTOM_TARGETS and BGFX_AMALGAMATED
Custom targets can be annoying if you have a tools or examples target. Amalgamated builds are now defaulted to off to ensure useful debugging info.
This commit is contained in:
@@ -22,8 +22,10 @@ endif()
|
||||
option( BGFX_BUILD_TOOLS "Build bgfx tools." ON )
|
||||
option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON )
|
||||
option( BGFX_INSTALL "Create installation target." ON )
|
||||
option( BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON )
|
||||
option( BGFX_USE_OVR "Build with OVR support." OFF )
|
||||
option( BX_AMALGAMATED "Amalgamate bx source files for faster compilation" ON )
|
||||
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
|
||||
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
|
||||
|
||||
if( NOT BX_DIR )
|
||||
set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." )
|
||||
|
||||
@@ -16,6 +16,15 @@ endif()
|
||||
|
||||
# Grab the bgfx source files
|
||||
file( GLOB BGFX_SOURCES ${BGFX_DIR}/src/*.cpp ${BGFX_DIR}/src/*.mm ${BGFX_DIR}/src/*.h ${BGFX_DIR}/include/bgfx/*.h ${BGFX_DIR}/include/bgfx/c99/*.h )
|
||||
if(BGFX_AMALGAMATED)
|
||||
set(BGFX_NOBUILD ${BGFX_SOURCES})
|
||||
list(REMOVE_ITEM BGFX_NOBUILD ${BGFX_DIR}/src/amalgamated.cpp)
|
||||
foreach(BGFX_SRC ${BGFX_NOBUILD})
|
||||
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 )
|
||||
endif()
|
||||
|
||||
# Create the bgfx target
|
||||
add_library( bgfx STATIC ${BGFX_SOURCES} )
|
||||
@@ -56,7 +65,6 @@ if( UNIX AND NOT APPLE )
|
||||
endif()
|
||||
|
||||
# Excluded files from compilation
|
||||
set_source_files_properties( ${BGFX_DIR}/src/amalgamated.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/amalgamated.mm PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/glcontext_ppapi.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/glcontext_egl.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
|
||||
@@ -117,8 +117,10 @@ function( add_example ARG_NAME )
|
||||
if( MSVC )
|
||||
set_target_properties( example-${ARG_NAME} PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"" )
|
||||
endif()
|
||||
if( BGFX_CUSTOM_TARGETS )
|
||||
add_dependencies( examples example-${ARG_NAME} )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Configure shaders
|
||||
if( NOT ARG_COMMON )
|
||||
@@ -133,7 +135,9 @@ function( add_example ARG_NAME )
|
||||
endfunction()
|
||||
|
||||
# Build all examples target
|
||||
if( BGFX_CUSTOM_TARGETS )
|
||||
add_custom_target( examples )
|
||||
endif()
|
||||
|
||||
# Add common library for examples
|
||||
add_example(
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
# You should have received a copy of the CC0 Public Domain Dedication along with
|
||||
# this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
if( BGFX_CUSTOM_TARGETS )
|
||||
add_custom_target( tools )
|
||||
endif()
|
||||
|
||||
include( cmake/tools/geometryc.cmake )
|
||||
include( cmake/tools/shaderc.cmake )
|
||||
|
||||
@@ -17,4 +17,6 @@ add_executable( geometryc ${BGFX_DIR}/tools/geometryc/geometryc.cpp )
|
||||
target_compile_definitions( geometryc PRIVATE "-D_CRT_SECURE_NO_WARNINGS" )
|
||||
set_target_properties( geometryc PROPERTIES FOLDER "bgfx/tools" )
|
||||
target_link_libraries( geometryc bx bgfx-bounds bgfx-vertexdecl forsyth-too ib-compress )
|
||||
if( BGFX_CUSTOM_TARGETS )
|
||||
add_dependencies( tools geometryc )
|
||||
endif()
|
||||
|
||||
@@ -18,7 +18,9 @@ add_executable( shaderc ${BGFX_DIR}/tools/shaderc/shaderc.cpp ${BGFX_DIR}/tools/
|
||||
target_compile_definitions( shaderc PRIVATE "-D_CRT_SECURE_NO_WARNINGS" )
|
||||
set_target_properties( shaderc PROPERTIES FOLDER "bgfx/tools" )
|
||||
target_link_libraries( shaderc bx bgfx-vertexdecl bgfx-shader-spirv fcpp glsl-optimizer glslang )
|
||||
if( BGFX_CUSTOM_TARGETS )
|
||||
add_dependencies( tools shaderc )
|
||||
endif()
|
||||
|
||||
function( add_shader ARG_FILE )
|
||||
# Parse arguments
|
||||
|
||||
Reference in New Issue
Block a user