Skip to content

Commit bcde288

Browse files
Merge branch 'master' into flag-macros
2 parents 70a06f9 + 070c789 commit bcde288

File tree

220 files changed

+19685
-17673
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+19685
-17673
lines changed

.github/workflows/parse_api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Diff parse files
2323
id: diff
2424
run: |
25-
git add -N parser
25+
git add -N tools/parser
2626
git diff --name-only --exit-code
2727
continue-on-error: true
2828

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ include(CompilerFlags)
2929
# Registers build options that are exposed to cmake
3030
include(CMakeOptions.txt)
3131

32-
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM")
32+
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM" AND NOT "${PLATFORM}" MATCHES "Web")
3333
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
34-
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
34+
message(FATAL_ERROR "Cannot disable both Wayland and X11")
3535
endif()
3636
endif()
3737

@@ -51,7 +51,7 @@ if(NOT TARGET uninstall AND PROJECT_IS_TOP_LEVEL)
5151
endif()
5252

5353
if (${BUILD_EXAMPLES})
54-
MESSAGE(STATUS "Building examples is enabled")
54+
message(STATUS "Building examples is enabled")
5555
add_subdirectory(examples)
5656
endif()
5757

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ If you have any doubt, don't hesitate to [contact me](mailto:[email protected])!.
6969
You can write me a direct mail but you can also contact me on the following networks:
7070

7171
- [raylib Discord](https://discord.gg/raylib) - A direct communication channel for project discussions.
72-
- [raylib twitter](https://twitter.com/raysan5) - My personal twitter account, I usually post about raylib, you can send me PMs.
7372
- [raylib reddit](https://www.reddit.com/r/raylib/) - A good place for discussions or to ask for help.
7473
- [raylib web](http://www.raylib.com/) - On top-right corner there is a bunch of networks where you can find me.
74+
- [raylib X](https://x.com/raysan5) - My personal X account, I usually post about raylib, you can send me PMs.
7575

7676
Thank you very much for your time! :)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ raylib is present in several networks and raylib community is growing everyday.
129129
130130
- Webpage: [https://www.raylib.com](https://www.raylib.com)
131131
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
132-
- Twitter: [https://www.twitter.com/raysan5](https://www.twitter.com/raysan5)
132+
- X: [https://x.com/raysan5](https://x.com/raysan5)
133133
- BlueSky: [https://bsky.app/profile/raysan5](https://bsky.app/profile/raysan5.bsky.social)
134134
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
135135
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)

cmake/InstallConfigurations.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,18 @@ join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
1919
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
2020
configure_file(../raylib.pc.in raylib.pc @ONLY)
2121
configure_file(../cmake/raylib-config-version.cmake raylib-config-version.cmake @ONLY)
22+
configure_file(../cmake/raylib-config.cmake raylib-config.cmake @ONLY)
2223
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
2324
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
24-
install(FILES ${PROJECT_SOURCE_DIR}/../cmake/raylib-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
25+
install(FILES
26+
"${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake"
27+
"${CMAKE_CURRENT_BINARY_DIR}/raylib-config.cmake"
28+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/raylib
29+
)
30+
install(EXPORT raylib-targets
31+
FILE raylib-targets.cmake
32+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/raylib
33+
)
2534

2635
# populates raylib_{FOUND, INCLUDE_DIRS, LIBRARIES, LDFLAGS, DEFINITIONS}
2736
include(PopulateConfigVariablesLocally)

cmake/LibraryConfigurations.cmake

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ if(POLICY CMP0072)
77
cmake_policy(SET CMP0072 NEW)
88
endif()
99

10+
set(RAYLIB_DEPENDENCIES "include(CMakeFindDependencyMacro)")
11+
1012
if (${PLATFORM} MATCHES "Desktop")
1113
set(PLATFORM_CPP "PLATFORM_DESKTOP")
1214

@@ -36,19 +38,22 @@ if (${PLATFORM} MATCHES "Desktop")
3638
find_library(OSS_LIBRARY ossaudio)
3739
endif ()
3840

39-
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
41+
set(LIBS_PRIVATE pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
42+
set(LIBS_PUBLIC m)
4043
else ()
4144
find_library(pthread NAMES pthread)
4245
find_package(OpenGL QUIET)
4346
if ("${OPENGL_LIBRARIES}" STREQUAL "")
4447
set(OPENGL_LIBRARIES "GL")
4548
endif ()
4649

47-
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
50+
set(LIBS_PRIVATE pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
51+
set(LIBS_PUBLIC m)
4852

4953
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
5054
find_library(OSS_LIBRARY ossaudio)
51-
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
55+
else ()
56+
set(LIBS_PRIVATE ${LIBS_PRIVATE} atomic)
5257
endif ()
5358

5459
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD" AND USE_AUDIO)
@@ -80,7 +85,8 @@ elseif (${PLATFORM} MATCHES "Android")
8085
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -u ANativeActivity_onCreate -Wl,-undefined,dynamic_lookup")
8186

8287
find_library(OPENGL_LIBRARY OpenGL)
83-
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
88+
set(LIBS_PRIVATE log android EGL GLESv2 OpenSLES atomic c)
89+
set(LIBS_PUBLIC m)
8490

8591
elseif ("${PLATFORM}" MATCHES "DRM")
8692
set(PLATFORM_CPP "PLATFORM_DRM")
@@ -98,7 +104,8 @@ elseif ("${PLATFORM}" MATCHES "DRM")
98104
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
99105
include_directories(/usr/include/libdrm)
100106
endif ()
101-
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
107+
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread dl)
108+
set(LIBS_PUBLIC m)
102109

103110
elseif ("${PLATFORM}" MATCHES "SDL")
104111
# First, check if SDL is included as a subdirectory
@@ -120,15 +127,17 @@ elseif ("${PLATFORM}" MATCHES "SDL")
120127
find_package(SDL3 QUIET)
121128
if(SDL3_FOUND)
122129
message(STATUS "Found SDL3 via find_package()")
130+
set(LIBS_PUBLIC SDL3::SDL3)
131+
set(RAYLIB_DEPENDENCIES "${RAYLIB_DEPENDENCIES}\nfind_dependency(SDL3 REQUIRED)")
123132
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
124-
set(LIBS_PRIVATE SDL3::SDL3)
125133
add_compile_definitions(USING_SDL3_PACKAGE)
126134
else()
127135
# Fallback to SDL2
128136
find_package(SDL2 REQUIRED)
129137
message(STATUS "Found SDL2 via find_package()")
130138
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
131-
set(LIBS_PRIVATE SDL2::SDL2)
139+
set(LIBS_PUBLIC SDL2::SDL2)
140+
set(RAYLIB_DEPENDENCIES "${RAYLIB_DEPENDENCIES}\nfind_dependency(SDL3 REQUIRED)")
132141
add_compile_definitions(USING_SDL2_PACKAGE)
133142
endif()
134143
endif()

cmake/raylib-config.cmake

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,4 @@
1-
# - Try to find raylib
2-
# Options:
3-
# raylib_USE_STATIC_LIBS - ON by default
4-
# raylib_VERBOSE - OFF by default
5-
# Once done, this defines a raylib target that can be passed to
6-
# target_link_libraries as well as following variables:
7-
#
8-
# raylib_FOUND - System has raylib installed
9-
# raylib_INCLUDE_DIRS - The include directories for the raylib header(s)
10-
# raylib_LIBRARIES - The libraries needed to use raylib
11-
# raylib_LDFLAGS - The linker flags needed with raylib
12-
# raylib_DEFINITIONS - Compiler switches required for using raylib
1+
@PACKAGE_INIT@
2+
@RAYLIB_DEPENDENCIES@
133

14-
option(raylib_USE_STATIC_LIBS "Use static libs" ON)
15-
option(raylib_VERBOSE "Show raylib verbose messages" OFF)
16-
17-
if (NOT TARGET raylib)
18-
set(XPREFIX PC_RAYLIB)
19-
20-
find_package(PkgConfig QUIET)
21-
pkg_check_modules(${XPREFIX} QUIET raylib)
22-
23-
if (raylib_USE_STATIC_LIBS)
24-
set(XPREFIX ${XPREFIX}_STATIC)
25-
endif()
26-
27-
set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS})
28-
29-
find_path(raylib_INCLUDE_DIR
30-
NAMES raylib.h
31-
HINTS ${${XPREFIX}_INCLUDE_DIRS} ${raylib_DIR}/../../../include/
32-
)
33-
34-
35-
if (raylib_USE_STATIC_LIBS)
36-
set(RAYLIB_NAMES libraylib.a raylib.lib)
37-
else ()
38-
set(RAYLIB_NAMES raylib)
39-
endif ()
40-
41-
find_library(raylib_LIBRARY
42-
NAMES ${RAYLIB_NAMES}
43-
HINTS ${${XPREFIX}_LIBRARY_DIRS} ${raylib_DIR}/../../
44-
)
45-
46-
set(raylib_LIBRARIES ${raylib_LIBRARY})
47-
set(raylib_INCLUDE_DIRS ${raylib_INCLUDE_DIR})
48-
set(raylib_LDFLAGS ${${XPREFIX}_LDFLAGS})
49-
50-
include(FindPackageHandleStandardArgs)
51-
find_package_handle_standard_args(raylib DEFAULT_MSG
52-
raylib_LIBRARY
53-
raylib_INCLUDE_DIR
54-
)
55-
56-
mark_as_advanced(raylib_LIBRARY raylib_INCLUDE_DIR)
57-
58-
if (raylib_USE_STATIC_LIBS)
59-
add_library(raylib STATIC IMPORTED GLOBAL)
60-
else()
61-
add_library(raylib SHARED IMPORTED GLOBAL)
62-
endif()
63-
string (REPLACE ";" " " raylib_LDFLAGS "${raylib_LDFLAGS}")
64-
65-
set_target_properties(raylib
66-
PROPERTIES
67-
IMPORTED_LOCATION "${raylib_LIBRARIES}"
68-
IMPORTED_IMPLIB "${raylib_LIBRARIES}"
69-
INTERFACE_INCLUDE_DIRECTORIES "${raylib_INCLUDE_DIRS}"
70-
INTERFACE_LINK_LIBRARIES "${raylib_LDFLAGS}"
71-
INTERFACE_COMPILE_OPTIONS "${raylib_DEFINITIONS}"
72-
)
73-
74-
if (raylib_VERBOSE)
75-
message(STATUS "raylib_FOUND: ${raylib_FOUND}")
76-
message(STATUS "raylib_INCLUDE_DIRS: ${raylib_INCLUDE_DIRS}")
77-
message(STATUS "raylib_LIBRARIES: ${raylib_LIBRARIES}")
78-
message(STATUS "raylib_LDFLAGS: ${raylib_LDFLAGS}")
79-
message(STATUS "raylib_DEFINITIONS: ${raylib_DEFINITIONS}")
80-
endif()
81-
endif()
4+
include("${CMAKE_CURRENT_LIST_DIR}/raylib-targets.cmake")

examples/CMakeLists.txt

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,9 @@ if (${PLATFORM} MATCHES "Android")
9797
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
9898

9999
elseif (${PLATFORM} MATCHES "Web")
100-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os")
101-
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
102-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1 -s ASYNCIFY -s ALLOW_MEMORY_GROWTH=1 --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
103-
set(CMAKE_EXECUTABLE_SUFFIX ".html")
104-
105-
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
106-
107-
# Remove the -rdynamic flag because otherwise emscripten
108-
# does not generate HTML+JS+WASM files, only a non-working
109-
# and fat HTML
110-
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
100+
set(example_sources) # clear example_sources
101+
list(APPEND example_sources others/web_basic_window.c)
102+
list(APPEND example_sources core/core_input_gestures_testbed.c)
111103

112104
elseif ("${PLATFORM}" STREQUAL "DRM")
113105
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
@@ -165,10 +157,34 @@ foreach (example_source ${example_sources})
165157
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})
166158
string(APPEND resources_dir "resources")
167159

168-
if (${PLATFORM} MATCHES "Web" AND EXISTS ${resources_dir})
169-
# The local resources path needs to be mapped to /resources virtual path
170-
string(APPEND resources_dir "@resources")
171-
set_target_properties(${example_name} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}")
160+
if (${PLATFORM} MATCHES "Web")
161+
target_compile_options(${example_name} PRIVATE -Os)
162+
target_link_options(${example_name} PRIVATE
163+
-sALLOW_MEMORY_GROWTH=1
164+
-sEXPORTED_RUNTIME_METHODS=[requestFullscreen]
165+
-sUSE_GLFW=3
166+
--shell-file "${CMAKE_SOURCE_DIR}/src/shell.html"
167+
)
168+
set_target_properties(${example_name} PROPERTIES SUFFIX ".html")
169+
170+
if (EXISTS ${resources_dir})
171+
# The local resources path needs to be mapped to /resources virtual path
172+
string(APPEND resources_dir "@resources")
173+
set_target_properties(${example_name} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}")
174+
endif ()
175+
176+
if(${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES3")
177+
target_link_options(${example_name} PUBLIC "-sMIN_WEBGL_VERSION=2")
178+
target_link_options(${example_name} PUBLIC "-sMAX_WEBGL_VERSION=2")
179+
endif()
180+
181+
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
182+
if (APPLE)
183+
target_link_libraries(${example_name} "-framework IOKit")
184+
target_link_libraries(${example_name} "-framework Cocoa")
185+
target_link_libraries(${example_name} "-framework OpenGL")
186+
endif()
187+
172188
endif ()
173189
endforeach ()
174190

0 commit comments

Comments
 (0)