diff --git a/.gitmodules b/.gitmodules index 037914b8e31c8c9c7a6d84d74657b54524ff3513..e72cd9aa8c0ca3eb10eecfdfc32b083664677211 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "3rdparty/qrencode-win32"] path = 3rdparty/qrencode-win32 - url = https://github.com/BlueDragon747/qrencode-win32.git + url = https://github.com/blizzard4591/qrencode-win32.git ignore = dirty [submodule "3rdparty/libqrencode"] url = https://github.com/fukuchi/libqrencode.git diff --git a/3rdparty/qrencode-win32 b/3rdparty/qrencode-win32 index d6495a2aa74d058d54ae0f1b9e9e545698de66ce..5ccf9bd4455dfd55a41acfdf0bdbeb85605e10b6 160000 --- a/3rdparty/qrencode-win32 +++ b/3rdparty/qrencode-win32 @@ -1 +1 @@ -Subproject commit d6495a2aa74d058d54ae0f1b9e9e545698de66ce +Subproject commit 5ccf9bd4455dfd55a41acfdf0bdbeb85605e10b6 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e3bdbbc07a7d00d7e1631dd468fe63a4db4a0c0..22c7d17b08b72856cad57929e6b60e4fec74d2c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -363,10 +363,6 @@ if(MSVC) # preprocessor defines add_definitions(-DUNICODE -DQT_NO_DEBUG -DNDEBUG) - # dependencies - set(QRENCODE_DIR - ${PROJECT_SOURCE_DIR}/3rdparty/qrencode-win32/qrencode-win32) - # compiler options add_compile_options( /wd4068 /wd4099 /wd4189 /wd4267 /wd4577 /wd4467 /wd4715 /wd4828) @@ -384,8 +380,10 @@ if(MSVC) "/NODEFAULTLIB:LIBCMT") # client deps - set(QRENCODE_LIB - ${QRENCODE_DIR}/vc8/qrcodelib/x64/Release-Lib/qrcodelib.lib) + set(QRENCODE_DIR ${PROJECT_SOURCE_DIR}/3rdparty/qrencode-win32/qrencode-win32) + file(GLOB_RECURSE QRENCODE_LIB ${QRENCODE_DIR}/qrcodelib.lib) + file(GLOB_RECURSE QRENCODE_INCLUDE ${QRENCODE_DIR}/qrencode.h) + get_filename_component(QRENCODE_INCLUDE_DIR ${QRENCODE_INCLUDE} DIRECTORY) # daemon set(JAMID_SRC_PATH ${DAEMON_DIR}/contrib/msvc/include) @@ -404,7 +402,7 @@ if(MSVC) include_directories( ${JAMID_SRC_PATH} ${LIBCLIENT_SRC_DIR} - ${QRENCODE_DIR}) + ${QRENCODE_INCLUDE_DIR}) elseif (NOT APPLE) list(APPEND COMMON_SOURCES ${APP_SRC_DIR}/xrectsel.c diff --git a/extras/scripts/build-windows.py b/extras/scripts/build-windows.py index a76f20de1c5d661b09d11630c28fee9999f0a39c..368b75a5e37c7d86c30c087ad2bc8b7b6e942736 100644 --- a/extras/scripts/build-windows.py +++ b/extras/scripts/build-windows.py @@ -65,6 +65,15 @@ this_dir = os.path.dirname(os.path.realpath(__file__)) repo_root_dir = os.path.abspath(os.path.join(this_dir, os.pardir, os.pardir)) build_dir = os.path.join(repo_root_dir, "build") +def get_latest_toolset_version(): + """Get the latest toolset version.""" + # Get the visual studio version. Use only the major version number. + # Then: toolset = 2022 ? "v143" : 2019 ? "v142" : 2017 ? "v141" : "v140" + vs_ver = get_vs_prop("installationVersion") + if vs_ver is None: + return None + vs_ver = int(vs_ver.split(".")[0]) + return "v143" if vs_ver >= 16 else "v142" if vs_ver >= 15 else "v141" def find_latest_qt_path(): """Find the latest Qt installation path.""" @@ -205,29 +214,16 @@ def init_submodules(): def build_deps(): """Build the dependencies for the project.""" - print('Patching and building qrencode') - apply_cmd = [ - 'git', - 'apply', - '--reject', - '--ignore-whitespace', - '--whitespace=fix' - ] + print('Building qrencode') qrencode_dir = os.path.join(repo_root_dir, '3rdparty', 'qrencode-win32') - patch_file = os.path.join(repo_root_dir, 'qrencode-win32.patch') - apply_cmd.append(patch_file) - if execute_cmd(apply_cmd, False, None, qrencode_dir): - print("Couldn't patch qrencode-win32.") - vs_env_vars = {} vs_env_vars.update(get_vs_env()) - - msbuild_args = get_ms_build_args("x64", "Release-Lib") - + toolset = get_latest_toolset_version() + print(f'Using toolset {toolset}') + msbuild_args = get_ms_build_args("x64", "Release-Lib", toolset) proj_path = os.path.join( - qrencode_dir, "qrencode-win32", "vc8", "qrcodelib", "qrcodelib.vcxproj" + qrencode_dir, "qrencode-win32", "vc15", "qrcodelib", "qrcodelib.vcxproj" ) - build_project(msbuild_args, proj_path, vs_env_vars) diff --git a/qrencode-win32.patch b/qrencode-win32.patch deleted file mode 100644 index 6cfd8fb31e18b231a0f443a11d2d7bcb3e7846b8..0000000000000000000000000000000000000000 --- a/qrencode-win32.patch +++ /dev/null @@ -1,243 +0,0 @@ -From 261d830b9b4126d76519db0e6b6b51b5a730eb40 Mon Sep 17 00:00:00 2001 -From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> -Date: Tue, 4 Dec 2018 17:42:43 -0500 -Subject: [PATCH] b - ---- - .../vc8/qrcodelib/qrcodelib.vcxproj | 129 +++++++++++++++++- - 1 file changed, 125 insertions(+), 4 deletions(-) - -diff --git a/qrencode-win32/vc8/qrcodelib/qrcodelib.vcxproj b/qrencode-win32/vc8/qrcodelib/qrcodelib.vcxproj -index aabc6b6..8d8293b 100644 ---- a/qrencode-win32/vc8/qrcodelib/qrcodelib.vcxproj -+++ b/qrencode-win32/vc8/qrcodelib/qrcodelib.vcxproj -@@ -5,45 +5,84 @@ - <Configuration>Debug-Dll</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> -+ <ProjectConfiguration Include="Debug-Dll|x64"> -+ <Configuration>Debug-Dll</Configuration> -+ <Platform>x64</Platform> -+ </ProjectConfiguration> - <ProjectConfiguration Include="Debug-Lib|Win32"> - <Configuration>Debug-Lib</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> -+ <ProjectConfiguration Include="Debug-Lib|x64"> -+ <Configuration>Debug-Lib</Configuration> -+ <Platform>x64</Platform> -+ </ProjectConfiguration> - <ProjectConfiguration Include="Release-Dll|Win32"> - <Configuration>Release-Dll</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> -+ <ProjectConfiguration Include="Release-Dll|x64"> -+ <Configuration>Release-Dll</Configuration> -+ <Platform>x64</Platform> -+ </ProjectConfiguration> - <ProjectConfiguration Include="Release-Lib|Win32"> - <Configuration>Release-Lib</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> -+ <ProjectConfiguration Include="Release-Lib|x64"> -+ <Configuration>Release-Lib</Configuration> -+ <Platform>x64</Platform> -+ </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{9A90BF5C-84B0-41F6-B83C-C20EADC1F46C}</ProjectGuid> - <RootNamespace>qrcodelib</RootNamespace> - <Keyword>Win32Proj</Keyword> -+ <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> -- <PlatformToolset>v110_xp</PlatformToolset> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> -+ <CharacterSet>MultiByte</CharacterSet> -+ <WholeProgramOptimization>true</WholeProgramOptimization> -+ </PropertyGroup> -+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="Configuration"> -+ <ConfigurationType>StaticLibrary</ConfigurationType> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> -- <PlatformToolset>v110_xp</PlatformToolset> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> -+ <CharacterSet>MultiByte</CharacterSet> -+ </PropertyGroup> -+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration"> -+ <ConfigurationType>StaticLibrary</ConfigurationType> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> -- <PlatformToolset>v110_xp</PlatformToolset> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> -+ <CharacterSet>MultiByte</CharacterSet> -+ <WholeProgramOptimization>true</WholeProgramOptimization> -+ </PropertyGroup> -+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="Configuration"> -+ <ConfigurationType>DynamicLibrary</ConfigurationType> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> -- <PlatformToolset>v110_xp</PlatformToolset> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> -+ <CharacterSet>MultiByte</CharacterSet> -+ </PropertyGroup> -+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="Configuration"> -+ <ConfigurationType>DynamicLibrary</ConfigurationType> -+ <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> -@@ -52,15 +91,27 @@ - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> -+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="PropertySheets"> -+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> -+ </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> -+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="PropertySheets"> -+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> -+ </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> -+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="PropertySheets"> -+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> -+ </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> -+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="PropertySheets"> -+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> -+ </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> -@@ -70,11 +121,17 @@ - <IntDir>../.build/$(ProjectName)/$(Configuration)\</IntDir> - <LinkIncremental>true</LinkIncremental> - </PropertyGroup> -+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'"> -+ <LinkIncremental>true</LinkIncremental> -+ </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'"> - <OutDir>../.build/$(Configuration)\</OutDir> - <IntDir>../.build/$(ProjectName)/$(Configuration)\</IntDir> - <LinkIncremental>false</LinkIncremental> - </PropertyGroup> -+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'"> -+ <LinkIncremental>false</LinkIncremental> -+ </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'"> - <OutDir>../.build/$(Configuration)\</OutDir> - <IntDir>../.build/$(ProjectName)/$(Configuration)\</IntDir> -@@ -104,6 +161,26 @@ - <TargetMachine>MachineX86</TargetMachine> - </Link> - </ItemDefinitionGroup> -+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'"> -+ <ClCompile> -+ <Optimization>Disabled</Optimization> -+ <AdditionalIncludeDirectories>.\;..\qrcode;..\qrcode\png;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;QRCODELIB_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> -+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> -+ <PrecompiledHeader> -+ </PrecompiledHeader> -+ <WarningLevel>Level3</WarningLevel> -+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> -+ </ClCompile> -+ <Link> -+ <AdditionalDependencies>libpng15d.lib;%(AdditionalDependencies)</AdditionalDependencies> -+ <AdditionalLibraryDirectories>..\qrcode\png;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> -+ <ModuleDefinitionFile>qrcodelib.def</ModuleDefinitionFile> -+ <GenerateDebugInformation>true</GenerateDebugInformation> -+ <SubSystem>Windows</SubSystem> -+ </Link> -+ </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>.\;..\qrcode;..\qrcode\png;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -@@ -124,6 +201,26 @@ - <TargetMachine>MachineX86</TargetMachine> - </Link> - </ItemDefinitionGroup> -+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'"> -+ <ClCompile> -+ <AdditionalIncludeDirectories>.\;..\qrcode;..\qrcode\png;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;QRCODELIB_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> -+ <PrecompiledHeader> -+ </PrecompiledHeader> -+ <WarningLevel>Level3</WarningLevel> -+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> -+ </ClCompile> -+ <Link> -+ <AdditionalDependencies>libpng15.lib;%(AdditionalDependencies)</AdditionalDependencies> -+ <AdditionalLibraryDirectories>..\qrcode\png;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> -+ <ModuleDefinitionFile>qrcodelib.def</ModuleDefinitionFile> -+ <GenerateDebugInformation>true</GenerateDebugInformation> -+ <SubSystem>Windows</SubSystem> -+ <OptimizeReferences>true</OptimizeReferences> -+ <EnableCOMDATFolding>true</EnableCOMDATFolding> -+ </Link> -+ </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> -@@ -137,6 +234,19 @@ - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> -+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'"> -+ <ClCompile> -+ <Optimization>Disabled</Optimization> -+ <AdditionalIncludeDirectories>.\;..\qrcode;..\qrcode\png;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;QRCODELIB_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> -+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> -+ <PrecompiledHeader> -+ </PrecompiledHeader> -+ <WarningLevel>Level3</WarningLevel> -+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> -+ </ClCompile> -+ </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>.\;..\qrcode;..\qrcode\png;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -@@ -147,6 +257,17 @@ - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> -+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'"> -+ <ClCompile> -+ <AdditionalIncludeDirectories>.\;..\qrcode;..\qrcode\png;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;QRCODELIB_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary> -+ <PrecompiledHeader> -+ </PrecompiledHeader> -+ <WarningLevel>Level3</WarningLevel> -+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> -+ </ClCompile> -+ </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="qrcodelib.cpp" /> - <ClCompile Include="..\..\bitstream.c" /> --- -2.19.0.windows.1 -