PotatoAlert
PotatoAlert copied to clipboard
Add Linux Support
CMake 3.20.3 Qt 5.15.2 GCC 10.3.0
Consolidate compiler generated dependencies of target framelessHelper
[ 2%] Building CXX object framelessHelper/CMakeFiles/framelessHelper.dir/FramelessHelper_win32.cpp.o
In file included from /home/schenkel/Development/git/PotatoAlert/framelessHelper/FramelessHelper_win32.cpp:15:
/usr/include/qt5/QtCore/qt_windows.h:64:10: fatal error: windows.h: No such file or directory
64 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated.
make[2]: *** [framelessHelper/CMakeFiles/framelessHelper.dir/build.make:90: framelessHelper/CMakeFiles/framelessHelper.dir/FramelessHelper_win32.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:846: framelessHelper/CMakeFiles/framelessHelper.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Using Ninja for building also get me trouble Ninja 1.10.2
[1/46] Building CXX object util/CMakeFiles/util.dir/StringTable.cpp.o
FAILED: util/CMakeFiles/util.dir/StringTable.cpp.o
/usr/local/bin/c++ -DFMT_HEADER_ONLY=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WEBSOCKETS_LIB -DQT_WIDGETS_LIB -Iutil -I../util -Iutil/util_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../gui -I../Resources -I../framelessHelper -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtWebSockets -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -fPIC -std=gnu++2a -MD -MT util/CMakeFiles/util.dir/StringTable.cpp.o -MF util/CMakeFiles/util.dir/StringTable.cpp.o.d -o util/CMakeFiles/util.dir/StringTable.cpp.o -c ../util/StringTable.cpp
In file included from ../util/StringTable.cpp:3:
../util/StringTable.hpp:12:10: fatal error: StringTableKeys.i: No such file or directory
12 | #include "StringTableKeys.i"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
[2/46] Building CXX object framelessHelper/CMakeFiles/framelessHelper.dir/FramelessHelper_win32.cpp.o
FAILED: framelessHelper/CMakeFiles/framelessHelper.dir/FramelessHelper_win32.cpp.o
/usr/local/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -IframelessHelper -I../framelessHelper -IframelessHelper/framelessHelper_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../util -I../gui -I../Resources -isystem /usr/include/qt5/QtGui/5.15.2 -isystem /usr/include/qt5/QtGui/5.15.2/QtGui -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtCore/5.15.2 -isystem /usr/include/qt5/QtCore/5.15.2/QtCore -isystem /usr/include/qt5/QtWidgets -fPIC -std=gnu++2a -MD -MT framelessHelper/CMakeFiles/framelessHelper.dir/FramelessHelper_win32.cpp.o -MF framelessHelper/CMakeFiles/framelessHelper.dir/FramelessHelper_win32.cpp.o.d -o framelessHelper/CMakeFiles/framelessHelper.dir/FramelessHelper_win32.cpp.o -c ../framelessHelper/FramelessHelper_win32.cpp
In file included from ../framelessHelper/FramelessHelper_win32.cpp:15:
/usr/include/qt5/QtCore/qt_windows.h:64:10: fatal error: windows.h: No such file or directory
64 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated.
[3/46] Building CXX object framelessHelper/CMakeFiles/framelessHelper.dir/FramelessUtilities_win32.cpp.o
FAILED: framelessHelper/CMakeFiles/framelessHelper.dir/FramelessUtilities_win32.cpp.o
/usr/local/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -IframelessHelper -I../framelessHelper -IframelessHelper/framelessHelper_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../util -I../gui -I../Resources -isystem /usr/include/qt5/QtGui/5.15.2 -isystem /usr/include/qt5/QtGui/5.15.2/QtGui -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtCore/5.15.2 -isystem /usr/include/qt5/QtCore/5.15.2/QtCore -isystem /usr/include/qt5/QtWidgets -fPIC -std=gnu++2a -MD -MT framelessHelper/CMakeFiles/framelessHelper.dir/FramelessUtilities_win32.cpp.o -MF framelessHelper/CMakeFiles/framelessHelper.dir/FramelessUtilities_win32.cpp.o.d -o framelessHelper/CMakeFiles/framelessHelper.dir/FramelessUtilities_win32.cpp.o -c ../framelessHelper/FramelessUtilities_win32.cpp
../framelessHelper/FramelessUtilities_win32.cpp:15:10: fatal error: dwmapi.h: No such file or directory
15 | #include <dwmapi.h>
| ^~~~~~~~~~
compilation terminated.
[4/46] Building CXX object util/CMakeFiles/util.dir/Game.cpp.o
FAILED: util/CMakeFiles/util.dir/Game.cpp.o
/usr/local/bin/c++ -DFMT_HEADER_ONLY=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WEBSOCKETS_LIB -DQT_WIDGETS_LIB -Iutil -I../util -Iutil/util_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../gui -I../Resources -I../framelessHelper -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtWebSockets -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -fPIC -std=gnu++2a -MD -MT util/CMakeFiles/util.dir/Game.cpp.o -MF util/CMakeFiles/util.dir/Game.cpp.o.d -o util/CMakeFiles/util.dir/Game.cpp.o -c ../util/Game.cpp
../util/Game.cpp:14:10: fatal error: winver.h: No such file or directory
14 | #include <winver.h>
| ^~~~~~~~~~
compilation terminated.
[5/46] Building CXX object util/CMakeFiles/util.dir/PotatoClient.cpp.o
FAILED: util/CMakeFiles/util.dir/PotatoClient.cpp.o
/usr/local/bin/c++ -DFMT_HEADER_ONLY=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WEBSOCKETS_LIB -DQT_WIDGETS_LIB -Iutil -I../util -Iutil/util_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../gui -I../Resources -I../framelessHelper -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtWebSockets -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -fPIC -std=gnu++2a -MD -MT util/CMakeFiles/util.dir/PotatoClient.cpp.o -MF util/CMakeFiles/util.dir/PotatoClient.cpp.o.d -o util/CMakeFiles/util.dir/PotatoClient.cpp.o -c ../util/PotatoClient.cpp
../util/PotatoClient.cpp:30:10: fatal error: windows.h: No such file or directory
30 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated.
[6/46] Building CXX object util/CMakeFiles/util.dir/__/updater/Updater.cpp.o
FAILED: util/CMakeFiles/util.dir/__/updater/Updater.cpp.o
/usr/local/bin/c++ -DFMT_HEADER_ONLY=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WEBSOCKETS_LIB -DQT_WIDGETS_LIB -Iutil -I../util -Iutil/util_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../gui -I../Resources -I../framelessHelper -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtWebSockets -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -fPIC -std=gnu++2a -MD -MT util/CMakeFiles/util.dir/__/updater/Updater.cpp.o -MF util/CMakeFiles/util.dir/__/updater/Updater.cpp.o.d -o util/CMakeFiles/util.dir/__/updater/Updater.cpp.o -c ../updater/Updater.cpp
../updater/Updater.cpp:17:10: fatal error: Windows.h: No such file or directory
17 | #include <Windows.h>
| ^~~~~~~~~~~
compilation terminated.
[7/46] Building CXX object util/CMakeFiles/util.dir/Logger.cpp.o
FAILED: util/CMakeFiles/util.dir/Logger.cpp.o
/usr/local/bin/c++ -DFMT_HEADER_ONLY=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WEBSOCKETS_LIB -DQT_WIDGETS_LIB -Iutil -I../util -Iutil/util_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../gui -I../Resources -I../framelessHelper -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtWebSockets -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -fPIC -std=gnu++2a -MD -MT util/CMakeFiles/util.dir/Logger.cpp.o -MF util/CMakeFiles/util.dir/Logger.cpp.o.d -o util/CMakeFiles/util.dir/Logger.cpp.o -c ../util/Logger.cpp
../util/Logger.cpp: In static member function ‘static std::string PotatoAlert::Logger::getTimeString()’:
../util/Logger.cpp:87:2: error: ‘localtime_s’ was not declared in this scope; did you mean ‘localtime_r’?
87 | localtime_s(&localTime, &time);
| ^~~~~~~~~~~
| localtime_r
ninja: build stopped: subcommand failed.
correct. it depends on the native windows api, it wont compile on linux for now.
I'll add this as an enhancement to maybe support it in a further update, but I have to mention that this is REALLY low priority to me.
also this error
[1/46] Building CXX object util/CMakeFiles/util.dir/StringTable.cpp.o
FAILED: util/CMakeFiles/util.dir/StringTable.cpp.o
/usr/local/bin/c++ -DFMT_HEADER_ONLY=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WEBSOCKETS_LIB -DQT_WIDGETS_LIB -Iutil -I../util -Iutil/util_autogen/include -I../ThirdParty/tinyxml2/include -I../ThirdParty/nlohmann_json/include -I../ThirdParty/fmt/include -I../ThirdParty/zip/src -I../gui -I../Resources -I../framelessHelper -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtWebSockets -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -fPIC -std=gnu++2a -MD -MT util/CMakeFiles/util.dir/StringTable.cpp.o -MF util/CMakeFiles/util.dir/StringTable.cpp.o.d -o util/CMakeFiles/util.dir/StringTable.cpp.o -c ../util/StringTable.cpp
In file included from ../util/StringTable.cpp:3:
../util/StringTable.hpp:12:10: fatal error: StringTableKeys.i: No such file or directory
12 | #include "StringTableKeys.i"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
is because you need to generate the stringtable header by running Resources/generate_translations.py
Some progress has been made by separating all platform specific code into Foobar.win32.cpp
and Foobar.linux.cpp
, some of which still need to be implemented. Check branch https://github.com/razaqq/PotatoAlert/tree/3.1.0
@gbschenkel okay linux support is now here in feature branch https://github.com/razaqq/PotatoAlert/tree/3.1.0 check the README for detailed build instructions would be very useful if you could report back if you got it working
i will put it on AUR (for arch based distros) in the next couple days
Hi, sorry about the delay, I quit playing World of Warships, but at least I could try build your project:
I got this initial problem:
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -lc++abi" ..
-- The C compiler identification is Clang 13.0.1
-- The CXX compiler identification is Clang 13.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.18")
Generating stringtable...
File "/home/schenkel/Development/gitrepo/PotatoAlert/Resources/generate_translations.py", line 22
f.write(','.join([f'"{lang}"' for lang in languages]) + '\n')
^
SyntaxError: invalid syntax
CMake Error at CMakeLists.txt:41 (message):
Failed to generate stringtable
-- Configuring incomplete, errors occurred!
I saw is needed Clang 14 and I using 13.0.1 but I don't think is related, also /usr/bin/python3
need be called to use python 3.9.12
Since both WIndows and Linux will use Clang and Python I made a few ajust on CMakeList.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f69253f..63239649 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,10 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
+set(CMAKE_C_COMPILER clang)
+set(CMAKE_CXX_COMPILER clang++)
+set(CMAKE_GENERATOR "Ninja")
+
enable_testing()
option(PA_PROFILE "Enable Profiling Output" OFF)
@@ -32,7 +36,7 @@ generate_product_version(
)
# generate stringtable headers
-find_package(PythonInterp REQUIRED)
+find_package(Python 3.7 REQUIRED)
message("Generating stringtable...")
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/Resources/generate_translations.py"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
Hi, sorry about the delay, I quit playing World of Warships, but at least I could try build your project:
I got this initial problem:
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -lc++abi" .. -- The C compiler identification is Clang 13.0.1 -- The CXX compiler identification is Clang 13.0.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PythonInterp: /usr/bin/python (found version "2.7.18") Generating stringtable... File "/home/schenkel/Development/gitrepo/PotatoAlert/Resources/generate_translations.py", line 22 f.write(','.join([f'"{lang}"' for lang in languages]) + '\n') ^ SyntaxError: invalid syntax CMake Error at CMakeLists.txt:41 (message): Failed to generate stringtable -- Configuring incomplete, errors occurred!
I saw is needed Clang 14 and I using 13.0.1 but I don't think is related, also
/usr/bin/python3
need be called to use python 3.9.12
correct, it requires python3 and libc++14
Since both WIndows and Linux will use Clang and Python I made a few ajust on CMakeList.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f69253f..63239649 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,10 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_GENERATOR "Ninja") + enable_testing() option(PA_PROFILE "Enable Profiling Output" OFF) @@ -32,7 +36,7 @@ generate_product_version( ) # generate stringtable headers -find_package(PythonInterp REQUIRED) +find_package(Python 3.7 REQUIRED) message("Generating stringtable...") execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/Resources/generate_translations.py" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
forcing a compiler is not a good idea, in theory you can use g++ (if the stdlib is new enough) or msvc to build this too