diff options
author | Sandy Carter | 2021-01-30 22:21:02 -0500 |
---|---|---|
committer | Sandy Carter | 2021-01-30 22:38:32 -0500 |
commit | 37c473ca9d30ba9e7d463a58365bb65ee416b2ee (patch) | |
tree | 85cfea0a6cbeef96b16a1e271179b552c25d5a96 | |
parent | 81f63187a78dcd5b975050a9a4effb18c0219e1e (diff) | |
download | aur-37c473ca9d30ba9e7d463a58365bb65ee416b2ee.tar.gz |
convert to cmake package using bgfx.cmake
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | 0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch | 28 | ||||
-rw-r--r-- | 0002-bimg-specify-visibility-of-linked-libs.patch | 26 | ||||
-rw-r--r-- | 0003-install-if-generating-shared-only-install-bgfx.patch | 40 | ||||
-rw-r--r-- | 0004-bgfx-make-bx-and-bimg-private.patch | 40 | ||||
-rw-r--r-- | PKGBUILD | 86 |
7 files changed, 203 insertions, 36 deletions
@@ -1,22 +1,34 @@ -pkgbase = bgfx-git - pkgdesc = Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library. +pkgbase = bgfx-cmake-git + pkgdesc = Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library. (With CMake build scripts) pkgver = r7631.741028840 pkgrel = 1 url = https://bkaradzic.github.io arch = x86_64 license = BSD + license = CC makedepends = git makedepends = cmake depends = mesa depends = libx11 provides = bgfx conflicts = bgfx + conflicts = bgfx-git source = git://github.com/bkaradzic/bx.git source = git://github.com/bkaradzic/bimg.git source = git://github.com/bkaradzic/bgfx.git + source = git://github.com/widberg/bgfx.cmake.git + source = 0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch + source = 0002-bimg-specify-visibility-of-linked-libs.patch + source = 0003-install-if-generating-shared-only-install-bgfx.patch + source = 0004-bgfx-make-bx-and-bimg-private.patch sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP + sha256sums = SKIP + sha256sums = 164c5d569d605f3e02552ad57383fbb2448e48270cdb95009672ade6e1be8050 + sha256sums = 20d6949f9a5d95bd0f21c51a99baca8b84163462b42a5472c2b237ee915993cc + sha256sums = 471c2f61b071246bd653623e5939aa2874aac7b006af6907459b1a3c23dc1952 + sha256sums = 294df452d039824ac8280af6089918ac09a5feafd3bc1821e125e602cca073fa -pkgname = bgfx-git +pkgname = bgfx-cmake-git diff --git a/.gitignore b/.gitignore index 8838026c098f..f263dc79f57d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ pkg/ bgfx/ bimg/ bx/ +bgfx.cmake/ *.pkg.tar.* diff --git a/0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch b/0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch new file mode 100644 index 000000000000..34aab28d60d1 --- /dev/null +++ b/0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch @@ -0,0 +1,28 @@ +From db7e9cb07341043ac9949012d9e1a978fa7c8508 Mon Sep 17 00:00:00 2001 +From: Sandy Carter <bwrsandman@gmail.com> +Date: Sat, 30 Jan 2021 19:33:13 -0500 +Subject: [PATCH 1/4] cmake: turn on CMAKE_POSITION_INDEPENDENT_CODE for shared + +This prevents an error while linking libbx.a into libbgfx.so on linux +--- + CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 52a7315..4412be1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,6 +41,10 @@ set( BGFX_LIBRARY_TYPE "STATIC" CACHE STRING "Linking type for library" ) + + set_property( CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED ) + ++if( BGFX_LIBRARY_TYPE MATCHES "SHARED" ) ++ set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++endif() ++ + if( NOT BX_DIR ) + set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." ) + elseif( NOT IS_ABSOLUTE "${BX_DIR}") +-- +2.30.0 + diff --git a/0002-bimg-specify-visibility-of-linked-libs.patch b/0002-bimg-specify-visibility-of-linked-libs.patch new file mode 100644 index 000000000000..ea0a32aabf11 --- /dev/null +++ b/0002-bimg-specify-visibility-of-linked-libs.patch @@ -0,0 +1,26 @@ +From 3935d459cc299e172e28e70d5ee8eb2d798ecbc0 Mon Sep 17 00:00:00 2001 +From: Sandy Carter <bwrsandman@gmail.com> +Date: Sat, 30 Jan 2021 21:18:07 -0500 +Subject: [PATCH 2/4] bimg: specify visibility of linked libs + +--- + cmake/bimg.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmake/bimg.cmake b/cmake/bimg.cmake +index 56a047e..f403771 100644 +--- a/cmake/bimg.cmake ++++ b/cmake/bimg.cmake +@@ -38,7 +38,7 @@ target_include_directories( bimg + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + + # bimg dependencies +-target_link_libraries( bimg bx astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc ) ++target_link_libraries( bimg PUBLIC bx PRIVATE astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc ) + + # Put in a "bgfx" folder in Visual Studio + set_target_properties( bimg PROPERTIES FOLDER "bgfx" ) +\ No newline at end of file +-- +2.30.0 + diff --git a/0003-install-if-generating-shared-only-install-bgfx.patch b/0003-install-if-generating-shared-only-install-bgfx.patch new file mode 100644 index 000000000000..ebe306ab5a9a --- /dev/null +++ b/0003-install-if-generating-shared-only-install-bgfx.patch @@ -0,0 +1,40 @@ +From bf668bfed4ae56d4efcd7013f9e93eed21c0c2f5 Mon Sep 17 00:00:00 2001 +From: Sandy Carter <bwrsandman@gmail.com> +Date: Sat, 30 Jan 2021 20:52:41 -0500 +Subject: [PATCH 3/4] install: if generating shared, only install bgfx + +--- + CMakeLists.txt | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4412be1..ca72939 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,13 +122,22 @@ if( BGFX_INSTALL ) + install(FILES ${BGFX_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) + install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) + +- install( TARGETS bgfx bimg bx astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc ++ install( TARGETS bgfx + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) ++ if( NOT BGFX_LIBRARY_TYPE MATCHES "SHARED" ) ++ install( TARGETS bimg bx astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc ++ EXPORT "${TARGETS_EXPORT_NAME}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ++ ) ++ endif() + if (BGFX_CONFIG_RENDERER_WEBGPU) + install( TARGETS webgpu + EXPORT "${TARGETS_EXPORT_NAME}" +-- +2.30.0 + diff --git a/0004-bgfx-make-bx-and-bimg-private.patch b/0004-bgfx-make-bx-and-bimg-private.patch new file mode 100644 index 000000000000..2bf04cac4e6d --- /dev/null +++ b/0004-bgfx-make-bx-and-bimg-private.patch @@ -0,0 +1,40 @@ +From 2e984715d77426b72d467ee3fb8c26658a7e4a26 Mon Sep 17 00:00:00 2001 +From: Sandy Carter <bwrsandman@gmail.com> +Date: Sat, 30 Jan 2021 22:08:08 -0500 +Subject: [PATCH 4/4] bgfx: make bx and bimg private + +This makes it so in shared mode, bx and bimg static libs aren't installed +--- + cmake/bgfx.cmake | 2 +- + cmake/examples.cmake | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/bgfx.cmake b/cmake/bgfx.cmake +index c2757ad..a0a3d30 100755 +--- a/cmake/bgfx.cmake ++++ b/cmake/bgfx.cmake +@@ -82,7 +82,7 @@ target_include_directories( bgfx + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + + # bgfx depends on bx and bimg +-target_link_libraries( bgfx PUBLIC bx bimg ) ++target_link_libraries( bgfx PRIVATE bx bimg ) + + # ovr support + if( BGFX_USE_OVR ) +diff --git a/cmake/examples.cmake b/cmake/examples.cmake +index 68093b4..9076932 100755 +--- a/cmake/examples.cmake ++++ b/cmake/examples.cmake +@@ -134,7 +134,7 @@ function( add_example ARG_NAME ) + if( ARG_COMMON ) + add_library( example-${ARG_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES} ) + target_include_directories( example-${ARG_NAME} PUBLIC ${BGFX_DIR}/examples/common ) +- target_link_libraries( example-${ARG_NAME} PUBLIC bgfx dear-imgui meshoptimizer ) ++ target_link_libraries( example-${ARG_NAME} PUBLIC bgfx bx bimg dear-imgui meshoptimizer ) + if( BGFX_WITH_GLFW ) + find_package( glfw3 REQUIRED ) + target_link_libraries( example-${ARG_NAME} PUBLIC glfw ) +-- +2.30.0 + @@ -1,55 +1,75 @@ -pkgname=bgfx-git +pkgname=bgfx-cmake-git pkgver=r7631.741028840 pkgrel=1 -pkgdesc="Cross-platform, graphics API agnostic, \"Bring Your Own Engine/Framework\" style rendering library." +pkgdesc="Cross-platform, graphics API agnostic, \"Bring Your Own Engine/Framework\" style rendering library. (With CMake build scripts)" arch=('x86_64') url="https://bkaradzic.github.io" -license=('BSD') +license=('BSD' 'CC') depends=('mesa' 'libx11') makedepends=('git' 'cmake') -conflicts=("${pkgname%-git}") -provides=("${pkgname%-git}") +conflicts=(bgfx bgfx-git) +provides=(bgfx) source=('git://github.com/bkaradzic/bx.git' 'git://github.com/bkaradzic/bimg.git' - 'git://github.com/bkaradzic/bgfx.git') -sha256sums=('SKIP' 'SKIP' 'SKIP') + 'git://github.com/bkaradzic/bgfx.git' + 'git://github.com/widberg/bgfx.cmake.git' + '0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch' + '0002-bimg-specify-visibility-of-linked-libs.patch' + '0003-install-if-generating-shared-only-install-bgfx.patch' + '0004-bgfx-make-bx-and-bimg-private.patch') # https://github.com/widberg/bgfx.cmake/pull/100 +sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' + '164c5d569d605f3e02552ad57383fbb2448e48270cdb95009672ade6e1be8050' + '20d6949f9a5d95bd0f21c51a99baca8b84163462b42a5472c2b237ee915993cc' + '471c2f61b071246bd653623e5939aa2874aac7b006af6907459b1a3c23dc1952' + '294df452d039824ac8280af6089918ac09a5feafd3bc1821e125e602cca073fa') pkgver() { - cd "${srcdir}/${pkgname%-git}" + cd "${srcdir}/bgfx" printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } -build() { - cd "${srcdir}/${pkgname%-git}" - if [ `check_option debug`=y ] - then - make linux-debug64 - else - make linux-release64 - fi -} +prepare() { + cd "${srcdir}/bgfx.cmake" -package() { - cd "${srcdir}/${pkgname%-git}" - CONFIG=Release - if [ `check_option debug`=y ] - then - CONFIG=Debug - fi - install -D .build/linux64_gcc/bin/libbgfx-shared-lib${CONFIG}.so ${pkgdir}/usr/lib/libbgfx.so - install -dm755 ${pkgdir}/usr/include - for PROJ in bx bimg bgfx - do - cp -r ${srcdir}/${PROJ}/include ${pkgdir}/usr - done - install -m644 src/bgfx_shader.sh ${pkgdir}/usr/include/bgfx/ - install -m644 src/bgfx_compute.sh ${pkgdir}/usr/include/bgfx/ + git config --file=.gitmodules submodule.bx.url $srcdir/bx + git config --file=.gitmodules submodule.bimg.url $srcdir/bimg + git config --file=.gitmodules submodule.bgfx.url $srcdir/bgfx + git submodule sync + git submodule update --init + + patch -p1 -i $srcdir/0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch + patch -p1 -i $srcdir/0002-bimg-specify-visibility-of-linked-libs.patch + patch -p1 -i $srcdir/0003-install-if-generating-shared-only-install-bgfx.patch + patch -p1 -i $srcdir/0004-bgfx-make-bx-and-bimg-private.patch + + # prepend bgfx to bin names to avoid naming conflicts for BIN in geometryc geometryv shaderc texturec texturev do - install -D .build/linux64_gcc/bin/${BIN}${CONFIG} ${pkgdir}/usr/bin/bgfx-${BIN} + echo "" >> cmake/tools/$BIN.cmake + echo "set_target_properties( $BIN PROPERTIES OUTPUT_NAME bgfx-$BIN )" >> cmake/tools/$BIN.cmake done } +build() { + cd "${srcdir}/bgfx.cmake" + cmake -DBGFX_BUILD_EXAMPLES=OFF \ + -DBGFX_INSTALL_EXAMPLES=OFF \ + -DBGFX_CUSTOM_TARGETS=OFF \ + -DBGFX_LIBRARY_TYPE=SHARED \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake --build . +} + +package() { + cd "${srcdir}/bgfx.cmake" + cmake --install . -v --strip --prefix "$pkgdir/usr" + + # remove helper and 3rdparty includes used to compile bgfx + rm -rf ${pkgdir}/usr/include/compat + rm -rf ${pkgdir}/usr/include/tinystl +} + # vim:set ts=2 sw=2 et: |