Skip to content

Commit

Permalink
Enable C++17 by default when building against Qt 6 (#1825)
Browse files Browse the repository at this point in the history
* Enable C++17 by default when building against Qt 6

* Streamline compiler options

* Get rid of LTO in MSVC release builds
  • Loading branch information
J5lx authored Apr 24, 2024
1 parent 6acff71 commit b09d081
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ jobs:
run: mkdir build; ${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
-o build PREFIX=/usr CONFIG-=debug_and_release CONFIG+=release CONFIG+=GIT
CONFIG+=PENCIL2D_${{github.ref == 'refs/heads/release' && 'RELEASE' || 'NIGHTLY'}}
${{matrix.qt == 6 && 'CONFIG+=c++17 QMAKE_CXX_FLAGS+=-std=c++17' || ''}}

- name: Build Pencil2D
working-directory: build
Expand Down
34 changes: 10 additions & 24 deletions util/common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,25 @@ PENCIL2D_RELEASE {
DEFINES += PENCIL2D_RELEASE_BUILD
}

CONFIG += c++11

win32-g++ {
QMAKE_CXXFLAGS += -std=c++11
CONFIG += strict_c strict_c++
greaterThan(QT_MAJOR_VERSION, 5) {
CONFIG += c++17
} else {
CONFIG += c++11
}

win32-msvc* {
QMAKE_CXXFLAGS += /MP /utf-8
CONFIG(release,debug|release) {
QMAKE_CXXFLAGS += /Gy /GL
CONFIG += ltcg
CONFIG += force_debug_info
}
}
# utf8_source is only for Qt 5, it is the default since Qt 6
CONFIG += msvc_mp utf8_source

win32-msvc*:CONFIG(release,debug|release): CONFIG += force_debug_info
win32:!WIN_LEGACY: DEFINES += _WIN32_WINNT=0x0601
WIN_LEGACY {
QMAKE_CXXFLAGS -= /utf-8
QMAKE_LFLAGS += /SUBSYSTEM:CONSOLE,5.01
QMAKE_CXX += /D_USING_V110_SDK71_
DEFINES += _WIN32_WINNT=0x0501
}
win32:!WIN_LEGACY: DEFINES += _WIN32_WINNT=0x0601

macx {
QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++
LIBS += -lobjc -framework Carbon -framework AppKit
}

unix:!macx {
QMAKE_CXXFLAGS += -std=c++11
QMAKE_LINK = $$QMAKE_CXX
QMAKE_LINK_SHLIB = $$QMAKE_CXX
}
macx: LIBS += -lobjc -framework Carbon -framework AppKit

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
Expand Down

0 comments on commit b09d081

Please sign in to comment.