aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/FindOpenAL.cmake26
-rw-r--r--cmake/Platform/Emscripten.cmake11
2 files changed, 35 insertions, 2 deletions
diff --git a/cmake/Modules/FindOpenAL.cmake b/cmake/Modules/FindOpenAL.cmake
new file mode 100644
index 00000000..3170966d
--- /dev/null
+++ b/cmake/Modules/FindOpenAL.cmake
@@ -0,0 +1,26 @@
+# Locate OpenAL
+# This module defines
+# OPENAL_LIBRARY
+# OPENAL_FOUND, if false, do not try to link to OpenAL
+# OPENAL_INCLUDE_DIR, where to find the headers
+
+# The implementation is based on the standard FindOpenAL.cmake provided with CMake,
+# but customized for targeting Emscripten only.
+
+if (NOT OPENAL_FOUND)
+ SET(OPENAL_FOUND TRUE)
+
+ # For Emscripten-compiled apps in the test suite (test_alut), this is expected...
+ SET(OPENAL_INCLUDE_DIR "${EMSCRIPTEN_ROOT_PATH}/system/include")
+ # ... but the stock FindOpenAL.cmake would have returned this.
+ #SET(OPENAL_INCLUDE_DIR "${EMSCRIPTEN_ROOT_PATH}/system/include/AL")
+
+ # No library to link against for OpenAL, this is picked up automatically by library_openal.js,
+ # but need to report something, or CMake thinks we failed in the search.
+ SET(OPENAL_LIBRARY "nul")
+ SET(OPENAL_LIB "")
+
+ set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${EMSCRIPTEN_ROOT_PATH}/system/include" "${EMSCRIPTEN_ROOT_PATH}/system/include/AL")
+
+ MARK_AS_ADVANCED(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
+endif()
diff --git a/cmake/Platform/Emscripten.cmake b/cmake/Platform/Emscripten.cmake
index 7c8e83fa..c30632ca 100644
--- a/cmake/Platform/Emscripten.cmake
+++ b/cmake/Platform/Emscripten.cmake
@@ -44,9 +44,10 @@ endif()
# Normalize, convert Windows backslashes to forward slashes or CMake will crash.
get_filename_component(EMSCRIPTEN_ROOT_PATH "${EMSCRIPTEN_ROOT_PATH}" ABSOLUTE)
-if ("${CMAKE_MODULE_PATH}" STREQUAL "")
- set(CMAKE_MODULE_PATH "${EMSCRIPTEN_ROOT_PATH}/cmake")
+if (NOT CMAKE_MODULE_PATH)
+ set(CMAKE_MODULE_PATH "")
endif()
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EMSCRIPTEN_ROOT_PATH}/cmake/Modules")
set(CMAKE_FIND_ROOT_PATH "${EMSCRIPTEN_ROOT_PATH}/cmake")
@@ -82,6 +83,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+set(CMAKE_SYSTEM_INCLUDE_PATH "${EMSCRIPTEN_ROOT_PATH}/system/include")
+
# We would prefer to specify a standard set of Clang+Emscripten-friendly common convention for suffix files, especially for CMake executable files,
# but if these are adjusted, ${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake will fail, since it depends on being able to compile output files with predefined names.
#SET(CMAKE_LINK_LIBRARY_SUFFIX "")
@@ -146,6 +149,10 @@ set(link_js_counter 1)
# Internal function: Do not call from user CMakeLists.txt files. Use one of em_link_js_library()/em_link_pre_js()/em_link_post_js() instead.
function(em_add_tracked_link_flag target flagname)
get_target_property(props ${target} LINK_FLAGS)
+ if(NOT props)
+ set(props "")
+ endif()
+
# User can input list of JS files either as a single list, or as variable arguments to this function, so iterate over varargs, and treat each
# item in varargs as a list itself, to support both syntax forms.
foreach(jsFileList ${ARGN})