A C++ Compute/Graphics Library and Toolchain enabling same-source CUDA/Host/Metal/OpenCL/Vulkan C++ programming and execution.
Switch branches/tags
Clone or download
a2flo * fixed all warnings/issues found by latest clang 8.0:
   * fixed all -Wshadow-field and -Wextra-semi-stmt
   * const_string: moved all friend template functions outside the const_string class to avoid redefinition erros
   * host_kernel: use of __sync_synchronize is still explicitly wanted
 * build script: similar to the previous commit, added an option to set the prefix path for floor source files via FLOOR_SRC_PREFIX_DIR (the previous commit only deals with header files, this now works for cpp files as well)
 * xcode: for floor_remote: set FLOOR_SRC_PREFIX_DIR and only use 4 build jobs (sshfs can't cope otherwise ...)
Latest commit 9009ff9 Dec 17, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
audio
compute * fixed all warnings/issues found by latest clang 8.0: Dec 17, 2018
constexpr * fixed all warnings/issues found by latest clang 8.0: Dec 17, 2018
core * fixed all warnings/issues found by latest clang 8.0: Dec 17, 2018
darwin
etc * clang/llvm 4.0 toolchain update: fixed copy/paste error (ptx62 ins… Oct 12, 2018
floor.xcodeproj * fixed all warnings/issues found by latest clang 8.0: Dec 17, 2018
floor * fixed all warnings/issues found by latest clang 8.0: Dec 17, 2018
lang * updated copyright year to 2018 Jan 7, 2018
math * fixed all warnings/issues found by latest clang 8.0: Dec 17, 2018
net * updated copyright year to 2018 Jan 7, 2018
threading * updated copyright year to 2018 Jan 7, 2018
.gitignore * added preliminary native read/write image support: Jun 7, 2016
.gitmodules * kill off the opencl -> cuda translator/compiler and with that the … Oct 11, 2014
LICENSE Initial commit Aug 30, 2013
README.textile * updated README: clang/llvm/libc++ 6.0+ are officially required now… Nov 4, 2018
build.sh * fixed all warnings/issues found by latest clang 8.0: Dec 17, 2018
floor.sln
floor.vcxproj
floor.vcxproj.filters * vs project: fixed filters Jan 14, 2017
floor_prefix.pch * build script: fixed build dependencies list folder replacement (th… Dec 5, 2017

README.textile

Flo’s Open libRary

Requirements:

  • OS:
    • Windows: NT 6.0+ (VS: x86/32-bit and x64/64-bit, MinGW/MSYS2: x64/64-bit only)
    • macOS: 10.11+ (x64/64-bit only)
    • iOS: 9.0+ (32-bit and 64-bit)
    • Linux: any current x64 distribution
    • FreeBSD: 10.0+ (x64/64-bit only)
    • other Unix: if x64 and other requirements are met
  • compiler/toolchain:
  • libraries and optional requirements:
    • SDL2 2.0.4+
    • OpenGL 4.1+ Core headers
    • (opt) OpenCL: requires OpenCL 1.2+ SDK and CPU/GPU drivers (Intel, AMD)
    • (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 and ICD loader / SDK
    • (opt) networking: requires asio headers and OpenSSL 1.0.1+
    • (opt) audio/OpenAL: requires OpenAL Soft

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 C++ exceptions:
      define “FLOOR_NO_EXCEPTIONS” or “./build.sh no-exceptions”
    • to build with libstdc++ instead of libc++:
      “./build.sh libstdc++”

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 is the recommended way to install additional dependencies: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    • 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 / Windows):

  • open floor.sln and build (lib and include paths might need to be modified)
  • some notes:
    • as mentionend in the requirements, Clang/LLVM must be installed
    • SDL2 is a required dependency
    • either the AMD or Intel OpenCL SDK must be installed
    • the Vulkan SDK must be installed
    • it is necessary to add the parent directory of where floor is located to the include paths
    • audio (openal) and use of exceptions are disabled by default (and not supported)
    • networking (asio/openssl) is supported optionally and can be enabled through using the “_net” build configurations

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 and copy floor.lib/floord.lib/floor64.lib/floord64.lib (VS) / libfloor_static.a/libfloord_static.a (MinGW/MSYS2) 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:
    • 4.0.0 toolchain: cd floor/etc/llvm40/ && ./build.sh
    • 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:
      • 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: