Compiling

Cmake is automatically obtained using nvidia’s packman scripts for all platforms (except for Android). Internet connection is required for this.

Windows

For windows: Download and install the following dependencies:

Edit scripts/locate_cuda.bat to point to the CUDA installation folder (that contains the bin, include and lib folder), edit scripts/locate_win8sdk.bat to point to the windows SDK (C:\Program Files (x86)\Windows Kits\8.1 by default)

Run CmakeGenerateAll.bat to generate the visual studio solution files in compiler/vcXXwinXX-cmake/. Run samples/CmakeGenerateProjects.bat to generate the visual studio solution files in samples/compiler/vcXXwinXX-cmake/. For example Visual Studio 2015 solution with 64-bit target processor will be placed to compiler/vc14win64-cmake/ folder. Then open NvCloth.sln, choose the release/debug configuration and build the solution. The library binaries will be put to the bin folder next to the compiler folder.

The above project generation script has optional command line arguments to control whether CUDA/DX11 solvers should be enabled:

CmakeGenerateProjects.bat <0|1:use_cuda (default is 1)> <0|1:use_dx11 (default is 1)>

E.g.:

CmakeGenerateProjects.bat 1 0

will include CUDA solver into the compilation but exclude the DX11 solver.

Linux

Run GenerateProjectsLinux.sh to generate make files in compiler/linux64-XXXXX-cmake/

Enable or disable CUDA support by simply changing the following line in the BuildProjectsLinux.sh script included to the distribution:

export USE_CUDA=0 # 0 for disable 1 for enable

Run BuildProjectsLinux.sh script. It will generate various makefile-based projects in the compiler folder. Choose the one you need, e.g.:

cd compiler/linux64-release-cmake

then run the build process (using 5 compilation processes in parallel):

make --jobs=5

The library binaries will be put to the bin folder next to the compiler folder.

Note: In case you run the Linux project generation scripts GenerateProjectsLinux.sh and see an error like this:

env: bash\r: No such file or directory

this command will help to fix the line endings:

sed $'s/\r$//' GenerateProjectsLinux.sh > GenerateProjectsLinux.sh.fixed && mv GenerateProjectsLinux.sh.fixed GenerateProjectsLinux.sh && chmod +x GenerateProjectsLinux.sh

or use your favorite text editor.

Mac

Running BuildProjectsOsx.sh will generate various xcode-based projects in the compiler folder. Choose the one you need, e.g. cd compiler/osx64-cmake, open the project in XCode and build inside the IDE.

The library binaries will be put to the bin folder next to the compiler folder.

Note: In case if you run the Mac project generation scripts GenerateProjectsOsx.sh and see an error like this:

env: bash\r: No such file or directory

this command will help to fix the line endings:

sed $'s/\r$//' GenerateProjectsOsx.sh > GenerateProjectsOsx.sh.fixed && mv GenerateProjectsOsx.sh.fixed GenerateProjectsOsx.sh && chmod +x GenerateProjectsOsx.sh

Android

Download and install CMake 3.7 from https://cmake.org/download/. Edit scripts/locate_cmake.bat to point to the cmake executable.

Download NDK from https://developer.android.com/ndk/downloads/index.html (tested versions are r15c, r13b, r12b). Set ANDROID_NDK_ROOT environment variable to point to the root NDK folder. Run project generation script:

CmakeGenerateAndroid.bat release

You need cmake to be in your PATH.

Go to compiler\android-arm64-v8a-release-cmake folder and run:

cmake --build .  -- -j5

The library binaries will be put to the bin folder next to the compiler folder.

Note: To be able to build the Android binaries using CMake you need to make sure a certain folders in your NDK point to needed binaries. Specifically, you need to create a symlink/copy/rename:

<path_to_android_ndk>/toolchains/aarch64-linux-android-4.9/prebuilt/windows

to:

<path_to_android_ndk>/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64

Newer NDK versions might not require doing that at all, but some versions do.