Mon, 06 Dec 2021 00:29:47 +0200
Fix build on Windows
CMakeLists.txt | file | annotate | diff | comparison | revisions | |
commonlib/types.h | file | annotate | diff | comparison | revisions | |
config/configwindow.cpp | file | annotate | diff | comparison | revisions | |
launcher/prompts.cpp | file | annotate | diff | comparison | revisions | |
updaterevision.py | file | annotate | diff | comparison | revisions |
--- a/CMakeLists.txt Sun Nov 28 23:53:23 2021 +0200 +++ b/CMakeLists.txt Mon Dec 06 00:29:47 2021 +0200 @@ -3,7 +3,7 @@ cmake_policy (SET CMP0020 NEW) find_package (Qt5Widgets REQUIRED) find_package (Qt5Core REQUIRED) - +find_package (Python COMPONENTS Interpreter) include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) set (ZCINEMA_LAUNCHER_SOURCES @@ -77,7 +77,7 @@ target_link_libraries (${PROJECT_NAME}-config ${PROJECT_NAME}-common) add_custom_target (make_hginfo - COMMAND python + COMMAND ${Python_EXECUTABLE} "${CMAKE_SOURCE_DIR}/updaterevision.py" "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) @@ -88,8 +88,8 @@ # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword # which clang doesn't seem to like. -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") endif() -install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) \ No newline at end of file +install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
--- a/commonlib/types.h Sun Nov 28 23:53:23 2021 +0200 +++ b/commonlib/types.h Mon Dec 06 00:29:47 2021 +0200 @@ -27,6 +27,11 @@ QString name; QString binaryPath; bool isRelease = false; + ZandronumVersion() {} + ZandronumVersion(const QString& name, const QString& binaryPath, const bool isRelease) : + name{name}, + binaryPath{binaryPath}, + isRelease{isRelease} {} }; inline QDataStream& operator<< (QDataStream& out, const ZandronumVersion& version) @@ -39,4 +44,4 @@ return (in >> version.name >> version.binaryPath >> version.isRelease); } -Q_DECLARE_METATYPE (ZandronumVersion) \ No newline at end of file +Q_DECLARE_METATYPE (ZandronumVersion)
--- a/config/configwindow.cpp Sun Nov 28 23:53:23 2021 +0200 +++ b/config/configwindow.cpp Mon Dec 06 00:29:47 2021 +0200 @@ -202,7 +202,7 @@ ZandronumVersion VersionGuiEntry::toNonGuiVersion() const { - return {m_name, m_pathItem->text(), m_isRelease}; + return ZandronumVersion{m_name, m_pathItem->text(), m_isRelease}; } // @@ -327,4 +327,4 @@ { reject(); } -} \ No newline at end of file +}
--- a/launcher/prompts.cpp Sun Nov 28 23:53:23 2021 +0200 +++ b/launcher/prompts.cpp Mon Dec 06 00:29:47 2021 +0200 @@ -135,4 +135,4 @@ QString FindFilePrompt::path() const { return m_ui->m_path->text(); -} \ No newline at end of file +}
--- a/updaterevision.py Sun Nov 28 23:53:23 2021 +0200 +++ b/updaterevision.py Mon Dec 06 00:29:47 2021 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding: utf-8 # # Copyright 2015 Teemu Piippo @@ -30,7 +30,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -import md5, sys +import hashlib, sys class OutputFile: def __init__ (self, filename): @@ -47,10 +47,10 @@ self.body += a def save (self): - checksum = md5.new (self.body).hexdigest() + checksum = hashlib.md5(self.body.encode()).hexdigest() if checksum == self.oldsum: - print '%s is up to date' % self.filename + print('%s is up to date' % self.filename) return False with open (self.filename, "w") as fp: @@ -63,12 +63,12 @@ from datetime import datetime if len (sys.argv) != 2: - print 'usage: %s <output>' % sys.argv[0] + print('usage: %s <output>' % sys.argv[0]) quit (1) f = OutputFile (sys.argv[1]) data = subprocess.check_output (['hg', 'log', '-r.', '--template', - '{node|short} {branch} {date|hgdate}']).replace ('\n', '').split (' ') + '{node|short} {branch} {date|hgdate}']).decode().replace ('\n', '').split (' ') rev = data[0] branch = data[1] @@ -79,7 +79,7 @@ if len(rev) > 7: rev = rev[0:7] - if subprocess.check_output (['hg', 'id', '-n']).replace ('\n', '')[-1] == '+': + if subprocess.check_output (['hg', 'id', '-n']).decode().replace ('\n', '')[-1] == '+': rev += '+' f.write ('#define HG_NODE "%s"\n' % rev) @@ -88,7 +88,7 @@ f.write ('#define HG_DATE_STRING "%s"\n' % date.strftime ('%d %b %Y')) f.write ('#define HG_DATE_TIME %d\n' % int (timestamp)) if f.save(): - print '%s updated to %s' % (f.filename, rev) + print('%s updated to %s' % (f.filename, rev)) if __name__ == '__main__': - main() \ No newline at end of file + main()