diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index d7806e0..7d2e725 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -122,6 +122,7 @@ # automatically) # CORRADE_TESTSUITE_XCTEST_RUNNER - Path to XCTestRunner.mm.in file # CORRADE_TESTSUITE_ADB_RUNNER - Path to AdbRunner.sh file +# CORRADE_UTILITY_JS - Path to CorradeUtility.js file # CORRADE_PEDANTIC_COMPILER_OPTIONS - List of pedantic compiler options used # for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` enabled # CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler @@ -473,8 +474,9 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) # Interconnect library if(_component STREQUAL Interconnect) # Disable /OPT:ICF on MSVC, which merges functions with identical - # contents and thus breaks signal comparison - if(CORRADE_TARGET_WINDOWS AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # contents and thus breaks signal comparison. Same case is for + # clang-cl which uses the MSVC linker by default. + if(CORRADE_TARGET_WINDOWS AND (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) if(CMAKE_VERSION VERSION_LESS 3.13) set_property(TARGET Corrade::${_component} PROPERTY INTERFACE_LINK_LIBRARIES "-OPT:NOICF,REF") @@ -559,6 +561,15 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) set_property(TARGET Corrade::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "log") endif() + # Emscripten has various stuff implemented in JS + if(CORRADE_TARGET_EMSCRIPTEN) + find_file(CORRADE_UTILITY_JS CorradeUtility.js + PATH_SUFFIXES lib) + set_property(TARGET Corrade::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once we + # require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${CORRADE_UTILITY_JS}") + endif() endif() # Find library includes diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 9fdbd6e..88959a3 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -135,9 +135,9 @@ # globals unique even across different shared libraries # MAGNUM_TARGET_GL - Defined if compiled with OpenGL interop # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES -# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 -# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0 # MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL +# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 / WebGL +# 1 instead of OpenGL ES 3.0+ / WebGL 2 # MAGNUM_TARGET_EGL - Defined if compiled for EGL instead of a # platform-specific OpenGL support library like CGL, EAGL, GLX or WGL # MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop @@ -152,6 +152,8 @@ # Android, Emscripten or Windows RT. Use MAGNUM_TARGET_EGL instead. # MAGNUM_TARGET_DESKTOP_GLES` - Defined if compiled for OpenGL ES but # GLX / WGL is used instead of EGL. Use MAGNUM_TARGET_EGL instead. +# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0+ / +# WebGL 2. Use an inverse of the MAGNUM_TARGET_GLES2 variable instead. # # Additionally these variables are defined for internal usage: # @@ -162,6 +164,7 @@ # MAGNUM_*_LIBRARY - Component libraries (w/o dependencies) # MAGNUM_*_LIBRARY_DEBUG - Debug version of given library, if found # MAGNUM_*_LIBRARY_RELEASE - Release version of given library, if found +# MAGNUM_PLATFORM_JS - Path to MagnumPlatform.js file # MAGNUM_BINARY_INSTALL_DIR - Binary installation directory # MAGNUM_LIBRARY_INSTALL_DIR - Library installation directory # MAGNUM_DATA_INSTALL_DIR - Data installation directory @@ -226,6 +229,15 @@ # DEALINGS IN THE SOFTWARE. # +# CMake policies used by FindMagnum are popped again at the end. +cmake_policy(PUSH) +# Prefer GLVND when finding OpenGL. If this causes problems (known to fail with +# NVidia drivers in Debian Buster, reported on 2019-04-09), users can override +# this by setting OpenGL_GL_PREFERENCE to LEGACY. +if(POLICY CMP0072) + cmake_policy(SET CMP0072 NEW) +endif() + # Corrade library dependencies set(_MAGNUM_CORRADE_DEPENDENCIES ) foreach(_magnum_component ${Magnum_FIND_COMPONENTS}) @@ -281,7 +293,6 @@ set(_magnumFlags TARGET_GL TARGET_GLES TARGET_GLES2 - TARGET_GLES3 TARGET_WEBGL TARGET_EGL TARGET_VK) @@ -306,14 +317,9 @@ if(MAGNUM_BUILD_DEPRECATED) set(MAGNUM_TARGET_DESKTOP_GLES 1) endif() endif() -endif() - -# OpenGL library preference. Prefer to use GLVND, since that's the better -# approach nowadays, but allow the users to override it from outside in case -# it is broken for some reason (Nvidia drivers in Debian's testing (Buster) -- -# reported on 2019-04-09). -if(NOT CMAKE_VERSION VERSION_LESS 3.10 AND NOT OpenGL_GL_PREFERENCE) - set(OpenGL_GL_PREFERENCE GLVND) + if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2) + set(MAGNUM_TARGET_GLES3 1) + endif() endif() # Base Magnum library @@ -696,7 +702,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES android EGL::EGL) - # EmscriptenApplication has no additional dependencies + # Emscripten application dependencies + elseif(_component STREQUAL EmscriptenApplication) + # Emscripten has various stuff implemented in JS + if(CORRADE_TARGET_EMSCRIPTEN) + find_file(MAGNUM_PLATFORM_JS MagnumPlatform.js + PATH_SUFFIXES lib) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once + # we require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${MAGNUM_PLATFORM_JS}") + endif() # GLFW application dependencies elseif(_component STREQUAL GlfwApplication) @@ -715,7 +731,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) endif() - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX/EGL because libOpenGL doesn't provide it. For EGL we have # our own EGL find module, which makes things simpler. The # upstream FindOpenGL is anything but simple. Also can't use @@ -752,9 +768,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) elseif(CORRADE_TARGET_UNIX) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) + # Emscripten has various stuff implemented in JS + elseif(CORRADE_TARGET_EMSCRIPTEN) + find_file(MAGNUM_PLATFORM_JS MagnumPlatform.js + PATH_SUFFIXES lib) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once + # we require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${MAGNUM_PLATFORM_JS}") endif() - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX/EGL because libOpenGL doesn't provide it. For EGL we have # our own EGL find module, which makes things simpler. The # upstream FindOpenGL is anything but simple. Also can't use @@ -784,12 +808,19 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${X11_LIBRARIES}) - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX because libOpenGL doesn't provide it. Also can't use # OpenGL_OpenGL_FOUND, because that one is set also if GLVND is # *not* found. WTF. Also can't just check for # OPENGL_opengl_LIBRARY because that's set even if # OpenGL_GL_PREFERENCE is explicitly set to LEGACY. + # + # If MAGNUM_TARGET_GLES and MAGNUM_TARGET_EGL is set, these + # applications can be built only if GLVND is available as + # otherwise there would be a conflict between libGL and + # libGLES. Thus, if GLVND is not available, it won't link + # libGLX here, but that shouldn't be a problem since the + # application library won't exist either. find_package(OpenGL) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) set_property(TARGET Magnum::${_component} APPEND PROPERTY @@ -832,7 +863,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # GLX context dependencies if(_component STREQUAL GlxContext) - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX because libOpenGL doesn't provide it. Also can't use # OpenGL_OpenGL_FOUND, because that one is set also if GLVND is # *not* found. If GLVND is not used, link to X11 instead. Also @@ -871,7 +902,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # GL library elseif(_component STREQUAL GL) if(NOT MAGNUM_TARGET_GLES OR (MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL AND NOT CORRADE_TARGET_IOS)) - # If the GLVND library (CMake 3.11+) was found, link to the + # If the GLVND library (CMake 3.10+) was found, link to the # imported target. Otherwise (and also on all systems except # Linux) link to the classic libGL. Can't use # OpenGL_OpenGL_FOUND, because that one is set also if GLVND is @@ -890,7 +921,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) find_package(OpenGLES2 REQUIRED) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGLES2::OpenGLES2) - elseif(MAGNUM_TARGET_GLES3) + else() find_package(OpenGLES3 REQUIRED) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3) @@ -985,7 +1016,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) endforeach() set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Magnum::Magnum) - set(_MAGNUM_${component}_OPTIONAL_DEPENDENCIES_TO_ADD ) + set(_MAGNUM_${_component}_OPTIONAL_DEPENDENCIES_TO_ADD ) foreach(_dependency ${_MAGNUM_${_component}_DEPENDENCIES}) if(NOT _MAGNUM_${_component}_${_dependency}_DEPENDENCY_IS_OPTIONAL) set_property(TARGET Magnum::${_component} APPEND PROPERTY @@ -1047,24 +1078,6 @@ if(CORRADE_TARGET_EMSCRIPTEN) MAGNUM_EMSCRIPTENAPPLICATION_JS MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS MAGNUM_WEBAPPLICATION_CSS) - - # If we are on CMake 3.13 and up, `-s USE_WEBGL2=1` linker option is - # propagated from FindOpenGLES3.cmake already. If not (and the GL library - # is used), we need to modify the global CMAKE_EXE_LINKER_FLAGS. Do it here - # instead of in FindOpenGLES3.cmake so it works also for CMake subprojects - # (in which case find_package(OpenGLES3) is called in (and so - # CMAKE_EXE_LINKER_FLAGS would be modified in) Magnum's root CMakeLists.txt - # and thus can't affect the variable in the outer project). CMake supports - # IN_LIST as an operator since 3.1 (Emscripten needs at least 3.7), but - # it's behind a policy, so enable that one as well. - cmake_policy(SET CMP0057 NEW) - # TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be - # then passed via target_link_libraries() etc. without requiring CMake - # 3.13: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020 - # -- change to that once we drop support for older Emscripten versions - if(CMAKE_VERSION VERSION_LESS 3.13 AND GL IN_LIST Magnum_FIND_COMPONENTS AND NOT MAGNUM_TARGET_GLES2 AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-s USE_WEBGL2=1") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") - endif() endif() # For CMake 3.16+ with REASON_FAILURE_MESSAGE, provide additional potentially @@ -1291,3 +1304,6 @@ if(MAGNUM_PLUGINS_RELEASE_DIR) set(MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/sceneconverters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters) endif() + +# Resets CMake policies set at the top of the file to not affect other code. +cmake_policy(POP) diff --git a/modules/FindMagnumIntegration.cmake b/modules/FindMagnumIntegration.cmake index d2e64de..7a547ce 100644 --- a/modules/FindMagnumIntegration.cmake +++ b/modules/FindMagnumIntegration.cmake @@ -89,8 +89,14 @@ if(_MAGNUMINTEGRATION_OPTIONAL_DEPENDENCIES) find_package(Magnum OPTIONAL_COMPONENTS ${_MAGNUMINTEGRATION_OPTIONAL_DEPENDENCIES}) endif() -# Global integration include dir -find_path(MAGNUMINTEGRATION_INCLUDE_DIR Magnum +# Global include dir that's unique to Magnum Integration. Often it will be +# installed alongside Magnum, which is why the hint, but if not, it shouldn't +# just pick MAGNUM_INCLUDE_DIR because then _MAGNUMINTEGRATION_*_INCLUDE_DIR +# will fail to be found. In case of CMake subprojects the versionIntegration.h +# is generated inside the build dir so this won't find it, instead +# src/CMakeLists.txt forcibly sets MAGNUMINTEGRATION_INCLUDE_DIR as an internal +# cache value to make that work. +find_path(MAGNUMINTEGRATION_INCLUDE_DIR Magnum/versionIntegration.h HINTS ${MAGNUM_INCLUDE_DIR}) mark_as_advanced(MAGNUMINTEGRATION_INCLUDE_DIR) diff --git a/third-party/SDL b/third-party/SDL index 0134672..1fa6142 160000 --- a/third-party/SDL +++ b/third-party/SDL @@ -1 +1 @@ -Subproject commit 01346723455a37c1cd14bba28ebeffe268002bcd +Subproject commit 1fa6142903b88007c7b77d324ee78fad9966871a diff --git a/third-party/curl b/third-party/curl index a4ed3e7..9287563 160000 --- a/third-party/curl +++ b/third-party/curl @@ -1 +1 @@ -Subproject commit a4ed3e766a68ff7517ee9cf3cb71c7255e8ee9b0 +Subproject commit 9287563e86a5b2007fb67f68c075a87a93825861 diff --git a/third-party/efsw b/third-party/efsw index bc85baf..3419347 160000 --- a/third-party/efsw +++ b/third-party/efsw @@ -1 +1 @@ -Subproject commit bc85bafae7d7b641e326ed5d01bfffd5eb0352f5 +Subproject commit 341934765471e4074e90bb5205ff4a65c16499c6 diff --git a/third-party/imgui b/third-party/imgui index 3c435c0..4f9ba19 160000 --- a/third-party/imgui +++ b/third-party/imgui @@ -1 +1 @@ -Subproject commit 3c435c029788cc26c52e835e2feb262a3057addc +Subproject commit 4f9ba19e520bea478f5cb654d37ef45e6404bd52 diff --git a/third-party/libzip b/third-party/libzip index 0b6ebe6..f0eff80 160000 --- a/third-party/libzip +++ b/third-party/libzip @@ -1 +1 @@ -Subproject commit 0b6ebe6fad8adb1ec95bb5529c5af2185d40c2cf +Subproject commit f0eff80889f1b0791e91516d2d84e8d5b84a1e02 diff --git a/third-party/magnum b/third-party/magnum index 7d0a821..8538610 160000 --- a/third-party/magnum +++ b/third-party/magnum @@ -1 +1 @@ -Subproject commit 7d0a8215d38284f7b7ae041cfbb19d410e5988a6 +Subproject commit 8538610fa27e1db37070eaabe34f1e4e41648bab diff --git a/third-party/magnum-integration b/third-party/magnum-integration index f01593f..bf09698 160000 --- a/third-party/magnum-integration +++ b/third-party/magnum-integration @@ -1 +1 @@ -Subproject commit f01593fc94556bff23a848ac71187c56e034b6d9 +Subproject commit bf09698491f2061733dc263f375da1f02f41d8ec