mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-28 01:39:17 -05:00
Compare commits
3 Commits
5a54fc12a2
...
7db5f56e81
| Author | SHA1 | Date | |
|---|---|---|---|
| 7db5f56e81 | |||
| 8d3a4b8dd5 | |||
| d0c39db6c2 |
@ -19,9 +19,18 @@ join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
configure_file(../raylib.pc.in raylib.pc @ONLY)
|
||||
configure_file(../cmake/raylib-config-version.cmake raylib-config-version.cmake @ONLY)
|
||||
configure_file(../cmake/raylib-config.cmake raylib-config.cmake @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
|
||||
install(FILES ${PROJECT_SOURCE_DIR}/../cmake/raylib-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/raylib-config.cmake"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/raylib
|
||||
)
|
||||
install(EXPORT raylib-targets
|
||||
FILE raylib-targets.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/raylib
|
||||
)
|
||||
|
||||
# populates raylib_{FOUND, INCLUDE_DIRS, LIBRARIES, LDFLAGS, DEFINITIONS}
|
||||
include(PopulateConfigVariablesLocally)
|
||||
|
||||
@ -1,81 +1,2 @@
|
||||
# - Try to find raylib
|
||||
# Options:
|
||||
# raylib_USE_STATIC_LIBS - ON by default
|
||||
# raylib_VERBOSE - OFF by default
|
||||
# Once done, this defines a raylib target that can be passed to
|
||||
# target_link_libraries as well as following variables:
|
||||
#
|
||||
# raylib_FOUND - System has raylib installed
|
||||
# raylib_INCLUDE_DIRS - The include directories for the raylib header(s)
|
||||
# raylib_LIBRARIES - The libraries needed to use raylib
|
||||
# raylib_LDFLAGS - The linker flags needed with raylib
|
||||
# raylib_DEFINITIONS - Compiler switches required for using raylib
|
||||
|
||||
option(raylib_USE_STATIC_LIBS "Use static libs" ON)
|
||||
option(raylib_VERBOSE "Show raylib verbose messages" OFF)
|
||||
|
||||
if (NOT TARGET raylib)
|
||||
set(XPREFIX PC_RAYLIB)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(${XPREFIX} QUIET raylib)
|
||||
|
||||
if (raylib_USE_STATIC_LIBS)
|
||||
set(XPREFIX ${XPREFIX}_STATIC)
|
||||
endif()
|
||||
|
||||
set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS})
|
||||
|
||||
find_path(raylib_INCLUDE_DIR
|
||||
NAMES raylib.h
|
||||
HINTS ${${XPREFIX}_INCLUDE_DIRS} ${raylib_DIR}/../../../include/
|
||||
)
|
||||
|
||||
|
||||
if (raylib_USE_STATIC_LIBS)
|
||||
set(RAYLIB_NAMES libraylib.a raylib.lib)
|
||||
else ()
|
||||
set(RAYLIB_NAMES raylib)
|
||||
endif ()
|
||||
|
||||
find_library(raylib_LIBRARY
|
||||
NAMES ${RAYLIB_NAMES}
|
||||
HINTS ${${XPREFIX}_LIBRARY_DIRS} ${raylib_DIR}/../../
|
||||
)
|
||||
|
||||
set(raylib_LIBRARIES ${raylib_LIBRARY})
|
||||
set(raylib_INCLUDE_DIRS ${raylib_INCLUDE_DIR})
|
||||
set(raylib_LDFLAGS ${${XPREFIX}_LDFLAGS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(raylib DEFAULT_MSG
|
||||
raylib_LIBRARY
|
||||
raylib_INCLUDE_DIR
|
||||
)
|
||||
|
||||
mark_as_advanced(raylib_LIBRARY raylib_INCLUDE_DIR)
|
||||
|
||||
if (raylib_USE_STATIC_LIBS)
|
||||
add_library(raylib STATIC IMPORTED GLOBAL)
|
||||
else()
|
||||
add_library(raylib SHARED IMPORTED GLOBAL)
|
||||
endif()
|
||||
string (REPLACE ";" " " raylib_LDFLAGS "${raylib_LDFLAGS}")
|
||||
|
||||
set_target_properties(raylib
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${raylib_LIBRARIES}"
|
||||
IMPORTED_IMPLIB "${raylib_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${raylib_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${raylib_LDFLAGS}"
|
||||
INTERFACE_COMPILE_OPTIONS "${raylib_DEFINITIONS}"
|
||||
)
|
||||
|
||||
if (raylib_VERBOSE)
|
||||
message(STATUS "raylib_FOUND: ${raylib_FOUND}")
|
||||
message(STATUS "raylib_INCLUDE_DIRS: ${raylib_INCLUDE_DIRS}")
|
||||
message(STATUS "raylib_LIBRARIES: ${raylib_LIBRARIES}")
|
||||
message(STATUS "raylib_LDFLAGS: ${raylib_LDFLAGS}")
|
||||
message(STATUS "raylib_DEFINITIONS: ${raylib_DEFINITIONS}")
|
||||
endif()
|
||||
endif()
|
||||
@PACKAGE_INIT@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/raylib-targets.cmake")
|
||||
|
||||
@ -91,7 +91,7 @@ if (BUILD_SHARED_LIBS)
|
||||
set_property(TARGET raylib PROPERTY C_VISIBILITY_PRESET hidden)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(raylib "${LIBS_PRIVATE}")
|
||||
target_link_libraries(raylib PRIVATE $<BUILD_INTERFACE:${LIBS_PRIVATE}>)
|
||||
|
||||
# Sets some compile time definitions for the pre-processor
|
||||
# If CUSTOMIZE_BUILD option is on you will not use config.h by default
|
||||
|
||||
@ -85,8 +85,8 @@
|
||||
#endif
|
||||
|
||||
#if ((defined(SDL_MAJOR_VERSION) && (SDL_MAJOR_VERSION == 3)) && (defined(SDL_MINOR_VERSION) && (SDL_MINOR_VERSION >= 1)))
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
#define PLATFORM_DESKTOP_SDL3
|
||||
#ifndef USING_VERSION_SDL3
|
||||
#define USING_VERSION_SDL3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -255,7 +255,7 @@ static const int CursorsLUT[] = {
|
||||
};
|
||||
|
||||
// SDL3 Migration Layer made to avoid 'ifdefs' inside functions when we can
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
|
||||
// SDL3 Migration:
|
||||
// SDL_WINDOW_FULLSCREEN_DESKTOP has been removed,
|
||||
@ -429,7 +429,7 @@ void *SDL_GetClipboardData(const char *mime_type, size_t *size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // PLATFORM_DESKTOP_SDL3
|
||||
#endif // USING_VERSION_SDL3
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Internal Functions Declaration
|
||||
@ -463,7 +463,7 @@ void ToggleFullscreen(void)
|
||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
if ((monitor > 0) && (monitor <= monitorCount))
|
||||
#else
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
@ -491,7 +491,7 @@ void ToggleBorderlessWindowed(void)
|
||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
if ((monitor > 0) && (monitor <= monitorCount))
|
||||
#else
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
@ -548,7 +548,7 @@ void SetWindowState(unsigned int flags)
|
||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
if ((monitor > 0) && (monitor <= monitorCount))
|
||||
#else
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
@ -612,7 +612,7 @@ void SetWindowState(unsigned int flags)
|
||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||
if ((monitor > 0) && (monitor <= monitorCount))
|
||||
#else
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
@ -850,7 +850,7 @@ void SetWindowMonitor(int monitor)
|
||||
const int screenHeight = CORE.Window.screen.height;
|
||||
SDL_Rect usableBounds;
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3) // Different style for success checking
|
||||
#if defined(USING_VERSION_SDL3) // Different style for success checking
|
||||
if (SDL_GetDisplayUsableBounds(monitor, &usableBounds))
|
||||
#else
|
||||
if (SDL_GetDisplayUsableBounds(monitor, &usableBounds) == 0)
|
||||
@ -966,7 +966,7 @@ Vector2 GetMonitorPosition(int monitor)
|
||||
{
|
||||
SDL_Rect displayBounds;
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
if (SDL_GetDisplayUsableBounds(monitor, &displayBounds))
|
||||
#else
|
||||
if (SDL_GetDisplayUsableBounds(monitor, &displayBounds) == 0)
|
||||
@ -1098,7 +1098,7 @@ Vector2 GetWindowScaleDPI(void)
|
||||
{
|
||||
Vector2 scale = { 1.0f, 1.0f };
|
||||
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
#ifndef USING_VERSION_SDL3
|
||||
// NOTE: SDL_GetWindowDisplayScale was only added on SDL3
|
||||
// see https://wiki.libsdl.org/SDL3/SDL_GetWindowDisplayScale
|
||||
// TODO: Implement the window scale factor calculation manually
|
||||
@ -1184,7 +1184,7 @@ Image GetClipboardImage(void)
|
||||
// Show mouse cursor
|
||||
void ShowCursor(void)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
SDL_ShowCursor();
|
||||
#else
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
@ -1195,7 +1195,7 @@ void ShowCursor(void)
|
||||
// Hides mouse cursor
|
||||
void HideCursor(void)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
SDL_HideCursor();
|
||||
#else
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
@ -1208,7 +1208,7 @@ void EnableCursor(void)
|
||||
{
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
// SDL_ShowCursor() has been split into three functions: SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
|
||||
SDL_ShowCursor();
|
||||
#else
|
||||
@ -1309,7 +1309,7 @@ const char *GetKeyName(int key)
|
||||
|
||||
static void UpdateTouchPointsSDL(SDL_TouchFingerEvent event)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP_SDL3) // SDL3
|
||||
#if defined(USING_VERSION_SDL3) // SDL3
|
||||
int count = 0;
|
||||
SDL_Finger **fingers = SDL_GetTouchFingers(event.touchID, &count);
|
||||
CORE.Input.Touch.pointCount = count;
|
||||
@ -1436,7 +1436,7 @@ void PollInputEvents(void)
|
||||
|
||||
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
// const char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
|
||||
// Event memory is now managed by SDL, so you should not free the data in SDL_EVENT_DROP_FILE, and if you want to hold onto the text in SDL_EVENT_TEXT_EDITING and SDL_EVENT_TEXT_INPUT events, you should make a copy of it. SDL_TEXTINPUTEVENT_TEXT_SIZE is no longer necessary and has been removed.
|
||||
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], event.drop.data);
|
||||
@ -1451,7 +1451,7 @@ void PollInputEvents(void)
|
||||
{
|
||||
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], event.drop.data);
|
||||
#else
|
||||
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], event.drop.file);
|
||||
@ -1466,7 +1466,7 @@ void PollInputEvents(void)
|
||||
|
||||
// Window events are also polled (Minimized, maximized, close...)
|
||||
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
#ifndef USING_VERSION_SDL3
|
||||
// SDL3 states:
|
||||
// The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed
|
||||
// In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT
|
||||
@ -1497,7 +1497,7 @@ void PollInputEvents(void)
|
||||
CORE.Window.currentFbo.height = height;
|
||||
CORE.Window.resizedLastFrame = true;
|
||||
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
#ifndef USING_VERSION_SDL3
|
||||
// Manually detect if the window was maximized (due to SDL2 restore being unreliable on some platforms) to remove the FLAG_WINDOW_MAXIMIZED accordingly
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0)
|
||||
{
|
||||
@ -1538,7 +1538,7 @@ void PollInputEvents(void)
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_DESKTOP_SDL3
|
||||
#ifdef USING_VERSION_SDL3
|
||||
if ((SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MAXIMIZED) == 0)
|
||||
{
|
||||
if ((CORE.Window.flags & SDL_WINDOW_MAXIMIZED) > 0) CORE.Window.flags &= ~SDL_WINDOW_MAXIMIZED;
|
||||
@ -1564,7 +1564,7 @@ void PollInputEvents(void)
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) == 0) CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
||||
} break;
|
||||
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
#ifndef USING_VERSION_SDL3
|
||||
default: break;
|
||||
}
|
||||
} break;
|
||||
@ -1573,7 +1573,7 @@ void PollInputEvents(void)
|
||||
// Keyboard events
|
||||
case SDL_KEYDOWN:
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
// SDL3 Migration: The following structures have been removed: * SDL_Keysym
|
||||
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
|
||||
#else
|
||||
@ -1604,7 +1604,7 @@ void PollInputEvents(void)
|
||||
case SDL_KEYUP:
|
||||
{
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
|
||||
#else
|
||||
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.scancode);
|
||||
@ -1620,7 +1620,7 @@ void PollInputEvents(void)
|
||||
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||
{
|
||||
// Add character (codepoint) to the queue
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
size_t textLen = strlen(event.text.text);
|
||||
unsigned int codepoint = (unsigned int)SDL_StepUTF8(&event.text.text, &textLen);
|
||||
#else
|
||||
@ -1991,7 +1991,7 @@ int InitPlatform(void)
|
||||
}
|
||||
|
||||
// Init window
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
platform.window = SDL_CreateWindow(CORE.Window.title, CORE.Window.screen.width, CORE.Window.screen.height, flags);
|
||||
#else
|
||||
platform.window = SDL_CreateWindow(CORE.Window.title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, CORE.Window.screen.width, CORE.Window.screen.height, flags);
|
||||
@ -2085,7 +2085,7 @@ int InitPlatform(void)
|
||||
CORE.Storage.basePath = SDL_GetBasePath(); // Alternative: GetWorkingDirectory();
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (SDL3): Initialized successfully");
|
||||
#else
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (SDL2): Initialized successfully");
|
||||
|
||||
@ -870,6 +870,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// NOTE: OpenGL ES 2.0 can be enabled on Desktop platforms,
|
||||
// in that case, functions are loaded from a custom glad for OpenGL ES 2.0
|
||||
// TODO: OpenGL ES 2.0 support shouldn't be platform-dependant, neither require GLAD
|
||||
#if defined(PLATFORM_DESKTOP_GLFW) || defined(PLATFORM_DESKTOP_SDL)
|
||||
#define GLAD_GLES2_IMPLEMENTATION
|
||||
#include "external/glad_gles2.h"
|
||||
|
||||
Reference in New Issue
Block a user