From 9deaa06a737541c3b8c75cef9b3b446b679a33e9 Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Mon, 17 Oct 2022 00:28:07 +0800 Subject: [PATCH] Windows: Slight changes to ARM64 support. * Disable NSIS installer if we're compiling for Windows ARM64. * Allow arbitrary files to be added as LOVE_EXTRA_DLLS --- CMakeLists.txt | 30 ++++++++++++++++++++++-------- src/modules/window/sdl/Window.cpp | 6 ++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b94011ba..e86bd9586 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,12 +53,15 @@ else() set(LOVE_TARGET_PLATFORM x86) endif() -if(APPLE) - option(LOVE_JIT "Use LuaJIT" FALSE) + +if(APPLE OR MEGA_ARM64) + set(LOVE_DEFAULT_JIT FALSE) else() - option(LOVE_JIT "Use LuaJIT" TRUE) + set(LOVE_DEFAULT_JIT TRUE) endif() +option(LOVE_JIT "Use LuaJIT" ${LOVE_DEFAULT_JIT}) + if(LOVE_JIT) if(APPLE) message(WARNING "JIT not supported yet on Mac.") @@ -119,12 +122,16 @@ if(MEGA) ${MEGA_OPENAL} ) + # LOVE_EXTRA_DLLS are non-runtime DLLs which should be bundled with the + # love binary in installers, etc. It's only needed for external + # (non-CMake) targets, i.e. LuaJIT. + if(NOT DEFINED LOVE_EXTRA_DLLS) + set(LOVE_EXTRA_DLLS) + endif() + if(LOVE_JIT) set(LOVE_LUA_LIBRARY ${MEGA_LUAJIT_LIB}) - # LOVE_EXTRA_DLLS are non-runtime DLLs which should be bundled with the - # love binary in installers, etc. It's only needed for external - # (non-CMake) targets, i.e. LuaJIT. - set(LOVE_EXTRA_DLLS ${MEGA_LUAJIT_DLL}) + set(LOVE_EXTRA_DLLS ${LOVE_EXTRA_DLLS} ${MEGA_LUAJIT_DLL}) set(LOVE_EXTRA_DEPENDECIES luajit) set(LOVE_INCLUDE_DIRS @@ -1998,6 +2005,14 @@ message(STATUS "Version: ${LOVE_VERSION_STR}") ################################### install(TARGETS ${LOVE_EXE_NAME} ${LOVE_CONSOLE_EXE_NAME} ${LOVE_LIB_NAME} RUNTIME DESTINATION .) +# Our install script (and NSIS) doesn't fully support Windows ARM64 yet. +if(MEGA_ARM64) + set(CPACK_GENERATOR ZIP) + set(CPACK_SYSTEM_NAME woa64) +else() + set(CPACK_GENERATOR ZIP NSIS) +endif() + # Extra DLLs. if(LOVE_EXTRA_DLLS) foreach(DLL ${LOVE_EXTRA_DLLS}) @@ -2040,7 +2055,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis/game.ico DESTINATION .) -set(CPACK_GENERATOR ZIP NSIS) set(CPACK_PACKAGE_NAME "love") set(CPACK_PACKAGE_VENDOR "love2d.org") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LOVE -- It's awesome") diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 72dfacf72..41f10ab3e 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -262,11 +262,9 @@ std::vector Window::getContextAttribsList() const } } - if (!preferGLES) - { - const char *gleshint = SDL_GetHint("LOVE_GRAPHICS_USE_OPENGLES"); + const char *gleshint = SDL_GetHint("LOVE_GRAPHICS_USE_OPENGLES"); + if (gleshint != nullptr) preferGLES = (gleshint != nullptr && gleshint[0] != '0'); - } // Do we want a debug context? bool debug = love::graphics::isDebugEnabled();