forked from raysan5/raylib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,758 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,14 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | |
PLATFORM_OS = LINUX | ||
endif | ||
endif | ||
ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
UNAMEOS = $(shell uname) | ||
ifeq ($(UNAMEOS),Linux) | ||
PLATFORM_OS = LINUX | ||
endif | ||
RAYLIB_LIBTYPE = STATIC | ||
USE_EXTERNAL_GLFW = TRUE | ||
endif | ||
|
||
# RAYLIB_PATH adjustment for LINUX platform | ||
# TODO: Do we really need this? | ||
|
@@ -172,6 +180,11 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_R | |
endif | ||
endif | ||
|
||
ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
RAYLIB_PREFIX ?= .. | ||
RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX)) | ||
endif | ||
|
||
# Define default C compiler: CC | ||
#------------------------------------------------------------------------------------------------ | ||
CC = gcc | ||
|
@@ -192,6 +205,12 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_R | |
# to use emscripten.h and emscripten_set_main_loop() | ||
CC = emcc | ||
endif | ||
ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
ifeq ($(strip $(DEVKITPRO)),) | ||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro") | ||
endif | ||
include $(DEVKITPRO)/libnx/switch_rules | ||
endif | ||
|
||
# Define default make program: MAKE | ||
#------------------------------------------------------------------------------------------------ | ||
|
@@ -275,6 +294,12 @@ endif | |
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external $(EXTRA_INCLUDE_PATHS) | ||
# Define additional directories containing required header files | ||
|
||
# Define additional directories containing required header files | ||
ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
LIBDIRS := $(PORTLIBS) $(LIBNX) | ||
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE | ||
CFLAGS += -ffunction-sections $(ARCH) $(foreach dir,$(LIBDIRS),-I$(dir)/include) -D__SWITCH__ | ||
endif | ||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
ifeq ($(PLATFORM_OS),BSD) | ||
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH) -I/usr/pkg/include -I/usr/X11R7/include | ||
|
@@ -376,6 +401,10 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_R | |
|
||
endif | ||
|
||
ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
LDFLAGS += -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$*.map $(foreach dir,$(LIBDIRS),-L$(dir)/lib) | ||
endif | ||
|
||
# Define libraries required on linking: LDLIBS | ||
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name> | ||
#------------------------------------------------------------------------------------------------ | ||
|
@@ -491,6 +520,9 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_R | |
# Libraries for web (HTML5) compiling | ||
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.web.a | ||
endif | ||
ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
LDLIBS = -lraylib -lEGL -lGLESv2 -lglapi -ldrm_nouveau -lnx -lm | ||
endif | ||
|
||
# Define source code object files required | ||
#------------------------------------------------------------------------------------------------ | ||
|
@@ -655,12 +687,14 @@ AUDIO = \ | |
audio/audio_sound_multi \ | ||
audio/audio_stream_effects | ||
|
||
ifneq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
OTHERS = \ | ||
others/easings_testbed \ | ||
others/embedded_files_loading \ | ||
others/raylib_opengl_interop \ | ||
others/raymath_vector_angle \ | ||
others/rlgl_compute_shader | ||
endif | ||
|
||
ifeq ($(TARGET_PLATFORM), PLATFORM_DESKTOP_GFLW) | ||
OTHERS += others/rlgl_standalone | ||
|
@@ -690,6 +724,12 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | |
$(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$< | ||
else ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW)) | ||
$(MAKE) -f Makefile.Web $@ | ||
else ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
$(CC) -MMD -MP -MF [email protected] -o [email protected] -c $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(TARGET_PLATFORM) | ||
$(CXX) [email protected] $(LDFLAGS) $(LDLIBS) -o [email protected] -D$(TARGET_PLATFORM) | ||
$(NM) -CSn [email protected] > [email protected] | ||
nacptool --create "$(notdir $@)" "Raylib Example" "1.0.0" [email protected] | ||
elf2nro [email protected] [email protected] --icon=textures/resources/raylib_logo.jpg [email protected] | ||
else | ||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM) | ||
endif | ||
|
@@ -724,4 +764,15 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_R | |
rm -f */*.wasm */*.html */*.js */*.data | ||
endif | ||
endif | ||
@echo Cleaning done | ||
ifeq ($(TARGET_PLATFORM),PLATFORM_NX) | ||
find . -type f \( \ | ||
-name "*.o" -o \ | ||
-name "*.d" -o \ | ||
-name "*.elf" -o \ | ||
-name "*.lst" -o \ | ||
-name "*.map" -o \ | ||
-name "*.nacp" -o \ | ||
-name "*.nro" \) -delete | ||
rm -fv *.o | ||
endif | ||
@echo Cleaning done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.