diff --git a/physx-rv64.patch b/physx-rv64.patch new file mode 100644 index 0000000..ce59988 --- /dev/null +++ b/physx-rv64.patch @@ -0,0 +1,72 @@ +diff --git a/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h b/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h +index 14ed950..24f6d3b 100644 +--- a/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h ++++ b/src/3rdparty/PhysX/pxshared/include/foundation/PxPreprocessor.h +@@ -127,6 +127,8 @@ Architecture defines, see http://sourceforge.net/p/predef/wiki/Architectures/ + #define PX_PPC 1 + #elif defined(__mips__) + #define PX_X64 1 ++#elif defined(__riscv) && __riscv_xlen == 64 ++#define PX_RV64 1 + #else + #error "Unknown architecture" + #endif +@@ -147,7 +149,7 @@ SIMD defines + #endif + + /** Disable SIMD for webassembly, mips and arm64 */ +-#if defined(__EMSCRIPTEN__) || defined(__mips__) || defined(_M_ARM64) || defined(_M_ARM) ++#if defined(__EMSCRIPTEN__) || defined(__mips__) || defined(_M_ARM64) || defined(_M_ARM) || defined(__riscv) + #define PX_SIMD_DISABLED 1 + #endif + +@@ -262,7 +264,7 @@ family shortcuts + // architecture + #define PX_INTEL_FAMILY (PX_X64 || PX_X86) + #define PX_ARM_FAMILY (PX_ARM || PX_A64) +-#define PX_P64_FAMILY (PX_X64 || PX_A64) // shortcut for 64-bit architectures ++#define PX_P64_FAMILY (PX_X64 || PX_A64 || PX_RV64) // shortcut for 64-bit architectures + + /** + C++ standard library defines +diff --git a/src/3rdparty/PhysX/source/physxextensions/src/serialization/SnSerialUtils.cpp b/src/3rdparty/PhysX/source/physxextensions/src/serialization/SnSerialUtils.cpp +index aa53797..673cb33 100644 +--- a/src/3rdparty/PhysX/source/physxextensions/src/serialization/SnSerialUtils.cpp ++++ b/src/3rdparty/PhysX/source/physxextensions/src/serialization/SnSerialUtils.cpp +@@ -39,7 +39,7 @@ using namespace physx; + namespace + { + +-#define SN_NUM_BINARY_PLATFORMS 19 ++#define SN_NUM_BINARY_PLATFORMS 20 + const PxU32 sBinaryPlatformTags[SN_NUM_BINARY_PLATFORMS] = + { + PX_MAKE_FOURCC('W','_','3','2'), +@@ -59,6 +59,7 @@ const PxU32 sBinaryPlatformTags[SN_NUM_BINARY_PLATFORMS] = + PX_MAKE_FOURCC('W','A','3','2'), + PX_MAKE_FOURCC('W','A','6','4'), + PX_MAKE_FOURCC('L','A','3','2'), ++ PX_MAKE_FOURCC('L','V','6','4'), + PX_MAKE_FOURCC('U','N','K','_'), + }; + +@@ -82,6 +83,7 @@ const char* sBinaryPlatformNames[SN_NUM_BINARY_PLATFORMS] = + "uwparm64", + "macarm", + "linuxarm", ++ "linuxrv64", + "unknown", + }; + +@@ -127,8 +129,10 @@ PxU32 getBinaryPlatformTag() + return sBinaryPlatformTags[16]; + #elif PX_LINUX && PX_ARM + return sBinaryPlatformTags[17]; +-#else ++#elif PX_LINUX && PX_RV64 + return sBinaryPlatformTags[18]; ++#else ++ return sBinaryPlatformTags[19]; + #endif + } + diff --git a/qt6-qtquick3dphysics.spec b/qt6-qtquick3dphysics.spec new file mode 100644 index 0000000..1932e15 --- /dev/null +++ b/qt6-qtquick3dphysics.spec @@ -0,0 +1,120 @@ + +%global qt_module qtquick3dphysics + +%global examples 1 + +%define short_version 6.5 + +Name: qt6-%{qt_module} +Version: 6.5.0 +Release: 1 +Summary: Qt 6 Quick3D Physics Extensions +License: GPL-3.0-only +URL: https://www.qt.io + + +Source0: https://download.qt.io/official_releases/qt/%{short_version}/%{version}/submodules/%{qt_module}-everywhere-src-%{version}.tar.xz + +#fix physx on riscv64 +# https://github.com/felixonmars/archriscv-packages/pull/1821 +%ifarch riscv64 +Patch0: physx-rv64.patch +%endif + +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: ninja-build +BuildRequires: qt6-rpm-macros >= %{version} +BuildRequires: qt6-qtbase-static >= %{version} +BuildRequires: qt6-qtbase-private-devel +%{?_qt6:Requires: %{_qt6}%{?_isa} = %{_qt6_version}} +BuildRequires: qt6-qtquick3d-devel +BuildRequires: qt6-qtshadertools-devel + +%description +This module adds physical simulation capabilities on top of Qt Quick 3D. +In particular, it enables rigid body simulation using simple primitives as well +as convex- and triangle meshes and heightmaps. Physical properties such as mass, +density, gravity and friction are customizable. This makes it possible to create +physically correct behavior in 3D scenes without having to handcraft animations. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: qt6-qtbase-devel%{?_isa} +%description devel +%{summary}. + +%if 0%{?examples} +%package examples +Summary: Programming examples for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +%description examples +%{summary}. +%endif + +%prep +%autosetup -p1 -n %{qt_module}-everywhere-src-%{version} -p1 + +%build +%define _lto_cflags %{nil} + +%cmake_qt6 -DQT_BUILD_EXAMPLES:BOOL=%{?examples:ON}%{!?examples:OFF} +cmake --build . %{?_smp_mflags} --verbose + +%install +DESTDIR="%{buildroot}" cmake --install . + +## .prl/.la file love +# nuke .prl reference(s) to %%buildroot, excessive (.la-like) libs +pushd %{buildroot}%{_qt6_libdir} +for prl_file in libQt6*.prl ; do + sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" ${prl_file} + if [ -f "$(basename ${prl_file} .prl).so" ]; then + rm -fv "$(basename ${prl_file} .prl).la" + sed -i -e "/^QMAKE_PRL_LIBS/d" ${prl_file} + fi +done +popd + +%files +%license LICENSES/* +%{_qt6_libdir}/libQt6Quick3DPhysicsHelpers.so.6* +%{_qt6_libdir}/libQt6Quick3DPhysics.so.6* +%dir %{_qt6_qmldir}/QtQuick3D +%{_qt6_qmldir}/QtQuick3D/Physics/ + +%files devel +%{_qt6_bindir}/cooker +%{_qt6_libdir}/libQt6Quick3DPhysics.prl +%{_qt6_libdir}/libQt6Quick3DPhysics.so +%{_qt6_libdir}/libQt6Quick3DPhysicsHelpers.prl +%{_qt6_libdir}/libQt6Quick3DPhysicsHelpers.so +%{_qt6_libdir}/cmake/Qt6BundledPhysX/ +%{_qt6_libdir}/cmake/Qt6Quick3DPhysics/ +%{_qt6_libdir}/cmake/Qt6Qml/QmlPlugins/*.cmake +%{_qt6_libdir}/cmake/Qt6Quick3DPhysicsHelpers/ +%{_qt6_libdir}/cmake/Qt6/FindWrapBundledPhysXConfigExtra.cmake +%{_qt6_libdir}/cmake/Qt6BuildInternals/StandaloneTests/QtQuick3DPhysicsTestsConfig.cmake +%{_qt6_archdatadir}/metatypes/qt6quick3dphysics_*_metatypes.json +%{_qt6_archdatadir}/metatypes/qt6quick3dphysicshelpers_*_metatypes.json +%{_qt6_archdatadir}/modules/Quick3DPhysics.json +%{_qt6_archdatadir}/modules/Quick3DPhysicsHelpers.json +%{_qt6_includedir}/QtQuick3DPhysics/ +%{_qt6_includedir}/QtQuick3DPhysicsHelpers/ +%{_qt6_mkspecsdir}/modules/qt_lib_quick3dphysics.pri +%{_qt6_mkspecsdir}/modules/qt_lib_quick3dphysics_private.pri +%{_qt6_mkspecsdir}/modules/qt_lib_quick3dphysicshelpers.pri +%{_qt6_mkspecsdir}/modules/qt_lib_quick3dphysicshelpers_private.pri +%{_qt6_libdir}/libQt6BundledPhysX.a +%{_qt6_libdir}/pkgconfig/*.pc + + +%if 0%{?examples} +%files examples +%{_qt6_examplesdir}/ +%endif + +%changelog +* Tue May 9 2023 EastDong - 6.5.0-1 +- init package \ No newline at end of file diff --git a/qt6-qtquick3dphysics.yaml b/qt6-qtquick3dphysics.yaml new file mode 100644 index 0000000..82dbef8 --- /dev/null +++ b/qt6-qtquick3dphysics.yaml @@ -0,0 +1,4 @@ +version_control: git +src_repo: https://code.qt.io/qt/qtquick3dphysics.git +tag_prefix: "^v" +separator: "." diff --git a/qtquick3dphysics-everywhere-src-6.5.0.tar.xz b/qtquick3dphysics-everywhere-src-6.5.0.tar.xz new file mode 100644 index 0000000..05c69d1 Binary files /dev/null and b/qtquick3dphysics-everywhere-src-6.5.0.tar.xz differ