summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorAhmad Fatoum <[email protected]>2018-04-12 19:31:53 +0200
committerAhmad Fatoum <[email protected]>2018-05-21 12:15:39 +0200
commite025e62445913bf1ec9cf075eaaf1dc7374da83c (patch)
tree76d9cf1898ebbf9e2bc2b08639c0523c9d0b9164 /cmake
parentcea78e4fc16a317ef7ffd7dd537c8b47f77dca57 (diff)
downloadraylib-e025e62445913bf1ec9cf075eaaf1dc7374da83c.tar.gz
raylib-e025e62445913bf1ec9cf075eaaf1dc7374da83c.zip
cmake: Fix PLATFORM_WEB build
Did this ever work? Surely, doesn't look like it...
Diffstat (limited to 'cmake')
-rw-r--r--cmake/emscripten.cmake15
-rwxr-xr-xcmake/utils.cmake12
2 files changed, 23 insertions, 4 deletions
diff --git a/cmake/emscripten.cmake b/cmake/emscripten.cmake
new file mode 100644
index 00000000..621ae787
--- /dev/null
+++ b/cmake/emscripten.cmake
@@ -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)
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index a3e60fb5..fc75ef4f 100755
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -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()