Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/Windows-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
qt_ver: [6.9.1]
qt_ver: [6.9.3]
qt_target: [desktop]
config:
- {
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-DENABLE_OPENSSL=ON `
-DCMAKE_BUILD_TYPE=Release `
-DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }}
-DUSE_PORTABLE_CONFIG=${{ contains(matrix.type, 'portable') }}
- name: Compile
working-directory: build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
os: windows-2022,
cc: "cl", cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
qt_ver: '6.9.1'
qt_ver: '6.9.3'
}

steps:
Expand Down
31 changes: 11 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ endif()


# Configuration options
set(DEFAULT_RUN_IN_PLACE FALSE)
set(DEFAULT_USE_PORTABLE_CONFIG FALSE)
if(WIN32)
set(DEFAULT_RUN_IN_PLACE TRUE)
set(DEFAULT_USE_PORTABLE_CONFIG TRUE)
# For Windows RC file.
add_definitions(-DFLAMESHOT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR})
add_definitions(-DFLAMESHOT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR})
Expand All @@ -65,10 +65,12 @@ if(WIN32)
elseif(APPLE)
set(Qt6_DIR "$(brew --prefix qt6)/lib/cmake/Qt6/" CACHE PATH "directory where Qt6Config.cmake exists.")
endif()
set(RUN_IN_PLACE
${DEFAULT_RUN_IN_PLACE}
CACHE BOOL "Run directly in source directory structure")

set(USE_PORTABLE_CONFIG
${DEFAULT_USE_PORTABLE_CONFIG}
CACHE BOOL "Store config in application folder")
if(USE_PORTABLE_CONFIG)
add_compile_definitions(USE_PORTABLE_CONFIG)
endif()

option(FLAMESHOT_DEBUG_CAPTURE "Enable mode to make debugging easier" OFF)
option(USE_MONOCHROME_ICON "Build using monochrome icon as default" OFF)
Expand Down Expand Up @@ -158,13 +160,8 @@ if(WIN32)
# Include all dynamically linked runtime libraries such as MSVCRxxx.dll
include(InstallRequiredSystemLibraries)

if(RUN_IN_PLACE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-win64")
else()
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-win32")
endif()

if(USE_PORTABLE_CONFIG)
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-win64")
set(CPACK_GENERATOR ZIP)

else()
Expand All @@ -189,13 +186,7 @@ if(WIN32)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/packaging/win-installer/LICENSE/GPL-3.0.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")

# The correct way would be to include both x32 and x64 into one installer and install the appropriate one. CMake
# does not support that, so there are two separate GUID's
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPACK_WIX_UPGRADE_GUID "26D8062A-66D9-48D9-8924-42090FB9B3F9")
else()
set(CPACK_WIX_UPGRADE_GUID "2C53E1B9-51D9-4429-AAE4-B02221959AA5")
endif()
set(CPACK_WIX_UPGRADE_GUID "26D8062A-66D9-48D9-8924-42090FB9B3F9")
endif()
elseif(APPLE)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
Expand Down
37 changes: 12 additions & 25 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,28 @@ image:
clone_folder: c:\projects\source

environment:
Qt6_INSTALL_DIR: 'C:\Qt\6.9\msvc2022_64'
Qt6_INSTALL_DIR: 'C:\Qt\6.9.3\msvc2022_64'
PATH: '%Qt6_INSTALL_DIR%\bin;%PATH%'
matrix:
- PORTABLE_CONFIG: OFF
- PORTABLE_CONFIG: ON

build_script:
- cmd: >-
- cmd: |-
set QTDIR=%Qt6_INSTALL_DIR%
set "VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC"
set "OPENSSL_ROOT_DIR=C:/OpenSSL-v111-Win64"
cmake -S c:\projects\source -B build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE:STRING=Release -DENABLE_OPENSSL=ON -DRUN_IN_PLACE=OFF
cmake --build build --parallel 2 --config "Release"
cd build
cpack -G WIX -B package
mkdir artifact
cp package/*.msi artifact/.
cp src/Release/*.exe artifact/.
7z a -tzip artifact.zip artifact/
cmake -S C:\projects\source -B build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENSSL=ON -DUSE_PORTABLE_CONFIG=%PORTABLE_CONFIG%
cmake --build build --parallel 2 --config Release
- cmd: cd build
- cmd: if "%PORTABLE_CONFIG%"=="OFF" cpack -G WIX -B package
- cmd: if "%PORTABLE_CONFIG%"=="ON" (mkdir portable_exe & copy src\Release\*.exe portable_exe\. & 7z a -tzip portable_exe.zip portable_exe\)

artifacts:
- path: build\package\*.msi
name: installer
- path: build\src\Release\*.exe
name: executable
- path: build\artifact.zip
name: archive
- path: build\portable_exe.zip
name: portable exe

deploy:
- provider: Webhook
Expand Down
5 changes: 5 additions & 0 deletions src/utils/confighandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,15 @@ static QMap<QString, QSharedPointer<KeySequence>> recognizedShortcuts = {
// CLASS CONFIGHANDLER

ConfigHandler::ConfigHandler()
#ifndef USE_PORTABLE_CONFIG
: m_settings(QSettings::IniFormat,
QSettings::UserScope,
qApp->organizationName(),
qApp->applicationName())
#else
: m_settings(qApp->applicationDirPath() + "/flameshot.ini",
QSettings::IniFormat)
#endif
{
static bool firstInitialization = true;
if (firstInitialization) {
Expand Down
Loading