mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-07 11:58:13 +00:00
cmake: Fix PLATFORM_WEB build
Did this ever work? Surely, doesn't look like it...
This commit is contained in:
15
cmake/emscripten.cmake
Normal file
15
cmake/emscripten.cmake
Normal file
@@ -0,0 +1,15 @@
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
SET(CMAKE_C_COMPILER emcc)
|
||||
SET(CMAKE_CXX_COMPILER em++)
|
||||
if(NOT DEFINED CMAKE_AR)
|
||||
find_program(CMAKE_AR NAMES emar)
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_RANLIB)
|
||||
find_program(CMAKE_RANLIB NAMES emranlib)
|
||||
endif()
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
@@ -5,7 +5,11 @@ add_definitions("-DRAYLIB_CMAKE=1")
|
||||
|
||||
# Linking for OS X -framework options
|
||||
# Will do nothing on other OSes
|
||||
if(APPLE)
|
||||
if(${PLATFORM} MATCHES "Android")
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
||||
elseif(${PLATFORM} MATCHES "Web")
|
||||
elseif(APPLE)
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
@@ -16,9 +20,6 @@ if(APPLE)
|
||||
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
||||
elseif(WIN32)
|
||||
# no pkg-config --static on Windows yet...
|
||||
elseif(${PLATFORM} MATCHES "Android")
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
||||
else()
|
||||
find_library(pthread NAMES pthread)
|
||||
find_package(OpenGL QUIET)
|
||||
@@ -87,6 +88,9 @@ function(link_libraries_to_executable executable)
|
||||
# Link raylib
|
||||
if (TARGET raylib_shared)
|
||||
target_link_libraries(${executable} raylib_shared)
|
||||
elseif(${PLATFORM} MATCHES "Web")
|
||||
target_link_libraries(${executable} ${__PKG_CONFIG_LIBS_PRIVATE})
|
||||
target_link_libraries(${executable} raylib)
|
||||
else()
|
||||
target_link_libraries(${executable} raylib ${__PKG_CONFIG_LIBS_PRIVATE})
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user