Fixed the build for web using CMake.
I found that the build for me was failing and I added some if defined checks in the core.c file where the glfwSetWindowAttrib was used. (error: implicit declaration of function 'glfwSetWindowAttrib' is invalid in C99 [-Werror,-Wimplicit-function-declaration]) I also changed some values in the toolchain file so that it correctly uses the .bat files when on windows.
This commit is contained in:
parent
039503e7c2
commit
191d261393
|
|
@ -1,7 +1,24 @@
|
||||||
SET(CMAKE_SYSTEM_NAME Linux)
|
SET(CMAKE_SYSTEM_NAME Linux)
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR x86)
|
||||||
|
|
||||||
|
SET(CMAKE_CROSSCOMPILING TRUE)
|
||||||
|
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||||
|
|
||||||
|
# Unset WIN32 and APPLE
|
||||||
|
SET(WIN32)
|
||||||
|
SET(APPLE)
|
||||||
|
|
||||||
|
# Emscripten is able to mimic Unix systems
|
||||||
|
SET(UNIX 1)
|
||||||
|
|
||||||
|
if (CMAKE_HOST_WIN32)
|
||||||
|
SET(CMAKE_C_COMPILER "emcc.bat")
|
||||||
|
SET(CMAKE_CXX_COMPILER "em++.bat")
|
||||||
|
else ()
|
||||||
|
SET(CMAKE_C_COMPILER "emcc")
|
||||||
|
SET(CMAKE_CXX_COMPILER "em++")
|
||||||
|
endif()
|
||||||
|
|
||||||
SET(CMAKE_C_COMPILER emcc)
|
|
||||||
SET(CMAKE_CXX_COMPILER em++)
|
|
||||||
if(NOT DEFINED CMAKE_AR)
|
if(NOT DEFINED CMAKE_AR)
|
||||||
find_program(CMAKE_AR NAMES emar)
|
find_program(CMAKE_AR NAMES emar)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
16
src/core.c
16
src/core.c
|
|
@ -1133,15 +1133,19 @@ void SetWindowState(unsigned int flags)
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_RESIZABLE;
|
CORE.Window.flags |= FLAG_WINDOW_RESIZABLE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) != (flags & FLAG_WINDOW_UNDECORATED)) && (flags & FLAG_WINDOW_UNDECORATED))
|
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) != (flags & FLAG_WINDOW_UNDECORATED)) && (flags & FLAG_WINDOW_UNDECORATED))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_FALSE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_FALSE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
|
|
@ -1168,15 +1172,19 @@ void SetWindowState(unsigned int flags)
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) != (flags & FLAG_WINDOW_UNFOCUSED)) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) != (flags & FLAG_WINDOW_UNFOCUSED)) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) != (flags & FLAG_WINDOW_TOPMOST)) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) != (flags & FLAG_WINDOW_TOPMOST)) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FLOATING, GLFW_TRUE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FLOATING, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
|
|
@ -1234,15 +1242,19 @@ void ClearWindowState(unsigned int flags)
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE;
|
CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) && ((flags & FLAG_WINDOW_UNDECORATED) > 0))
|
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) && ((flags & FLAG_WINDOW_UNDECORATED) > 0))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_TRUE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_TRUE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
|
|
@ -1267,15 +1279,19 @@ void ClearWindowState(unsigned int flags)
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FOCUS_ON_SHOW, GLFW_TRUE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FOCUS_ON_SHOW, GLFW_TRUE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FLOATING, GLFW_FALSE);
|
glfwSetWindowAttrib(CORE.Window.handle, GLFW_FLOATING, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user