handle custom platform
This commit is contained in:
parent
0748dc2d1e
commit
30ccc969de
8 changed files with 3514 additions and 10 deletions
5
external/custom_platforms/custom_platform_1/cmake/raylibPlatformCustomLibraryConfig.cmake
vendored
Normal file
5
external/custom_platforms/custom_platform_1/cmake/raylibPlatformCustomLibraryConfig.cmake
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
message(STATUS "From raylibPlatformCustomLibraryConfig (Custom platform 1 (Web)")
|
||||
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
3
external/custom_platforms/custom_platform_1/cmake/raylibPlatformCustomTargetConfig.cmake
vendored
Normal file
3
external/custom_platforms/custom_platform_1/cmake/raylibPlatformCustomTargetConfig.cmake
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
message(STATUS "From raylibPlatformCustomTargetConfig (Custom platform 1 (Web)")
|
||||
|
||||
target_link_options(raylib PRIVATE "-sUSE_GLFW=3")
|
||||
1319
external/custom_platforms/custom_platform_1/src/raylib_platform_custom.c
vendored
Normal file
1319
external/custom_platforms/custom_platform_1/src/raylib_platform_custom.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
36
external/custom_platforms/custom_platform_1/src/raylib_platform_custom.h
vendored
Normal file
36
external/custom_platforms/custom_platform_1/src/raylib_platform_custom.h
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************************
|
||||
* raylib_platform_custom.h
|
||||
*
|
||||
* Custom Platform definition file
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2023 Yan Pujante
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#ifndef RAYLIB_PLATFORM_CUSTOM_H
|
||||
#define RAYLIB_PLATFORM_CUSTOM_H
|
||||
|
||||
#define PLATFORM_CUSTOM_ID "platform_custom_1"
|
||||
#define PLATFORM_CUSTOM_BACKEND "Platform backend: Custom Platform 1 (Web clone)"
|
||||
#define PLATFORM_CUSTOM_CLOCK_MONOTONIC
|
||||
// #define PLATFORM_CUSTOM_DISABLE_HI_RES_TIMER
|
||||
// #define PLATFORM_CUSTOM_ENABLE_OPENGL_ES2
|
||||
|
||||
#endif //RAYLIB_PLATFORM_CUSTOM_H
|
||||
70
external/custom_platforms/custom_platform_2/cmake/raylibPlatformCustomLibraryConfig.cmake
vendored
Normal file
70
external/custom_platforms/custom_platform_2/cmake/raylibPlatformCustomLibraryConfig.cmake
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
message(STATUS "From aylibPlatformCustomLibraryConfig (Custom platform 2 (Desktop)")
|
||||
|
||||
if (APPLE)
|
||||
# Need to force OpenGL 3.3 on OS X
|
||||
# See: https://github.com/raysan5/raylib/issues/341
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
||||
link_libraries("${LIBS_PRIVATE}")
|
||||
if (NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
||||
endif ()
|
||||
elseif (WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
find_package(OpenGL QUIET)
|
||||
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
|
||||
elseif (UNIX)
|
||||
find_library(pthread NAMES pthread)
|
||||
find_package(OpenGL QUIET)
|
||||
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||
set(OPENGL_LIBRARIES "GL")
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
|
||||
find_library(OSS_LIBRARY ossaudio)
|
||||
endif ()
|
||||
|
||||
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||
else ()
|
||||
find_library(pthread NAMES pthread)
|
||||
find_package(OpenGL QUIET)
|
||||
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||
set(OPENGL_LIBRARIES "GL")
|
||||
endif ()
|
||||
|
||||
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
|
||||
find_library(OSS_LIBRARY ossaudio)
|
||||
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||
endif ()
|
||||
|
||||
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD" AND USE_AUDIO)
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} dl)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if("${GLFW_ROOT_DIR}" STREQUAL "")
|
||||
message(FATAL_ERROR "This platform requires glfw. Provide its location via GLFW_ROOT_DIR")
|
||||
endif()
|
||||
|
||||
message(STATUS "Using glfw from ${GLFW_ROOT_DIR}")
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
|
||||
set(GLFW_LIBRARY_TYPE "STATIC" CACHE STRING "" FORCE)
|
||||
|
||||
add_subdirectory("${GLFW_ROOT_DIR}")
|
||||
|
||||
# Hide glfw's symbols when building a shared lib
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set_property(TARGET glfw PROPERTY C_VISIBILITY_PRESET hidden)
|
||||
endif()
|
||||
|
||||
include_directories(BEFORE SYSTEM "${GLFW_ROOT_DIR}/include")
|
||||
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||
12
external/custom_platforms/custom_platform_2/cmake/raylibPlatformCustomProjectConfig.cmake
vendored
Normal file
12
external/custom_platforms/custom_platform_2/cmake/raylibPlatformCustomProjectConfig.cmake
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
message(STATUS "From raylibPlatformCustomProjectConfig (Custom platform 2 (Desktop)")
|
||||
|
||||
# Note that changing CMAKE_OSX_ARCHITECTURES should be done BEFORE project()
|
||||
if(APPLE)
|
||||
if(MACOS_FATLIB)
|
||||
if (CMAKE_OSX_ARCHITECTURES)
|
||||
message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON")
|
||||
else()
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
1830
external/custom_platforms/custom_platform_2/src/raylib_platform_custom.c
vendored
Normal file
1830
external/custom_platforms/custom_platform_2/src/raylib_platform_custom.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
36
external/custom_platforms/custom_platform_2/src/raylib_platform_custom.h
vendored
Normal file
36
external/custom_platforms/custom_platform_2/src/raylib_platform_custom.h
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************************
|
||||
* raylib_platform_custom.h
|
||||
*
|
||||
* Custom Platform definition file
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2023 Yan Pujante
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#ifndef RAYLIB_PLATFORM_CUSTOM_H
|
||||
#define RAYLIB_PLATFORM_CUSTOM_H
|
||||
|
||||
#define PLATFORM_CUSTOM_ID "platform_custom_2"
|
||||
#define PLATFORM_CUSTOM_BACKEND "Platform backend: Custom Platform 2 (Desktop clone)"
|
||||
// #define PLATFORM_CUSTOM_CLOCK_MONOTONIC
|
||||
// #define PLATFORM_CUSTOM_DISABLE_HI_RES_TIMER
|
||||
#define PLATFORM_CUSTOM_ENABLE_OPENGL_ES2
|
||||
|
||||
#endif //RAYLIB_PLATFORM_CUSTOM_H
|
||||
Loading…
Reference in a new issue