Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows on ARM fixes #427

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ endif()
#1920-1929 = VS 16.0 (v142 toolset) Visual Studio 2019
#1930-1939 = VS 17.0 (v143 toolset) Visual Studio 2022

# detect if the target is for x86
string(TOLOWER "${CMAKE_VS_PLATFORM_NAME}" PLATFORMID)
if(("${PLATFORMID}" STREQUAL "win32") OR
("${PLATFORMID}" STREQUAL "x64" ))
set(NON_X86_PLATFORM "OFF")
else()
set(NON_X86_PLATFORM "ON")
endif()

if(NON_X86_PLATFORM)
message(FATAL_ERROR "MSVC/ClangCL only supported on x86(-64). Use MinGW (llvm-mingw or gcc).")
endif()

IF( MSVC_VERSION VERSION_LESS 1910 )
MESSAGE(FATAL_ERROR "Visual C++ 2017 or newer required.")
ENDIF()
Expand Down
62 changes: 35 additions & 27 deletions avs_core/core/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ typedef const char* (__stdcall *AvisynthPluginInit2Func)(IScriptEnvironment_Avs2
typedef const char* (AVSC_CC *AvisynthCPluginInitFunc)(AVS_ScriptEnvironment* env);

#ifdef AVS_WINDOWS // only Windows has a registry we care about
const char RegAvisynthKey[] = "Software\\Avisynth";
#if defined (__GNUC__)
const char RegPluginDirPlus_GCC[] = "PluginDir+GCC";
#if defined(X86_32)
#define GCC_WIN32
#endif
#else
const char RegPluginDirClassic[] = "PluginDir2_5";
const char RegPluginDirPlus[] = "PluginDir+";
#endif
const char RegAvisynthKey[] = "Software\\Avisynth";
#if defined (AVS_WINDOWS_X86)
#if defined (__GNUC__)
const char RegPluginDirPlus_GCC[] = "PluginDir+GCC";
#if defined(X86_32)
#define GCC_WIN32
#endif // X86_32
#endif // __GNUC__
#endif // AVS_WINDOWS_X86
const char RegPluginDirClassic[] = "PluginDir2_5";
const char RegPluginDirPlus[] = "PluginDir+";
#endif // AVS_WINDOWS

#ifdef AVS_POSIX
Expand Down Expand Up @@ -612,23 +613,30 @@ void PluginManager::AddAutoloadDir(const std::string &dirPath, bool toFront)

std::string plugin_dir;
#ifdef AVS_WINDOWS
#if defined (__GNUC__)
if (GetRegString(HKEY_CURRENT_USER, RegAvisynthKey, RegPluginDirPlus_GCC, &plugin_dir))
replace_beginning(dir, "USER_PLUS_PLUGINS", plugin_dir);
if (GetRegString(HKEY_LOCAL_MACHINE, RegAvisynthKey, RegPluginDirPlus_GCC, &plugin_dir))
replace_beginning(dir, "MACHINE_PLUS_PLUGINS", plugin_dir);
#else
// note: if e.g HKCU/PluginDir+ does not exist, USER_PLUS_PLUGINS as a string remain in search path
if (GetRegString(HKEY_CURRENT_USER, RegAvisynthKey, RegPluginDirPlus, &plugin_dir))
replace_beginning(dir, "USER_PLUS_PLUGINS", plugin_dir);
if (GetRegString(HKEY_LOCAL_MACHINE, RegAvisynthKey, RegPluginDirPlus, &plugin_dir))
replace_beginning(dir, "MACHINE_PLUS_PLUGINS", plugin_dir);
if (GetRegString(HKEY_CURRENT_USER, RegAvisynthKey, RegPluginDirClassic, &plugin_dir))
replace_beginning(dir, "USER_CLASSIC_PLUGINS", plugin_dir);
if (GetRegString(HKEY_LOCAL_MACHINE, RegAvisynthKey, RegPluginDirClassic, &plugin_dir))
replace_beginning(dir, "MACHINE_CLASSIC_PLUGINS", plugin_dir);
#endif
#endif
#if defined (AVS_WINDOWS_X86)
#if defined (__GNUC__)
if (GetRegString(HKEY_CURRENT_USER, RegAvisynthKey, RegPluginDirPlus_GCC, &plugin_dir))
replace_beginning(dir, "USER_PLUS_PLUGINS", plugin_dir);
if (GetRegString(HKEY_LOCAL_MACHINE, RegAvisynthKey, RegPluginDirPlus_GCC, &plugin_dir))
replace_beginning(dir, "MACHINE_PLUS_PLUGINS", plugin_dir);
#else
// note: if e.g HKCU/PluginDir+ does not exist, USER_PLUS_PLUGINS as a string remain in search path
if (GetRegString(HKEY_CURRENT_USER, RegAvisynthKey, RegPluginDirPlus, &plugin_dir))
replace_beginning(dir, "USER_PLUS_PLUGINS", plugin_dir);
if (GetRegString(HKEY_LOCAL_MACHINE, RegAvisynthKey, RegPluginDirPlus, &plugin_dir))
replace_beginning(dir, "MACHINE_PLUS_PLUGINS", plugin_dir);
if (GetRegString(HKEY_CURRENT_USER, RegAvisynthKey, RegPluginDirClassic, &plugin_dir))
replace_beginning(dir, "USER_CLASSIC_PLUGINS", plugin_dir);
if (GetRegString(HKEY_LOCAL_MACHINE, RegAvisynthKey, RegPluginDirClassic, &plugin_dir))
replace_beginning(dir, "MACHINE_CLASSIC_PLUGINS", plugin_dir);
#endif // _GNUC_
#else
if (GetRegString(HKEY_CURRENT_USER, RegAvisynthKey, RegPluginDirPlus, &plugin_dir))
replace_beginning(dir, "USER_PLUS_PLUGINS", plugin_dir);
if (GetRegString(HKEY_LOCAL_MACHINE, RegAvisynthKey, RegPluginDirPlus, &plugin_dir))
replace_beginning(dir, "MACHINE_PLUS_PLUGINS", plugin_dir);
#endif // AVS_WINDOWS_X86
#endif // AVS_WINDOWS

// replace backslashes with forward slashes
replace(dir, '\\', '/');
Expand Down
12 changes: 12 additions & 0 deletions avs_core/include/avs/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@
# error Operating system unsupported.
#endif

#if defined(AVS_WINDOWS)
# if defined(X86_32) || defined(X86_64)
# define AVS_WINDOWS_X86
# elif defined(ARM64) || defined(ARM32)
# define AVS_WINDOWS_ARM
# endif
#endif

#if defined(MSVC) && !defined(AVS_WINDOWS_X86)
# error Unsupported combination of compiler, operating system, and machine architecture.
#endif

// useful warnings disabler macros for supported compilers

#if defined(_MSC_VER)
Expand Down
Loading