Add lagecy CPP check, and swith between std includes
parent
f46dfb9b97
commit
a79916934b
|
@ -64,11 +64,13 @@ For the development environment I'm using VSCodium with `C/C++`, `Cmake` and `Cm
|
|||
|
||||
## Depedencies
|
||||
|
||||
For the build you need at least:
|
||||
|
||||
* GCC 9 or higher (GCC 8 should also work)
|
||||
* CMake
|
||||
* Qt (`qt5-default` package)
|
||||
|
||||
For Release packaing:
|
||||
For Release packaging:
|
||||
|
||||
* CPack
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ set (CMAKE_AUTOMOC ON)
|
|||
set (CMAKE_AUTORCC ON)
|
||||
|
||||
# Also add -lstdc++fs for older GCC compilers
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -lstdc++fs")
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
|
||||
|
@ -16,6 +16,18 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(PROJECT_TARGET browser)
|
||||
|
||||
|
||||
# Add workaround for std filesystem in older GCC versions
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4)
|
||||
message(FATAL_ERROR "You are on an extremely old version of GCC. Please update your compiler to at least GCC 8.0, preferably latest")
|
||||
elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
message(WARNING "Old Version of GCC detected. Using Legacy C++ support")
|
||||
target_link_libraries(${PROJECT_TARGET} -lstdc++fs)
|
||||
target_compile_definitions(${PROJECT_TARGET} PUBLIC LEGACY_CXX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
|
||||
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
|
||||
# They need to be set before the find_package(Qt5 ...) call.
|
||||
|
|
|
@ -3,7 +3,13 @@
|
|||
#include "md-parser.h"
|
||||
#include "md-render.h"
|
||||
|
||||
#ifdef LEGACY_CXX
|
||||
#include <experimental/filesystem>
|
||||
namespace n_fs = ::std::experimental::filesystem;
|
||||
#else
|
||||
#include <filesystem>
|
||||
namespace n_fs = ::std::filesystem;
|
||||
#endif
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenuBar>
|
||||
|
@ -53,7 +59,7 @@ void MainWindow::setupParser()
|
|||
parser = new Parser();
|
||||
renderer = new Renderer(scene);
|
||||
|
||||
std::string exePath = std::filesystem::current_path().string();
|
||||
std::string exePath = n_fs::current_path().string();
|
||||
std::string htmlOutput = "";
|
||||
std::string filePath = exePath.append("/../../test.md");
|
||||
printf("Path: %s\n", filePath.c_str());
|
||||
|
|
Loading…
Reference in New Issue