diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index 73ca736bba..3d83801c12 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -469,8 +469,8 @@ function project_create(project_name, target_type) cppdialect "C++17" kind(target_type) - filter "action:vs2017" - toolset "v141_xp" + filter "action:vs2022" + toolset "v143" filter {} filter "action:vs*" @@ -1007,7 +1007,7 @@ function setup_all_libs () end -- runtime-library-specific - if _ACTION == "vs2017" then + if _ACTION == "vs2022" then table.insert(source_dirs, "lib/sysdep/rtl/msc"); else table.insert(source_dirs, "lib/sysdep/rtl/gcc"); diff --git a/build/workspaces/update-workspaces.bat b/build/workspaces/update-workspaces.bat index f674bab446..e57758b0a3 100644 --- a/build/workspaces/update-workspaces.bat +++ b/build/workspaces/update-workspaces.bat @@ -3,5 +3,5 @@ rem ** Create Visual Studio Workspaces on Windows ** cd /D "%~dp0" cd ..\bin -if not exist ..\workspaces\vs2017\SKIP_PREMAKE_HERE premake5.exe --file="../premake/premake5.lua" --outpath="../workspaces/vs2017" %* vs2017 || exit /b 1 +if not exist ..\workspaces\vs2022\SKIP_PREMAKE_HERE premake5.exe --file="../premake/premake5.lua" --outpath="../workspaces/vs2022" %* vs2022 || exit /b 1 cd ..\workspaces diff --git a/source/lib/sysdep/os/win/win.h b/source/lib/sysdep/os/win/win.h index ba2f32ee20..7ccc8c7ca0 100644 --- a/source/lib/sysdep/os/win/win.h +++ b/source/lib/sysdep/os/win/win.h @@ -43,14 +43,6 @@ // external libraries from pulling it in (which would cause conflicts). #undef _WINDOWS_ -// set version; needed for EnumDisplayDevices -#ifndef NTDDI_VERSION -# define NTDDI_VERSION NTDDI_LONGHORN -#endif -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x600 -#endif - #define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_ //#define NOVIRTUALKEYCODES // VK_* //#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_* diff --git a/source/lib/sysdep/os/win/wposix/wfilesystem.cpp b/source/lib/sysdep/os/win/wposix/wfilesystem.cpp index 8922faa0c8..c5282ac38b 100644 --- a/source/lib/sysdep/os/win/wposix/wfilesystem.cpp +++ b/source/lib/sysdep/os/win/wposix/wfilesystem.cpp @@ -286,29 +286,6 @@ int wclose(int fd) } -//----------------------------------------------------------------------------- -// unistd.h -//----------------------------------------------------------------------------- - -// we don't want to #define read to _read, since that's a fairly common -// identifier. therefore, translate from MS CRT names via thunk functions. -// efficiency is less important, and the overhead could be optimized away. - -int read(int fd, void* buf, size_t nbytes) -{ - return _read(fd, buf, (int)nbytes); -} - -int write(int fd, void* buf, size_t nbytes) -{ - return _write(fd, buf, (int)nbytes); -} - -off_t lseek(int fd, off_t ofs, int whence) -{ - return _lseeki64(fd, ofs, whence); -} - int wtruncate(const OsPath& pathname, off_t length) { diff --git a/source/lib/sysdep/os/win/wposix/wfilesystem.h b/source/lib/sysdep/os/win/wposix/wfilesystem.h index 102643a391..741800f6f6 100644 --- a/source/lib/sysdep/os/win/wposix/wfilesystem.h +++ b/source/lib/sysdep/os/win/wposix/wfilesystem.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -53,12 +53,6 @@ typedef unsigned int mode_t; // defined by MinGW but not VC #define S_ISREG(m) (m & S_IFREG) -// -// -// - -extern int read (int fd, void* buf, size_t nbytes); // thunk -extern int write(int fd, void* buf, size_t nbytes); // thunk -extern off_t lseek(int fd, off_t ofs, int whence); // thunk +#include // read, write, lseek #endif // #ifndef INCLUDED_WFILESYSTEM diff --git a/source/renderer/backend/vulkan/VMA.h b/source/renderer/backend/vulkan/VMA.h index c615af7bc1..ebb335f28f 100644 --- a/source/renderer/backend/vulkan/VMA.h +++ b/source/renderer/backend/vulkan/VMA.h @@ -40,11 +40,6 @@ #define VMA_STATS_STRING_ENABLED 0 #endif -#if OS_WIN -// MSVC doesn't enable std::shared_mutex for XP toolkit. -#define VMA_USE_STL_SHARED_MUTEX 0 -#endif - #if GCC_VERSION #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat" diff --git a/source/scriptinterface/FunctionWrapper.h b/source/scriptinterface/FunctionWrapper.h index 7fc82ce9ac..1b237c16d0 100644 --- a/source/scriptinterface/FunctionWrapper.h +++ b/source/scriptinterface/FunctionWrapper.h @@ -65,13 +65,12 @@ private: /** * Convenient struct to get info on a [class] [const] function pointer. - * TODO VS19: I ran into a really weird bug with an auto specialisation on this taking function pointers. - * It'd be good to add it back once we upgrade. */ - template struct args_info; + template struct args_info_t; + template using args_info = args_info_t; template - struct args_info + struct args_info_t { static constexpr const size_t nb_args = sizeof...(Types); using return_type = R; @@ -80,9 +79,9 @@ private: }; template - struct args_info : public args_info { using object_type = C; }; + struct args_info_t : public args_info_t { using object_type = C; }; template - struct args_info : public args_info {}; + struct args_info_t : public args_info_t {}; struct IteratorResultError : std::runtime_error { @@ -186,7 +185,7 @@ private: * Wrap std::apply for the case where we have an object method or a regular function. */ template - static typename args_info::return_type call(T* object, tuple& args) + static typename args_info::return_type call(T* object, tuple& args) { if constexpr(std::is_same_v) { @@ -272,10 +271,8 @@ public: template using ObjectGetter = T*(*)(const ScriptRequest&, JS::CallArgs&); - // TODO: the fact that this takes class and not auto is to work around an odd VS17 bug. - // It can be removed with VS19. - template - using GetterFor = ObjectGetter::object_type>; + template + using GetterFor = ObjectGetter::object_type>; /** * The meat of this file. This wraps a C++ function into a JSNative, @@ -290,16 +287,16 @@ public: * * @param thisGetter to get the object, if necessary. */ - template thisGetter = nullptr> + template thisGetter = nullptr> static bool ToJSNative(JSContext* cx, unsigned argc, JS::Value* vp) { - using ObjType = typename args_info::object_type; + using ObjType = typename args_info::object_type; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); ScriptRequest rq(cx); // If the callable is an object method, we must specify how to fetch the object. - static_assert(std::is_same_v::object_type, void> || thisGetter != nullptr, + static_assert(std::is_same_v::object_type, void> || thisGetter != nullptr, "ScriptFunction::Register - No getter specified for object method"); // GCC 7 triggers spurious warnings @@ -319,16 +316,16 @@ public: #endif bool wentOk = true; - typename args_info::arg_types outs = ConvertFromJS(rq, args, wentOk, - static_cast::arg_types*>(nullptr)); + typename args_info::arg_types outs = ConvertFromJS(rq, args, wentOk, + static_cast::arg_types*>(nullptr)); if (!wentOk) return false; try { - if constexpr (std::is_same_v::return_type>) + if constexpr (std::is_same_v::return_type>) call(obj, outs); - else if constexpr (std::is_same_v::return_type>) + else if constexpr (std::is_same_v::return_type>) args.rval().set(call(obj, outs)); else Script::ToJSVal(rq, args.rval(), call(obj, outs)); @@ -430,31 +427,31 @@ public: /** * Return a function spec from a C++ function. */ - template thisGetter = nullptr> + template thisGetter = nullptr> static JSFunctionSpec Wrap(const char* name, const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) { - return JS_FN(name, (&ToJSNative), args_info::nb_args, flags); + return JS_FN(name, (&ToJSNative), args_info::nb_args, flags); } /** * Return a JSFunction from a C++ function. */ - template thisGetter = nullptr> + template thisGetter = nullptr> static JSFunction* Create(const ScriptRequest& rq, const char* name, const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) { - return JS_NewFunction(rq.cx, &ToJSNative, args_info::nb_args, flags, name); + return JS_NewFunction(rq.cx, &ToJSNative, args_info::nb_args, flags, name); } /** * Register a function on the native scope (usually 'Engine'). */ - template thisGetter = nullptr> + template thisGetter = nullptr> static void Register(const ScriptRequest& rq, const char* name, const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) { - JS_DefineFunction(rq.cx, rq.nativeScope, name, &ToJSNative, args_info::nb_args, flags); + JS_DefineFunction(rq.cx, rq.nativeScope, name, &ToJSNative, args_info::nb_args, flags); } /** @@ -462,11 +459,11 @@ public: * Prefer the version taking ScriptRequest unless you have a good reason not to. * @see Register */ - template thisGetter = nullptr> + template thisGetter = nullptr> static void Register(JSContext* cx, JS::HandleObject scope, const char* name, const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) { - JS_DefineFunction(cx, scope, name, &ToJSNative, args_info::nb_args, flags); + JS_DefineFunction(cx, scope, name, &ToJSNative, args_info::nb_args, flags); } template