parent
e8adcabd94
commit
bc3421fa1d
|
|
@ -17,7 +17,6 @@ if(${PLATFORM} MATCHES "Desktop")
|
||||||
find_library(OPENGL_LIBRARY OpenGL)
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
||||||
link_libraries("${LIBS_PRIVATE}")
|
link_libraries("${LIBS_PRIVATE}")
|
||||||
|
|
||||||
if (NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
if (NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
||||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||||
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
||||||
|
|
@ -29,7 +28,6 @@ if(${PLATFORM} MATCHES "Desktop")
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
|
|
||||||
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||||
set(OPENGL_LIBRARIES "GL")
|
set(OPENGL_LIBRARIES "GL")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
@ -42,7 +40,6 @@ if(${PLATFORM} MATCHES "Desktop")
|
||||||
else ()
|
else ()
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
|
|
||||||
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||||
set(OPENGL_LIBRARIES "GL")
|
set(OPENGL_LIBRARIES "GL")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
@ -62,8 +59,7 @@ if(${PLATFORM} MATCHES "Desktop")
|
||||||
elseif (${PLATFORM} MATCHES "Web")
|
elseif (${PLATFORM} MATCHES "Web")
|
||||||
set(PLATFORM_CPP "PLATFORM_WEB")
|
set(PLATFORM_CPP "PLATFORM_WEB")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
|
||||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --profiling")
|
|
||||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||||
|
|
||||||
elseif (${PLATFORM} MATCHES "Android")
|
elseif (${PLATFORM} MATCHES "Android")
|
||||||
|
|
@ -93,18 +89,17 @@ elseif("${PLATFORM}" MATCHES "DRM")
|
||||||
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
|
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
|
||||||
include_directories(/usr/include/libdrm)
|
include_directories(/usr/include/libdrm)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
|
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
|
||||||
|
|
||||||
elseif ("${PLATFORM}" MATCHES "SDL")
|
elseif ("${PLATFORM}" MATCHES "SDL")
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
||||||
set(LIBS_PRIVATE SDL2::SDL2)
|
set(LIBS_PRIVATE SDL2::SDL2)
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
|
set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
|
||||||
|
|
||||||
if (${OPENGL_VERSION} MATCHES "4.3")
|
if (${OPENGL_VERSION} MATCHES "4.3")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_43")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_43")
|
||||||
elseif (${OPENGL_VERSION} MATCHES "3.3")
|
elseif (${OPENGL_VERSION} MATCHES "3.3")
|
||||||
|
|
@ -118,7 +113,6 @@ if(NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if ("${SUGGESTED_GRAPHICS}" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
if ("${SUGGESTED_GRAPHICS}" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
||||||
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail")
|
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,11 @@ include(CheckIncludeFile)
|
||||||
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
|
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
if (CMAKE_USE_PTHREADS_INIT AND HAVE_STDATOMIC_H)
|
if (CMAKE_USE_PTHREADS_INIT AND HAVE_STDATOMIC_H)
|
||||||
add_if_flag_compiles("-std=c11" CMAKE_C_FLAGS)
|
add_if_flag_compiles("-std=c11" CMAKE_C_FLAGS)
|
||||||
|
|
||||||
if (THREADS_HAVE_PTHREAD_ARG)
|
if (THREADS_HAVE_PTHREAD_ARG)
|
||||||
add_if_flag_compiles("-pthread" CMAKE_C_FLAGS)
|
add_if_flag_compiles("-pthread" CMAKE_C_FLAGS)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (CMAKE_THREAD_LIBS_INIT)
|
if (CMAKE_THREAD_LIBS_INIT)
|
||||||
link_libraries("${CMAKE_THREAD_LIBS_INIT}")
|
link_libraries("${CMAKE_THREAD_LIBS_INIT}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
@ -51,7 +48,6 @@ endif()
|
||||||
# into a CMake variable
|
# into a CMake variable
|
||||||
set(example_sources)
|
set(example_sources)
|
||||||
set(example_resources)
|
set(example_resources)
|
||||||
|
|
||||||
foreach (example_dir ${example_dirs})
|
foreach (example_dir ${example_dirs})
|
||||||
# Get the .c files
|
# Get the .c files
|
||||||
file(GLOB sources ${example_dir}/*.c)
|
file(GLOB sources ${example_dir}/*.c)
|
||||||
|
|
@ -91,6 +87,7 @@ if(${PLATFORM} MATCHES "Android")
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_magicavoxel_loading.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_magicavoxel_loading.c)
|
||||||
|
|
||||||
|
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
|
||||||
|
|
@ -99,9 +96,10 @@ if(${PLATFORM} MATCHES "Android")
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
|
||||||
|
|
||||||
elseif (${PLATFORM} MATCHES "Web")
|
elseif (${PLATFORM} MATCHES "Web")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY")
|
||||||
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
|
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
|
||||||
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")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 --no-heap-copy")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
|
||||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||||
|
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||||
|
|
@ -121,11 +119,13 @@ elseif(NOT SUPPORT_GESTURES_SYSTEM)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_basic_screen_manager.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_basic_screen_manager.c)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_input_gestures_web.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_input_gestures_web.c)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_input_gestures.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_input_gestures.c)
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# The rlgl_standalone example only targets desktop, without shared libraries.
|
# The rlgl_standalone example only targets desktop, without shared libraries.
|
||||||
if (BUILD_SHARED_LIBS OR NOT ${PLATFORM} MATCHES "Desktop")
|
if (BUILD_SHARED_LIBS OR NOT ${PLATFORM} MATCHES "Desktop")
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(BEFORE SYSTEM others/external/include)
|
include_directories(BEFORE SYSTEM others/external/include)
|
||||||
|
|
@ -144,7 +144,6 @@ foreach(example_source ${example_sources})
|
||||||
add_executable(${example_name} ${example_source})
|
add_executable(${example_name} ${example_source})
|
||||||
|
|
||||||
target_link_libraries(${example_name} raylib)
|
target_link_libraries(${example_name} raylib)
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
target_link_libraries(${example_name} m)
|
target_link_libraries(${example_name} m)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${PLATFORM} MATCHES "Web")
|
if (${PLATFORM} MATCHES "Web")
|
||||||
target_link_options(raylib PUBLIC "-sUSE_GLFW=3")
|
target_link_options(raylib PRIVATE "-sUSE_GLFW=3")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(raylib PROPERTIES
|
set_target_properties(raylib PROPERTIES
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user