Skip to content

Commit

Permalink
Merge pull request #10 from yvt/patch-macos-support
Browse files Browse the repository at this point in the history
Add macOS support
  • Loading branch information
xtreme8000 authored Dec 21, 2017
2 parents 58b09bd + c5fe745 commit 8996140
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ target_link_libraries(client ${libs})
file(GLOB libs2 libs/*a)
target_link_libraries(client ${libs2})

if(WIN32)
if(APPLE)
target_link_libraries(client "-framework OpenGL")
target_link_libraries(client "-framework OpenAL")
target_link_libraries(client glfw)
target_link_libraries(client enet)
elseif(WIN32)
target_link_libraries(client gdi32)
target_link_libraries(client opengl32)
target_link_libraries(client ws2_32)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ Start the client with the following inside the `build/bin/` directory:
./client -aos://16777343:32887
```

#### macOS

The same instructions for Linux work on macOS aside from some minor differences. First, use Homebrew or MacPorts to grab dependencies:
```
brew install glfw enet
```
The development headers for OpenAL and OpenGL don't have to be installed since they come with macOS by default. libdeflate and lodepng should be installed and placed manually in a way similar to Linux. See _Wiki/Building_ for more details.

## Gallery

| <img src="/docs/pic01.png" width="250px"> | <img src="/docs/pic02.png" width="250px"> | <img src="/docs/pic03.png" width="250px"> |
Expand Down
9 changes: 9 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#if __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif

#include <stdlib.h>
#include <string.h>
Expand All @@ -11,7 +16,11 @@
#include <unistd.h>
#include <time.h>

#if __APPLE__
#include <OpenGL/glext.h>
#else
#include "GL/glext.h"
#endif

#include "GLFW/glfw3.h"

Expand Down
5 changes: 5 additions & 0 deletions src/sound.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#if __APPLE__
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif

#define SOUND_SCALE 0.6F

Expand Down

0 comments on commit 8996140

Please sign in to comment.