Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information of how to build glfw-rs on OSX #48

Closed
bvssvni opened this issue Apr 6, 2014 · 0 comments
Closed

Information of how to build glfw-rs on OSX #48

bvssvni opened this issue Apr 6, 2014 · 0 comments

Comments

@bvssvni
Copy link
Member

bvssvni commented Apr 6, 2014

Binaries for CMake (command line tool)

CMake is a tool for building from source independent of platform or compiler.
If you are running OSX, you might not have 'cmake' in the Terminal.
You can download binaries from here:

http://www.cmake.org/cmake/resources/software.html

In the setup, you need to select the option of linking tools to the command line (if any option). After installation, the CMake.app should be put in the Applications folder.

If there are no option, start CMake with administrator privileges:

sudo /Applications/CMake.app/Contents/MacOS/CMake

Then go to Tools menu and click 'Install For Command Line Use'.

Pkg-config (command line tool)

This is a helper tool to provide the right compiler commands when building glfw-rs.
If you are running OSX, you might not have 'pkg-config' in the Terminal.

If you have http://brew.sh/ you can type brew install cmake pkg-config and skip the rest.
If you have http://www.macports.org/ you can type sudo port install cmake pkg-config and skip the rest.

You can download a mac installer here:

http://macpkg.sourceforge.net/

After running installed, execute the following command in the Terminal:

export PATH=$PATH:/opt/pkgconfig/bin/

Building GLFW

If you have http://brew.sh/ you can type brew install glfw3 and skip the rest.

Open up the Terminal and navigate to a folder where you put open source projects.
Type:

git clone https://github.com/glfw/glfw
cd glfw
cmake .

Open up 'CMakeCache.txt' and set BUILD_SHARED_LIBS:BOOL=ON.
This will build shared libraries that can be linked statically into glfw-rs.

make
sudo make install

Building glfw-rs

On OSX you need pkg-config to find 'glfw3.pc'.
This comes with the GLFW source code.
For my system this is:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/Users/sven/Desktop/opensource/glfw/src

Now you can clone the glfw-rs repository:

git clone https://github.com/bjz/glfw-rs.git
cd glfw-rs/
make

Using the compiled library

glfw-rs compiles to the 'lib/' folder.
There is one .dylib file and one .rlib file.
Use .dylib if you want to compile dynamically and .rlib if you want to compile statically.

Recompile

You need to set two environment variables before make works.
On my system it becomes:

export PATH=$PATH:/opt/pkgconfig/bin/
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/Users/sven/Desktop/opensource/glfw/src
make
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant