Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ floor Public

A C++ Compute/Graphics Library and Toolchain enabling same-source CUDA/Host/Metal/OpenCL/Vulkan C++ programming and execution.

License

Notifications You must be signed in to change notification settings

a2flo/floor

 
 

Repository files navigation

Flo’s Open libRary

Requirements:

  • OS:
    • Windows: NT 6.0+ (lib is x86/32-bit only here)
    • OS X: 10.9+ (lib is x64/64-bit only here)
    • iOS: 7.0+ (32-bit armv7/armv7s or 64-bit arm64/aarch64)
    • Linux: any current x64 distribution
    • FreeBSD: 10.0+ (lib is x64/64-bit only here)
    • other Unix: if x64 and other requirements are met
  • compiler/toolchain:
  • libraries and optional requirements:
    • SDL2 2.0.4+ is recommended, earlier versions might work (Windows 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 8.3+ and A7+ CPU/GPU, or OS X 10.11+ and appropriate GPU
    • (opt) Host Compute: requires just the compiler/toolchain that is stated above
    • (opt) networking: requires asio headers and OpenSSL 1.0.1+
    • (opt) audio/OpenAL: requires OpenAL Soft
    • (opt) XML: requires libxml2 (probably with iconv)

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 iOS/OS X 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 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 XML:
      define “FLOOR_NO_XML” or “./build.sh no-xml”
    • to disable C++ exceptions:
      define “FLOOR_NO_EXCEPTIONS” → “./build.sh no-exceptions”

Build Instructions (Xcode / OS X / 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
    • 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 / VS):

  • create a “%ProgramFiles%/floor” folder (C:/Program Files/floor)
  • inside this folder:
    • create a “lib” folder and copy floor.lib/floord.lib there
    • create an “include” folder and copy the original “floor” folder in there (containing all floor source code)

Installation (Windows / MSYS2):

  • WIP (expecting it to be /opt/floor, then same as Unix)

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
  • the CUDA SDK might provide conflicting OpenCL 1.1 headers and library, simply remove them if this happens (although this is usally taken care of by having the CUDA SDK path last)

Compute 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
  • compile the toolchain:
    • cd floor/etc/llvm35/ && ./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 “compute_clang_*_*” folder as “compute” to /opt/floor/ (should then be /opt/floor/compute/{bin,clang,libcxx})
      • inside /opt/floor/compute, add a symlink to the floor include folder: sudo ln -sf ../include/floor floor
    • Windows:
      • copy the “compute_clang_*_*” folder as “compute” to “%ProgramFiles%/floor” (should then be “%ProgramFiles%/floor/compute/{bin,clang,libcxx}”)
      • inside “%ProgramFiles%/floor/compute”, 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 the config.json (compute.toolchain.paths)

Projects and Examples using floor:

About

A C++ Compute/Graphics Library and Toolchain enabling same-source CUDA/Host/Metal/OpenCL/Vulkan C++ programming and execution.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published