Skip to content

Commit

Permalink
Added support for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
iWas-Coder committed Apr 12, 2024
1 parent 5f6830f commit bc912ea
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
49 changes: 34 additions & 15 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ PPO_AR = AR
PPO_LD = LD

# Dependencies
CHECKDEPS = mkdir mkfifo gcc ar cargo jq
CHECKDEPS = mkdir mkfifo $(CC) ar cargo jq

# Directories
SRC_DIR = src
Expand Down Expand Up @@ -82,6 +82,11 @@ ifndef MAKEFLAGS_JOBS
CARGO_JOBS = -j1
endif
CC = gcc
ifeq ($(shell uname), Darwin)
CC = clang
MACOS_SPECIFIC_CFLAGS_OPTS = -x objective-c
MACOS_SPECIFIC_LDFLAGS_OPTS = -framework Cocoa -framework Carbon -framework CoreVideo -framework OpenGL -framework IOKit
endif
AR = ar -rc
ifdef Q_RSC
CARGO_QUIET_OPTS = -q --message-format=json
Expand All @@ -95,8 +100,19 @@ else
RSC += -r
DISABLE_ASSERTS_OPTS = -D NDEBUG
HIDE_WARNS_OPTS = -w
RELEASE_OPTS = -pipe -O3 -fipa-pta
STRIP_OPTS = -s
RELEASE_OPTS = -pipe -O3
ifeq ($(CC), gcc)
RELEASE_OPTS += -fipa-pta
endif
ifneq ($(shell uname), Darwin)
STRIP_OPTS = -s
endif
endif
ifeq ($(CC), gcc)
GCC_STATIC_LDFLAGS_OPTS = -static-libgcc
endif
ifneq ($(shell uname), Darwin)
BUILDID_OPTS = -Wl,--build-id
endif
define RAYLIB_CPPFLAGS
$(DISABLE_ASSERTS_OPTS) \
Expand All @@ -116,7 +132,8 @@ define RAYLIB_CFLAGS
-std=gnu99 \
$(HIDE_WARNS_OPTS) \
$(DEBUG_SYM_OPTS) \
$(RELEASE_OPTS)
$(RELEASE_OPTS) \
$(MACOS_SPECIFIC_CFLAGS_OPTS)
endef
define CFLAGS
-std=c11 \
Expand All @@ -125,19 +142,21 @@ define CFLAGS
-pedantic \
-Werror \
$(DEBUG_SYM_OPTS) \
$(RELEASE_OPTS)
$(RELEASE_OPTS) \
$(MACOS_SPECIFIC_CFLAGS_OPTS)
endef
define LDFLAGS
-Wl,--build-id \
$(STRIP_OPTS) \
$(RELEASE_OPTS) \
-L $(BUILD_DIR) \
-L $(LAUNCHER_BUILD_DIR) \
-lraylib \
-lsk_launcher \
-lpthread \
-lm \
-static-libgcc
$(BUILDID_OPTS) \
$(STRIP_OPTS) \
$(RELEASE_OPTS) \
-L $(BUILD_DIR) \
-L $(LAUNCHER_BUILD_DIR) \
-lraylib \
-lsk_launcher \
-lpthread \
-lm \
$(GCC_STATIC_LDFLAGS_OPTS) \
$(MACOS_SPECIFIC_LDFLAGS_OPTS)
endef

# Build output
Expand Down
7 changes: 7 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ You should have received a copy of the GNU General Public License along with Spa
- [[#gentoo][Gentoo]]
- [[#freebsd][FreeBSD]]
- [[#openbsd][OpenBSD]]
- [[#macos][macOS]]

* Project's Roadmap

Expand Down Expand Up @@ -200,3 +201,9 @@ sudo pkg install gmake gcc rust jq libX11 libXcursor libXrandr libXinerama libXi
sudo pkg_add gmake gcc rust jq
sudo ln -s /usr/local/bin/x86_64-unknown-openbsd*-gcc-* /usr/local/bin/gcc
#+end_src

*** macOS

#+begin_src sh
brew install rust jq
#+end_src
1 change: 0 additions & 1 deletion src/sk_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#endif

static volatile u8 running = 1;
static volatile u8 clients = 0;

static inline void handle_interrupt(i32 signum) {
if (signum == SIGINT) running = 0;
Expand Down

0 comments on commit bc912ea

Please sign in to comment.