Flo's Open libRary


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
  • ** 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):
    • ==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:


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