Fix MSVC compiler errors
This commit is contained in:
1 parent
ba5971a788
commit
7ed885f0d1
2 files changed
+49
No files matched your search
@@ -73,6 +73,17 @@ else()
|
|||||||
FetchContent_Declare(antlr4 ${_antlr_fetch_args})
|
FetchContent_Declare(antlr4 ${_antlr_fetch_args})
|
||||||
FetchContent_MakeAvailable(antlr4)
|
FetchContent_MakeAvailable(antlr4)
|
||||||
|
|
||||||
|
# The runtime forgets some standard #includes (<chrono> for one), which newer
|
||||||
|
# standard libraries, notably Visual C++'s, no longer paper over. Supply them.
|
||||||
|
if(TARGET antlr4_static)
|
||||||
|
set(_compat "${CMAKE_CURRENT_SOURCE_DIR}/cmake/antlr_runtime_compat.h")
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(antlr4_static PRIVATE "/FI${_compat}")
|
||||||
|
else()
|
||||||
|
target_compile_options(antlr4_static PRIVATE -include "${_compat}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(ANTLRLAB_RUNTIME_LIBS antlr4_static)
|
set(ANTLRLAB_RUNTIME_LIBS antlr4_static)
|
||||||
set(ANTLRLAB_RUNTIME_INCLUDES "${antlr4_SOURCE_DIR}/runtime/Cpp/runtime/src")
|
set(ANTLRLAB_RUNTIME_INCLUDES "${antlr4_SOURCE_DIR}/runtime/Cpp/runtime/src")
|
||||||
set(ANTLRLAB_RUNTIME_DEFS ANTLR4CPP_STATIC)
|
set(ANTLRLAB_RUNTIME_DEFS ANTLR4CPP_STATIC)
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// Force-included into the ANTLR C++ runtime's own build (see CMakeLists.txt).
|
||||||
|
//
|
||||||
|
// ANTLR 4.13's sources use some standard library facilities (std::chrono in
|
||||||
|
// ProfilingATNSimulator.cpp, for one) without including the header that
|
||||||
|
// declares them. That only worked because older standard libraries included
|
||||||
|
// those headers indirectly; newer Visual C++ versions no longer do, and the
|
||||||
|
// build fails with errors like "'high_resolution_clock': is not a class or
|
||||||
|
// namespace name". Including them up front is harmless everywhere else.
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <atomic>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <exception>
|
||||||
|
#include <functional>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <limits>
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
#include <numeric>
|
||||||
|
#include <set>
|
||||||
|
#include <sstream>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
#include <typeinfo>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
Reference in new issue
Block a user