diff options
| author | DarkElvenAngel <[email protected]> | 2019-06-10 16:12:06 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-06-10 16:12:06 -0400 |
| commit | d7f4be071579e6f00974c0940f021272f22fbc54 (patch) | |
| tree | 6ee389e6617c494d272e9bc82415fbc3618e7a28 /examples/Makefile | |
| parent | 8a21830b77eaa76ffe0c31df5f96aecd6bd2eecc (diff) | |
| parent | baf7d7d19ad8d6bfbfc201169e4ed4f49a9576a6 (diff) | |
| download | raylib-d7f4be071579e6f00974c0940f021272f22fbc54.tar.gz raylib-d7f4be071579e6f00974c0940f021272f22fbc54.zip | |
Merge pull request #1 from raysan5/master
Update
Diffstat (limited to 'examples/Makefile')
| -rw-r--r-- | examples/Makefile | 202 |
1 files changed, 104 insertions, 98 deletions
diff --git a/examples/Makefile b/examples/Makefile index e14762b3..02b55821 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -2,7 +2,7 @@ # # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # -# Copyright (c) 2013-2018 Ramon Santamaria (@raysan5) +# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5) # # This software is provided "as-is", without any express or implied warranty. In no event # will the authors be held liable for any damages arising from the use of this software. @@ -25,8 +25,8 @@ # Define required raylib variables PROJECT_NAME ?= raylib_examples -RAYLIB_VERSION ?= 2.0.0 -RAYLIB_API_VERSION ?= 1 +RAYLIB_VERSION ?= 2.5.0 +RAYLIB_API_VERSION ?= 2 RAYLIB_PATH ?= .. # Define default options @@ -52,7 +52,7 @@ RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include RAYLIB_LIBTYPE ?= STATIC # Build mode for project: DEBUG or RELEASE -RAYLIB_BUILD_MODE ?= RELEASE +BUILD_MODE ?= RELEASE # Use external GLFW library instead of rglfw module # TODO: Review usage on Linux. Target version of choice. Switch on -lglfw or -lglfw3 @@ -62,8 +62,6 @@ USE_EXTERNAL_GLFW ?= FALSE # by default it uses X11 windowing system USE_WAYLAND_DISPLAY ?= FALSE -# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile) - # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected ifeq ($(PLATFORM),PLATFORM_DESKTOP) # No uname.exe on MinGW!, but OS=Windows_NT on Windows! @@ -117,9 +115,9 @@ endif ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables - EMSDK_PATH = C:/emsdk - EMSCRIPTEN_VERSION = 1.38.21 - CLANG_VERSION = e1.38.21_64bit + EMSDK_PATH ?= C:/emsdk + EMSCRIPTEN_VERSION ?= 1.38.31 + CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64 NODE_VERSION = 8.9.1_64bit export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) @@ -127,27 +125,8 @@ ifeq ($(PLATFORM),PLATFORM_WEB) endif # Define raylib release directory for compiled library. -# RAYLIB_RELEASE_PATH points to provided binaries or your freshly built version. -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/src - endif - ifeq ($(PLATFORM_OS),LINUX) - RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/src - endif - ifeq ($(PLATFORM_OS),OSX) - RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/src - endif - ifeq ($(PLATFORM_OS),BSD) - RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/src - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/src -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/src -endif +# RAYLIB_RELEASE_PATH points to provided binaries or your freshly built version +RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src # EXAMPLE_RUNTIME_PATH embeds a custom runtime location of libraylib.so or other desired libraries # into each example binary compiled with RAYLIB_LIBTYPE=SHARED. It defaults to RAYLIB_RELEASE_PATH @@ -155,7 +134,7 @@ endif # without formal installation from ../src/Makefile. It aids portability and is useful if you have # multiple versions of raylib, have raylib installed to a non-standard location, or want to # bundle libraylib.so with your game. Change it to your liking. -# Note: If, at runtime, there is a libraylib.so at both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, +# NOTE: If, at runtime, there is a libraylib.so at both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, # The library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over RAYLIB_INSTALL_PATH, # Implemented for LINUX below with CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH) # To see the result, run readelf -d core/core_basic_window; looking at the RPATH or RUNPATH attribute. @@ -185,8 +164,9 @@ ifeq ($(PLATFORM),PLATFORM_RPI) endif endif ifeq ($(PLATFORM),PLATFORM_WEB) - # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop() # HTML5 emscripten compiler + # WARNING: To compile to HTML5, code must be redesigned + # to use emscripten.h and emscripten_set_main_loop() CC = emcc endif @@ -201,7 +181,7 @@ endif # Define compiler flags: # -O1 defines optimization level -# -g enable debugging +# -g include debug information on compilation # -s strip unnecessary data from build # -Wall turns on most, but not all, compiler warnings # -std=c99 defines C language mode (standard C from 1999 revision) @@ -210,25 +190,25 @@ endif # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces +ifeq ($(BUILD_MODE),DEBUG) + CFLAGS += -g +endif + # Additional flags for compiler (if desired) #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) # resource file contains windows executable icon and properties # -Wl,--subsystem,windows hides the console window - CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows + CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data -Wl,--subsystem,windows endif ifeq ($(PLATFORM_OS),LINUX) - ifeq ($(RAYLIB_BUILD_MODE),DEBUG) - CFLAGS += -g - #CC = clang - endif ifeq ($(RAYLIB_LIBTYPE),STATIC) - CFLAGS += -D_DEFAULT_SOURCE + CFLAGS += -D_DEFAULT_SOURCE endif ifeq ($(RAYLIB_LIBTYPE),SHARED) - # Explicitly enable runtime link to libraylib.so - CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH) + # Explicitly enable runtime link to libraylib.so + CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH) endif endif endif @@ -238,33 +218,35 @@ endif ifeq ($(PLATFORM),PLATFORM_WEB) # -Os # size optimization # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # -s USE_GLFW=3 # Use glfw3 library (context/input management) - # -s USE_SDL=2 # Use SDL2 library, required for audio backend - # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing + # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s USE_PTHREADS=1 # multithreading support - # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly) + # -s WASM=0 # disable Web Assembly, emitted by default # -s EMTERPRETIFY=1 # enable emscripten code interpreter (very slow) # -s EMTERPRETIFY_ASYNC=1 # support synchronous loops by emterpreter + # -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data + # -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) # --profiling # include information for code profiling + # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --preload-file resources # specify a resources folder for data compilation - CFLAGS += -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 - + CFLAGS += -Os -s USE_GLFW=3 -s FORCE_FILESYSTEM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 --preload-file $(dir $<)resources@resources + ifeq ($(BUILD_MODE), DEBUG) + CFLAGS += -s ASSERTIONS=1 --profiling + endif # NOTE: Simple raylib examples are compiled to be interpreter by emterpreter, that way, # we can compile same code for ALL platforms with no change required, but, working on bigger # projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw # logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference. # Define a custom shell .html and output extension - CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html + CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html EXT = .html endif -# Define include paths for required headers. -# Precedence: immediately local, raysan5 provided sources +# Define include paths for required headers # NOTE: Several external required libraries (stb and others) -INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external +INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external # Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) @@ -286,7 +268,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif # Define library paths containing required libs. -# Precedence: immediately local, then raysan5 provided libs LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src ifeq ($(PLATFORM),PLATFORM_DESKTOP) @@ -297,7 +278,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),LINUX) # Reset everything. # Precedence: immediately local, installed version, raysan5 provided libs - LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src + LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) endif endif @@ -310,7 +291,8 @@ endif ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) # Libraries for Windows desktop compilation - LDLIBS = -lraylib -lopengl32 -lgdi32 + # NOTE: WinMM library required to set high-res timer resolution + LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm # Required for physac examples LDLIBS += -static -lpthread endif @@ -318,10 +300,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) # Libraries for Debian GNU/Linux desktop compiling # NOTE: Required packages: libegl1-mesa-dev LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt + # On X11 requires also below libraries LDLIBS += -lX11 # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them #LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor + # On Wayland windowing system, additional libraries requires ifeq ($(USE_WAYLAND_DISPLAY),TRUE) LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon @@ -340,6 +324,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) # Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling # NOTE: Required packages: mesa-libs LDLIBS = -lraylib -lGL -lpthread -lm + # On XWindow requires also below libraries LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor endif @@ -358,78 +343,104 @@ ifeq ($(PLATFORM),PLATFORM_WEB) LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc endif -# Define all object files required +# Define all source files required EXAMPLES = \ core/core_basic_window \ core/core_input_keys \ core/core_input_mouse \ - core/core_mouse_wheel \ + core/core_input_mouse_wheel \ core/core_input_gamepad \ - core/core_random_values \ - core/core_color_select \ - core/core_drop_files \ - core/core_storage_values \ - core/core_gestures_detection \ - core/core_3d_mode \ - core/core_3d_picking \ + core/core_input_multitouch \ + core/core_input_gestures \ + core/core_2d_camera \ + core/core_3d_camera_mode \ core/core_3d_camera_free \ core/core_3d_camera_first_person \ - core/core_2d_camera \ + core/core_3d_picking \ core/core_world_screen \ + core/core_custom_logging \ + core/core_window_letterbox \ + core/core_drop_files \ + core/core_random_values \ + core/core_storage_values \ core/core_vr_simulator \ - core/core_multitouch \ - shapes/shapes_logo_raylib \ + core/core_loading_thread \ shapes/shapes_basic_shapes \ + shapes/shapes_bouncing_ball \ shapes/shapes_colors_palette \ + shapes/shapes_logo_raylib \ shapes/shapes_logo_raylib_anim \ + shapes/shapes_rectangle_scaling \ shapes/shapes_lines_bezier \ + shapes/shapes_collision_area \ + shapes/shapes_following_eyes \ + shapes/shapes_easings_ball_anim \ + shapes/shapes_easings_box_anim \ + shapes/shapes_easings_rectangle_array \ + shapes/shapes_draw_ring \ + shapes/shapes_draw_circle_sector \ + shapes/shapes_draw_rectangle_rounded \ + text/text_raylib_fonts \ + text/text_sprite_fonts \ + text/text_ttf_loading \ + text/text_bmfont_ttf \ + text/text_font_sdf \ + text/text_format_text \ + text/text_input_box \ + text/text_writing_anim \ + text/text_rectangle_bounds \ + text/text_unicode \ textures/textures_logo_raylib \ - textures/textures_image_loading \ textures/textures_rectangle \ textures/textures_srcrec_dstrec \ - textures/textures_to_image \ - textures/textures_raw_data \ - textures/textures_particles_blending \ - textures/textures_image_processing \ textures/textures_image_drawing \ textures/textures_image_generation \ + textures/textures_image_loading \ + textures/textures_image_processing \ textures/textures_image_text \ - text/text_sprite_fonts \ - text/text_bmfont_ttf \ - text/text_raylib_fonts \ - text/text_format_text \ - text/text_writing_anim \ - text/text_ttf_loading \ - text/text_bmfont_unordered \ - text/text_input_box \ - text/text_font_sdf \ - models/models_geometric_shapes \ - models/models_box_collisions \ + textures/textures_to_image \ + textures/textures_raw_data \ + textures/textures_particles_blending \ + textures/textures_npatch_drawing \ + textures/textures_background_scrolling \ + textures/textures_sprite_button \ + textures/textures_sprite_explosion \ + textures/textures_bunnymark \ + models/models_animation \ models/models_billboard \ - models/models_obj_loading \ - models/models_obj_viewer \ - models/models_heightmap \ + models/models_box_collisions \ models/models_cubicmap \ - models/models_mesh_picking \ - models/models_mesh_generation \ + models/models_first_person_maze \ + models/models_geometric_shapes \ models/models_material_pbr \ + models/models_mesh_generation \ + models/models_mesh_picking \ + models/models_obj_loading \ + models/models_obj_viewer \ + models/models_orthographic_projection \ + models/models_rlgl_solar_system \ models/models_skybox \ models/models_yaw_pitch_roll \ + models/models_heightmap \ shaders/shaders_model_shader \ shaders/shaders_shapes_textures \ shaders/shaders_custom_uniform \ shaders/shaders_postprocessing \ - shaders/shaders_raymarching \ shaders/shaders_palette_switch \ - audio/audio_sound_loading \ - audio/audio_music_stream \ + shaders/shaders_raymarching \ + shaders/shaders_texture_drawing \ + shaders/shaders_texture_waves \ + shaders/shaders_julia_set \ + shaders/shaders_eratosthenes \ audio/audio_module_playing \ + audio/audio_music_stream \ audio/audio_raw_stream \ + audio/audio_sound_loading \ physac/physics_demo \ physac/physics_friction \ physac/physics_movement \ physac/physics_restitution \ - physac/physics_shatter \ + physac/physics_shatter CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST)) @@ -446,12 +457,6 @@ else $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) endif -# fix dylib install path name for each executable (MAC) -fix_dylib: -ifeq ($(PLATFORM_OS),OSX) - find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file -endif - # Clean everything clean: ifeq ($(PLATFORM),PLATFORM_DESKTOP) @@ -459,7 +464,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) del *.o *.exe /s endif ifeq ($(PLATFORM_OS),LINUX) - find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv + find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv endif ifeq ($(PLATFORM_OS),OSX) find . -type f -perm +ugo+x -delete @@ -474,3 +479,4 @@ ifeq ($(PLATFORM),PLATFORM_WEB) del *.o *.html *.js endif @echo Cleaning done + |
