Skip to content

Commit b99c284

Browse files
committed
2 parents 6541317 + a20d9de commit b99c284

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

cmake/raylib-config.cmake

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# - Try to find raylib
22
# Options:
3-
# raylib_USE_STATIC_LIBS - OFF by default
3+
# raylib_USE_STATIC_LIBS - ON by default
44
# raylib_VERBOSE - OFF by default
55
# Once done, this defines a raylib target that can be passed to
66
# target_link_libraries as well as following variables:
@@ -11,6 +11,9 @@
1111
# raylib_LDFLAGS - The linker flags needed with raylib
1212
# raylib_DEFINITIONS - Compiler switches required for using raylib
1313

14+
option(raylib_USE_STATIC_LIBS "Use static libs" ON)
15+
option(raylib_VERBOSE "Use static libs" OFF)
16+
1417
if (NOT TARGET raylib)
1518
set(XPREFIX PC_RAYLIB)
1619

@@ -25,23 +28,22 @@ if (NOT TARGET raylib)
2528

2629
find_path(raylib_INCLUDE_DIR
2730
NAMES raylib.h
28-
HINTS ${${XPREFIX}_INCLUDE_DIRS}
31+
HINTS ${${XPREFIX}_INCLUDE_DIRS} ${raylib_DIR}/../../../include/
2932
)
3033

31-
set(RAYLIB_NAMES raylib)
3234

3335
if (raylib_USE_STATIC_LIBS)
34-
set(RAYLIB_NAMES libraylib.a raylib.lib ${RAYLIB_NAMES})
35-
endif()
36+
set(RAYLIB_NAMES libraylib.a raylib.lib)
37+
else ()
38+
set(RAYLIB_NAMES raylib)
39+
endif ()
3640

3741
find_library(raylib_LIBRARY
3842
NAMES ${RAYLIB_NAMES}
39-
HINTS ${${XPREFIX}_LIBRARY_DIRS}
43+
HINTS ${${XPREFIX}_LIBRARY_DIRS} ${raylib_DIR}/../../
4044
)
4145

4246
set(raylib_LIBRARIES ${raylib_LIBRARY})
43-
set(raylib_LIBRARY_DIRS ${${XPREFIX}_LIBRARY_DIRS})
44-
set(raylib_LIBRARY_DIR ${raylib_LIBRARY_DIRS})
4547
set(raylib_INCLUDE_DIRS ${raylib_INCLUDE_DIR})
4648
set(raylib_LDFLAGS ${${XPREFIX}_LDFLAGS})
4749

src/platforms/rcore_desktop_glfw.c

+14-12
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,12 @@ int InitPlatform(void)
15211521
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
15221522

15231523
platform.handle = glfwCreateWindow(CORE.Window.display.width, CORE.Window.display.height, (CORE.Window.title != 0)? CORE.Window.title : " ", monitor, NULL);
1524+
if (!platform.handle)
1525+
{
1526+
glfwTerminate();
1527+
TRACELOG(LOG_WARNING, "GLFW: Failed to initialize Window");
1528+
return -1;
1529+
}
15241530

15251531
// NOTE: Full-screen change, not working properly...
15261532
//glfwSetWindowMonitor(platform.handle, glfwGetPrimaryMonitor(), 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
@@ -1535,6 +1541,12 @@ int InitPlatform(void)
15351541
int creationHeight = CORE.Window.screen.height != 0 ? CORE.Window.screen.height : 1;
15361542

15371543
platform.handle = glfwCreateWindow(creationWidth, creationHeight, (CORE.Window.title != 0)? CORE.Window.title : " ", NULL, NULL);
1544+
if (!platform.handle)
1545+
{
1546+
glfwTerminate();
1547+
TRACELOG(LOG_WARNING, "GLFW: Failed to initialize Window");
1548+
return -1;
1549+
}
15381550

15391551
// After the window was created, determine the monitor that the window manager assigned.
15401552
// Derive display sizes, and, if possible, window size in case it was zero at beginning.
@@ -1558,18 +1570,8 @@ int InitPlatform(void)
15581570
return -1;
15591571
}
15601572

1561-
if (platform.handle)
1562-
{
1563-
CORE.Window.render.width = CORE.Window.screen.width;
1564-
CORE.Window.render.height = CORE.Window.screen.height;
1565-
}
1566-
}
1567-
1568-
if (!platform.handle)
1569-
{
1570-
glfwTerminate();
1571-
TRACELOG(LOG_WARNING, "GLFW: Failed to initialize Window");
1572-
return -1;
1573+
CORE.Window.render.width = CORE.Window.screen.width;
1574+
CORE.Window.render.height = CORE.Window.screen.height;
15731575
}
15741576

15751577
glfwMakeContextCurrent(platform.handle);

0 commit comments

Comments
 (0)