Skip to content

Instantly share code, notes, and snippets.

@floooh
Last active August 29, 2015 14:13
Show Gist options
  • Save floooh/ed4eafef5e20d0057bdb to your computer and use it in GitHub Desktop.
Save floooh/ed4eafef5e20d0057bdb to your computer and use it in GitHub Desktop.
Howto integrate glfw3 into a fips project

How to add the 'fipsified' glfw3 at https://github.com/floooh/fips-glfw as import to a fips project:

  • add 'fips-glfw' as import to your project's fips.yml file:
---
# external dependencies
imports:
  - fips-glfw
  • check if fips-glfw is imported correcly and can build, from your project's root dir:
# this will fetch external imports from github:
> ./fips fetch
...
# run cmake to generate build files:
> ./fips gen
...
# check if glfw3 compiles into a static lib:
> ./fips make glfw3
...
# open the project in Xcode or VStudio and check if glfw3 shows up as target there:
> ./fips open
...
  • add 'glfw3' as a dependency in the executable's CMakeLists.txt file, or better, to the fips module which needs to call glfw (e.g. in Oryol, the Gfx module defines the dependency to glfw, and all executables which use the Gfx module also link against glfw automatically):
fips_begin_app(hello cmdline)
    fips_files(hello.cc)
    fips_deps(glfw3)
fips_end_app()

fips will automatically setup header search paths and a cmake library target (look into the generated .fips-imports.cmake file in the project root). You still will have to link against GL etc... see the Oryol Gfx CMakeLists.txt file for a complete (if complex) example:

https://github.com/floooh/oryol/blob/fips/code/Modules/Gfx/CMakeLists.txt#L134

  • use glfw in your code:
#define GLFW_INCLUDE_NONE
#include "GLFW/glfw3.h"

...
  • check if the entire project still compiles and links:
> ./fips clean all
> ./fips build

Here are other useful libs that have been fipsified so far:

fips-glm:           https://github.com/floooh/fips-glm.git
fips-unittestpp:    https://github.com/floooh/fips-unittestpp.git
fips-zlib:          https://github.com/floooh/fips-zlib.git
fips-glfw:          https://github.com/floooh/fips-glfw.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment