# NvCloth uses a specific commit with PR #58 merged (Lumberyard/O3DE compatibility patches) %global commit 8e100cca5888d09f40f4721cc433f284b1841e65 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global snapdate 20200306 %global somajor 0 Name: NvCloth Version: 1.1.6 Release: 2.%{snapdate}git%{shortcommit}%{?dist} Summary: NVIDIA Cloth simulation library for real-time interactive applications # Nvidia Source Code License (1-Way Commercial) - not on the SPDX license list License: LicenseRef-Fedora-NvidiaSCL-1Way-Commercial URL: https://github.com/NVIDIAGameWorks/NvCloth Source0: %{url}/archive/%{commit}/NvCloth-%{shortcommit}.tar.gz # Only x86_64 and aarch64 are relevant targets ExclusiveArch: x86_64 aarch64 BuildRequires: cmake >= 3.3 BuildRequires: gcc-c++ BuildRequires: ninja-build %description NvCloth is a library that provides low-level access to a cloth solver designed for real-time interactive applications. It provides the ability to create cloth simulations with customizable constraints and collision handling. NvCloth is used by O3DE (Open 3D Engine) through the NVIDIA Cloth Gem. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Header files and development libraries for developing applications that use NvCloth cloth simulation. %package static Summary: Static library for %{name} Requires: %{name}-devel%{?_isa} = %{version}-%{release} %description static Static library for developing applications that use NvCloth cloth simulation. %prep %autosetup -n NvCloth-%{commit} # The CMake build for Linux lives under NvCloth/compiler/cmake/linux # and expects GW_DEPS_ROOT to point to the repo root # Patch CMakeLists.txt to use system compiler flags and support shared builds # Remove hardcoded clang requirement - use system default compiler sed -i 's/-std=c++11/-std=c++14/g' NvCloth/compiler/cmake/linux/CMakeLists.txt # Ensure position-independent code for shared library sed -i '/POSITION_INDEPENDENT_CODE/d' NvCloth/compiler/cmake/linux/NvCloth.cmake sed -i '/add_library.*NvCloth/a\\tset_target_properties(NvCloth PROPERTIES POSITION_INDEPENDENT_CODE TRUE)' \ NvCloth/compiler/cmake/linux/NvCloth.cmake 2>/dev/null || true %build export GW_DEPS_ROOT=%{_builddir}/NvCloth-%{commit} # Build shared library %cmake -S NvCloth/compiler/cmake/linux \ -G Ninja \ -DTARGET_BUILD_PLATFORM=linux \ -DNV_CLOTH_ENABLE_CUDA=0 \ -DPX_GENERATE_GPU_PROJECTS=0 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DPX_OUTPUT_LIB_DIR=%{_builddir}/lib \ -DPX_OUTPUT_DLL_DIR=%{_builddir}/lib %cmake_build # Build static library separately %cmake -S NvCloth/compiler/cmake/linux \ -G Ninja \ -B %{_builddir}/NvCloth-%{commit}/%{__cmake_builddir}-static \ -DTARGET_BUILD_PLATFORM=linux \ -DNV_CLOTH_ENABLE_CUDA=0 \ -DPX_GENERATE_GPU_PROJECTS=0 \ -DPX_STATIC_LIBRARIES=1 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DPX_OUTPUT_LIB_DIR=%{_builddir}/lib-static \ -DPX_OUTPUT_DLL_DIR=%{_builddir}/lib-static cmake --build %{_builddir}/NvCloth-%{commit}/%{__cmake_builddir}-static %{?_smp_mflags} %install # Install shared library install -d %{buildroot}%{_libdir} # Find the built shared library SHARED_LIB=$(find %{__cmake_builddir} -name 'libNvCloth*.so*' -type f | head -1) if [ -z "$SHARED_LIB" ]; then # Check alternate output locations SHARED_LIB=$(find %{_builddir} -name 'libNvCloth*.so*' -path '*/lib/*' -type f | head -1) fi if [ -n "$SHARED_LIB" ]; then install -p -m 0755 "$SHARED_LIB" %{buildroot}%{_libdir}/libNvCloth.so.%{somajor}.0.0 ln -s libNvCloth.so.%{somajor}.0.0 %{buildroot}%{_libdir}/libNvCloth.so.%{somajor} ln -s libNvCloth.so.%{somajor} %{buildroot}%{_libdir}/libNvCloth.so else echo "ERROR: Shared library not found" find %{_builddir} -name '*NvCloth*' -type f exit 1 fi # Install static library STATIC_LIB=$(find %{__cmake_builddir}-static -name 'libNvCloth*.a' -type f | head -1) if [ -z "$STATIC_LIB" ]; then STATIC_LIB=$(find %{_builddir} -name 'libNvCloth*.a' -path '*/lib-static/*' -type f | head -1) fi if [ -n "$STATIC_LIB" ]; then install -p -m 0644 "$STATIC_LIB" %{buildroot}%{_libdir}/libNvCloth.a fi # Install NvCloth headers install -d %{buildroot}%{_includedir}/NvCloth cp -a NvCloth/include/NvCloth/*.h %{buildroot}%{_includedir}/NvCloth/ if [ -d NvCloth/include/NvCloth/ps ]; then cp -a NvCloth/include/NvCloth/ps %{buildroot}%{_includedir}/NvCloth/ fi # Install PxShared foundation headers (needed by NvCloth API) install -d %{buildroot}%{_includedir}/foundation cp -a PxShared/include/foundation/*.h %{buildroot}%{_includedir}/foundation/ %files %license NvCloth/license.txt PxShared/license.txt %{_libdir}/libNvCloth.so.%{somajor} %{_libdir}/libNvCloth.so.%{somajor}.* %files devel %{_includedir}/NvCloth/ %{_includedir}/foundation/ %{_libdir}/libNvCloth.so %files static %{_libdir}/libNvCloth.a %changelog * Tue Feb 11 2025 O3DE Package Maintainers - 1.1.6-1.20200306git8e100cc - Initial package of NvCloth cloth simulation library - Built from commit 8e100cc (PR #58 merged, O3DE compatibility patches) - Includes PxShared foundation headers