Flo's Open libRary
Requirements:
- OS:
- only AMD64/Intel64/ARM64 is supported
- Windows: NT 6.0+
- macOS: 10.11+
- iOS: 9.0+
- Linux: any current distribution
- FreeBSD: 10.0+
- other Unix: if other requirements are met
- compiler/toolchain:
- Generic: "Clang":http://clang.llvm.org / "LLVM":http://llvm.org 6.0+ and "libc++":http://libcxx.llvm.org 6.0+
- macOS/iOS: "Xcode":https://developer.apple.com/xcode/downloads 10.0+
- Windows (VS): "VS2019":https://visualstudio.microsoft.com/vs/preview with "Clang / LLVM for Windows":http://llvm.org/builds
- Windows (MinGW): "MSYS2":http://sourceforge.net/projects/msys2 with Clang/LLVM 6.0+ and libc++ 6.0+
- libraries and optional requirements:
- "SDL2":http://www.libsdl.org 2.0.4+
- "OpenGL 4.1+ Core headers":https://www.opengl.org/registry/#headers
- (opt) OpenCL: requires OpenCL 1.2+ SDK and CPU/GPU drivers ("Intel":https://software.intel.com/en-us/intel-opencl, "AMD":https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/releases)
- (opt) CUDA: requires sm_20+/Fermi+ GPU and CUDA 7.5+ drivers (CUDA SDK not required!)
- (opt) Metal: requires iOS 9.0+ and A7+ CPU/GPU, or macOS 10.11+ and appropriate GPU
- (opt) Host Compute: requires just the compiler/toolchain that is stated above
- (opt) Vulkan: requires 1.0.24+ "Vulkan headers":https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/tree/master/include/vulkan and "ICD loader / SDK":https://vulkan.lunarg.com
- (opt) networking: requires "asio":http://think-async.com/Asio headers and "OpenSSL":https://www.openssl.org 1.0.1+
- (opt) audio/OpenAL: requires "OpenAL Soft":http://kcat.strangesoft.net/openal.html
- (opt) VR: requires "OpenVR":https://github.com/ValveSoftware/openvr
Build Instructions:
- run ./build.sh (use "./build.sh help" to get a list of all options)
- configuration of optional parts:
- to disable OpenCL: define "FLOOR_NO_OPENCL" or "./build.sh no-opencl"
- to disable CUDA: define "FLOOR_NO_CUDA" or "./build.sh no-cuda"
- to disable Metal (only affects macOS/iOS builds): define "FLOOR_NO_METAL" or "./build.sh no-metal"
- to disable Host Compute: define "FLOOR_NO_HOST_COMPUTE" or "./build.sh no-host-compute"
- to disable Vulkan: define "FLOOR_NO_VULKAN" or "./build.sh no-vulkan"
- to disable network support (ssl/crypto/asio): define "FLOOR_NO_NET" or "./build.sh no-net"
- to disable OpenAL: define "FLOOR_NO_OPENAL" or "./build.sh no-openal"
- to disable VR: define "FLOOR_NO_VR" or "./build.sh no-vr"
- to disable C++ exceptions: define "FLOOR_NO_EXCEPTIONS" or "./build.sh no-exceptions"
- to build with libstdc++ instead of libc++: "./build.sh libstdc++"
- to build with C++20 support (requires Clang 9.0+): "./build.sh c++20"
Build Instructions (Xcode / macOS / iOS):
- open floor.xcodeproj and build
- some notes:
- all optional parts of floor are enabled here and you'll have to install all dependencies or disable them manually
- "homebrew":http://brew.sh is the recommended way to install additional dependencies: ==ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"==
- download "OpenVR":https://github.com/ValveSoftware/openvr/releases and manually install it:
- ** mkdir -p {/usr/local/include/openvr,/usr/local/lib}
- ** cp openvr/headers/* /usr/local/include/openvr/
- ** cp openvr/bin/osx32/libopenvr_api.dylib /usr/local/lib/
- command line tools might be necessary, install them with: ==xcode-select --install==
- on iOS, either copy dependencies into your iPhoneOS and iPhoneSimulator SDK, or floor/ios/deps/{include,lib}
- iOS linker flags for a depending project: -lSDL2 -lfloor -lcrypto -lssl
Build Instructions (Visual Studio 2019 / CMake / vcpkg / Windows):
- install "VS2019 16.1+":https://visualstudio.microsoft.com/vs/preview
- install "Clang / LLVM for Windows":http://llvm.org/builds
- install "Vulkan SDK":https://vulkan.lunarg.com/sdk/home
- install vcpkg (somewhere, not within libfloor):
- == git clone https://github.com/Microsoft/vcpkg.git ==
- ==cd vcpkg==
- ==.\bootstrap-vcpkg.bat -disableMetrics==
- ==.\vcpkg integrate install==
- install vcpkg packages:
- ==vcpkg --triplet x64-windows install sdl2 opengl opengl-registry OpenCL vulkan openssl-windows asio openal-soft openvr==
- in Visual Studio 2019: open folder "floor" (wait a little until build files are generated)
- select "Debug" or "Release" configuration and build
- NOTE: all dependencies (optional parts) are enabled here
Installation (Unix):
- mkdir -p /opt/floor/include
- sudo ln -sf /path/to/floor /opt/floor/include/floor
- sudo ln -sf /path/to/floor/bin /opt/floor/lib
- alternatively: copy these files/folders there
Installation (Windows):
- create a "%%ProgramFiles%%/floor" folder (C:/Program Files/floor)
- inside this folder:
- create a "lib" folder
- VS2019:
- ** copy everything from bin/ in there (dlls/lib/exp)
- MinGW/MSYS2:
- ** copy libfloor_static.a/libfloord_static.a there
- create an "include" folder and copy the original "floor" folder in there (containing all floor source code)
Misc Hints:
- when using X11 forwarding, set these env variables:
- export LIBGL_ALWAYS_INDIRECT=yes
- export SDL_VIDEO_X11_NODIRECTCOLOR=yes
- depending on how your Linux distribution handles OpenCL headers and library, you might need to manually install OpenCL 1.2+ compatible ones
Compute/Graphics Toolchain:
- automated builds for Linux, macOS and Windows can be found at: https://libfloor.org/builds/toolchain
- NOTE: this requires a Unix environment with all LLVM build dependencies installed - use MSYS2 on Windows
- NOTE: the absolute build path must not contain spaces
- NOTE: when building with GNU Make 4.2, use -j1 (jobserver changes in 4.2 broke something)
- compile the toolchain:
- 8.0 toolchain: cd floor/etc/llvm80/ && ./build.sh
- if successful, package it (in addition to a .zip file, this also creates a folder with all necessary binaries and include files): ./pkg.sh
- install the toolchain:
- Unix:
- ** automatic:
- *** development: run ./deploy_dev.sh from the floor/etc/llvm80/ folder (this will create symlinks to everything in floor and floor/etc/llvm80)
- *** release: run ./deploy_pkg.sh from inside the toolchain package folder (floor/etc/llvm80/toolchain_80000_*; this will copy everything)
- ** manual:
- *** copy the toolchain folder as "toolchain" to /opt/floor/ (should then be /opt/floor/toolchain/{bin,clang,libcxx})
- *** inside /opt/floor/toolchain, add a symlink to the floor include folder: sudo ln -sf ../include floor
- Windows:
- ** copy the toolchain folder as "toolchain" to "%%ProgramFiles%%/floor" (should then be "%%ProgramFiles%%/floor/toolchain/{bin,clang,libcxx}")
- ** inside "%%ProgramFiles%%/floor/toolchain", copy the "floor" folder from the "include" folder above it into this folder
- NOTE: this is the expected default setup - paths can be changed inside config.json (toolchain.generic.paths)
Projects and Examples using floor:
- "floor_examples":https://github.com/a2flo/floor_examples
- "libwarp":https://github.com/a2flo/libwarp
- "oclraster":https://github.com/a2flo/oclraster
- "a2elight":https://github.com/a2flo/a2elight
- "unibot":https://github.com/a2flo/unibot
Floor
A C++ Compute/Graphics Library and Toolchain enabling same-source CUDA/Host/Metal/OpenCL/Vulkan C++ programming and execution.
Floor Info
⭐ Stars 229
🔗 Source Code github.com
🕒 Last Update 4 months ago
🕒 Created 9 years ago
🐞 Open Issues 1
➗ Star-Issue Ratio 229
😎 Author a2flo