cmake: Fix PLATFORM_WEB build

Did this ever work? Surely, doesn't look like it...
This commit is contained in:
Ahmad Fatoum 2018-04-12 19:31:53 +02:00
parent cea78e4fc1
commit e025e62445
9 changed files with 150 additions and 121 deletions

View file

@ -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()