Updated bx & bgfx, added bimg

This commit is contained in:
Joshua Brookover
2017-04-04 20:35:50 -05:00
parent 2f42712efd
commit 105a1a40b7
15 changed files with 185 additions and 5 deletions

3
.gitmodules vendored
View File

@@ -4,3 +4,6 @@
[submodule "bx"] [submodule "bx"]
path = bx path = bx
url = https://github.com/bkaradzic/bx.git url = https://github.com/bkaradzic/bx.git
[submodule "bimg"]
path = bimg
url = https://github.com/bkaradzic/bimg.git

View File

@@ -30,6 +30,9 @@ option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF
if( NOT BX_DIR ) if( NOT BX_DIR )
set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." ) set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." )
endif() endif()
if( NOT BIMG_DIR )
set( BIMG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bimg" CACHE STRING "Location of bimg." )
endif()
if( NOT BGFX_DIR ) if( NOT BGFX_DIR )
set( BGFX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bgfx" CACHE STRING "Location of bgfx." ) set( BGFX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bgfx" CACHE STRING "Location of bgfx." )
endif() endif()
@@ -40,6 +43,7 @@ endif()
include( cmake/shared.cmake ) include( cmake/shared.cmake )
include( cmake/bx.cmake ) include( cmake/bx.cmake )
include( cmake/bimg.cmake )
include( cmake/bgfx.cmake ) include( cmake/bgfx.cmake )
if( BGFX_BUILD_TOOLS ) if( BGFX_BUILD_TOOLS )
@@ -55,6 +59,10 @@ if( BGFX_INSTALL )
install( TARGETS bx DESTINATION lib ) install( TARGETS bx DESTINATION lib )
install( DIRECTORY ${BX_DIR}/include DESTINATION . ) install( DIRECTORY ${BX_DIR}/include DESTINATION . )
# install bimg
install( TARGETS bimg DESTINATION lib )
install( DIRECTORY ${BIMG_DIR}/include DESTINATION . )
# install bgfx # install bgfx
install( TARGETS bgfx DESTINATION lib ) install( TARGETS bgfx DESTINATION lib )
install( DIRECTORY ${BGFX_DIR}/include DESTINATION . ) install( DIRECTORY ${BGFX_DIR}/include DESTINATION . )

2
bgfx

Submodule bgfx updated: 31312f897d...c50cc8493f

1
bimg Submodule

Submodule bimg added at 342b0ed11f

2
bx

Submodule bx updated: ac80145c2f...96e8c66a60

19
cmake/3rdparty/edtaa3.cmake vendored Normal file
View File

@@ -0,0 +1,19 @@
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# 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( TARGET edtaa3 )
return()
endif()
file( GLOB EDTAA3_SOURCES ${BIMG_DIR}/3rdparty/edtaa3/*.cpp ${BIMG_DIR}/3rdparty/edtaa3/*.h )
add_library( edtaa3 STATIC ${EDTAA3_SOURCES} )
target_include_directories( edtaa3 PUBLIC ${BIMG_DIR}/3rdparty )
set_target_properties( edtaa3 PROPERTIES FOLDER "bgfx/3rdparty" )

19
cmake/3rdparty/etc1.cmake vendored Normal file
View File

@@ -0,0 +1,19 @@
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# 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( TARGET etc1 )
return()
endif()
file( GLOB ETC1_SOURCES ${BIMG_DIR}/3rdparty/etc1/*.cpp ${BIMG_DIR}/3rdparty/etc1/*.h )
add_library( etc1 STATIC ${ETC1_SOURCES} )
target_include_directories( etc1 PUBLIC ${BIMG_DIR}/3rdparty )
set_target_properties( etc1 PROPERTIES FOLDER "bgfx/3rdparty" )

20
cmake/3rdparty/etc2.cmake vendored Normal file
View File

@@ -0,0 +1,20 @@
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# 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( TARGET etc2 )
return()
endif()
file( GLOB ETC2_SOURCES ${BIMG_DIR}/3rdparty/etc2/*.cpp ${BIMG_DIR}/3rdparty/etc2/*.h )
add_library( etc2 STATIC ${ETC2_SOURCES} )
target_include_directories( etc2 PUBLIC ${BIMG_DIR}/3rdparty )
set_target_properties( etc2 PROPERTIES FOLDER "bgfx/3rdparty" )
target_link_libraries( etc2 PUBLIC bx )

19
cmake/3rdparty/libsquish.cmake vendored Normal file
View File

@@ -0,0 +1,19 @@
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# 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( TARGET squish )
return()
endif()
file( GLOB SQUISH_SOURCES ${BIMG_DIR}/3rdparty/libsquish/*.cpp ${BIMG_DIR}/3rdparty/libsquish/*.h ${BIMG_DIR}/3rdparty/libsquish/*.inl )
add_library( squish STATIC ${SQUISH_SOURCES} )
target_include_directories( squish PUBLIC ${BIMG_DIR}/3rdparty )
set_target_properties( squish PROPERTIES FOLDER "bgfx/3rdparty" )

33
cmake/3rdparty/nvtt.cmake vendored Normal file
View File

@@ -0,0 +1,33 @@
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# 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( TARGET nvtt )
return()
endif()
file(
GLOB
NVTT_SOURCES
${BIMG_DIR}/3rdparty/nvtt/bc6h/*.cpp
${BIMG_DIR}/3rdparty/nvtt/bc6h/*.h
${BIMG_DIR}/3rdparty/nvtt/bc7/*.cpp
${BIMG_DIR}/3rdparty/nvtt/bc7/*.h
${BIMG_DIR}/3rdparty/nvtt/nvcore/*.h
${BIMG_DIR}/3rdparty/nvtt/nvcore/*.inl
${BIMG_DIR}/3rdparty/nvtt/nvmath/*.cpp
${BIMG_DIR}/3rdparty/nvtt/nvmath/*.h
${BIMG_DIR}/3rdparty/nvtt/*.cpp
${BIMG_DIR}/3rdparty/nvtt/*.h
)
add_library( nvtt STATIC ${NVTT_SOURCES} )
target_include_directories( nvtt PUBLIC ${BIMG_DIR}/3rdparty ${BIMG_DIR}/3rdparty/nvtt )
set_target_properties( nvtt PROPERTIES FOLDER "bgfx/3rdparty" )
target_link_libraries( nvtt PUBLIC bx )

19
cmake/3rdparty/pvrtc.cmake vendored Normal file
View File

@@ -0,0 +1,19 @@
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# 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( TARGET pvrtc )
return()
endif()
file( GLOB SQUISH_SOURCES ${BIMG_DIR}/3rdparty/pvrtc/*.cpp ${BIMG_DIR}/3rdparty/pvrtc/*.h )
add_library( pvrtc STATIC ${SQUISH_SOURCES} )
target_include_directories( pvrtc PUBLIC ${BIMG_DIR}/3rdparty )
set_target_properties( pvrtc PROPERTIES FOLDER "bgfx/3rdparty" )

View File

@@ -41,8 +41,8 @@ endif()
target_include_directories( bgfx PRIVATE ${BGFX_DIR}/3rdparty ${BGFX_DIR}/3rdparty/dxsdk/include ${BGFX_DIR}/3rdparty/khronos ) target_include_directories( bgfx PRIVATE ${BGFX_DIR}/3rdparty ${BGFX_DIR}/3rdparty/dxsdk/include ${BGFX_DIR}/3rdparty/khronos )
target_include_directories( bgfx PUBLIC ${BGFX_DIR}/include ) target_include_directories( bgfx PUBLIC ${BGFX_DIR}/include )
# bgfx depends on bx # bgfx depends on bx and bimg
target_link_libraries( bgfx PUBLIC bx ) target_link_libraries( bgfx PUBLIC bx bimg )
# ovr support # ovr support
if( BGFX_USE_OVR ) if( BGFX_USE_OVR )

38
cmake/bimg.cmake Normal file
View File

@@ -0,0 +1,38 @@
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# 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/>.
# Third party libs
include( cmake/3rdparty/edtaa3.cmake )
include( cmake/3rdparty/etc1.cmake )
include( cmake/3rdparty/etc2.cmake )
include( cmake/3rdparty/libsquish.cmake )
include( cmake/3rdparty/nvtt.cmake )
include( cmake/3rdparty/pvrtc.cmake )
# Ensure the directory exists
if( NOT IS_DIRECTORY ${BIMG_DIR} )
message( SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}" )
return()
endif()
# Grab the bimg source files
file( GLOB BIMG_SOURCES ${BIMG_DIR}/src/*.cpp )
# Create the bimg target
add_library( bimg STATIC ${BIMG_SOURCES} )
# Add include directory of bimg
target_include_directories( bimg PUBLIC ${BIMG_DIR}/include )
# bimg dependencies
target_link_libraries( bimg bx edtaa3 etc1 etc2 squish nvtt pvrtc )
# Put in a "bgfx" folder in Visual Studio
set_target_properties( bimg PROPERTIES FOLDER "bgfx" )

View File

@@ -186,3 +186,4 @@ add_example( 29-debugdraw )
add_example( 30-picking ) add_example( 30-picking )
add_example( 31-rsm ) add_example( 31-rsm )
add_example( 32-particles ) add_example( 32-particles )
#add_example( 33-pom ) # not currently working in Direct3D

View File

@@ -17,7 +17,7 @@ include( cmake/3rdparty/glslang.cmake )
add_executable( shaderc ${BGFX_DIR}/tools/shaderc/shaderc.cpp ${BGFX_DIR}/tools/shaderc/shaderc.h ${BGFX_DIR}/tools/shaderc/shaderc_glsl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_hlsl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_pssl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_spirv.cpp ) add_executable( shaderc ${BGFX_DIR}/tools/shaderc/shaderc.cpp ${BGFX_DIR}/tools/shaderc/shaderc.h ${BGFX_DIR}/tools/shaderc/shaderc_glsl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_hlsl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_pssl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_spirv.cpp )
target_compile_definitions( shaderc PRIVATE "-D_CRT_SECURE_NO_WARNINGS" ) target_compile_definitions( shaderc PRIVATE "-D_CRT_SECURE_NO_WARNINGS" )
set_target_properties( shaderc PROPERTIES FOLDER "bgfx/tools" ) set_target_properties( shaderc PROPERTIES FOLDER "bgfx/tools" )
target_link_libraries( shaderc bx bgfx-vertexdecl bgfx-shader-spirv fcpp glsl-optimizer glslang ) target_link_libraries( shaderc bx bimg bgfx-vertexdecl bgfx-shader-spirv fcpp glsl-optimizer glslang )
if( BGFX_CUSTOM_TARGETS ) if( BGFX_CUSTOM_TARGETS )
add_dependencies( tools shaderc ) add_dependencies( tools shaderc )
endif() endif()