Skip to content

Commit

Permalink
Update build system
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph2 committed Oct 23, 2024
1 parent 9f574e7 commit f25cda0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ set(ANTLR4_TAG $ENV{ANTLR4_TAG})
message("ANTLR4-TAG: " ${ANTLR4_TAG})

SET(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 23)
# set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD 20)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/antlr_cmake)

add_definitions(-DANTLR4CPP_STATIC)
set(ANTLR4_WITH_STATIC_CRT OFF)
set(ANTLR4_WITH_STATIC_CRT ON)
include(ExternalAntlr4Cpp)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand All @@ -44,7 +45,7 @@ message( STATUS "Found pybind11 v${pybind11_VERSION} ${pybind11_VERSION_TYPE}: $
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/dist")


SET(GCC_N_CLANG_BASE_OPTIONS "-std=c++23 -Wall -Wextra -Wpedantic -Warray-bounds -mtune=native -fexceptions")
SET(GCC_N_CLANG_BASE_OPTIONS "-Wall -Wextra -Wpedantic -Warray-bounds -mtune=native -fexceptions")
# target_link_options(${PROJECT_NAME} PUBLIC -flto=auto)

SET(MSVC_BASE_OPTIONS "/W3 /permissive- /EHsc /bigobj /Zc:__cplusplus /std:c++latest")
Expand Down
3 changes: 3 additions & 0 deletions build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def banner(msg: str) -> None:
def build_extension(debug: bool = False, use_temp_dir=False) -> None:
print("build_ext::build_extension()")

use_temp_dir = use_temp_dir or os.environ.get("BUILD_TEMP")
debug = debug or os.environ.get("BUILD_DEBUG")

antlr4_tag = most_recent_tag("https://github.com/antlr/antlr4")
print("antlr4_tag", antlr4_tag)
os.environ["ANTLR4_TAG"] = antlr4_tag
Expand Down
4 changes: 0 additions & 4 deletions pya2l/extensions/a2lparser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ class A2LParser {
auto idr = std::get<2>(m_prepro_result.value());
idr.open();
}

while (true) {
const auto token = m_reader->LT(1);
// auto block = kw_tos().m_block;

if (token_type() == A2LTokenType::BEGIN) {
m_reader->consume();
Expand All @@ -79,7 +77,6 @@ class A2LParser {
if (token_type() == A2LTokenType::END) {
m_reader->consume();
const auto glied = m_reader->LT(1);
// std::cout << "\t/END " << glied->getText() << "\n";
assert(kw_tos().m_name == glied->getText());
if (kw_tos().m_name == glied->getText()) {
kw_pop();
Expand All @@ -99,7 +96,6 @@ class A2LParser {
}

if (kw_tos().contains(token->getType())) {
// std::cout << v++ << ": " << token->getText() << std::endl;
const auto ttype = kw_tos().get(token->type());
kw_push(ttype);
auto& vref = value_tos().add_keyword(ValueContainer(ttype.m_class_name));
Expand Down
3 changes: 2 additions & 1 deletion pya2l/extensions/tempfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ class TempFile {
}

void remove() noexcept {
close();
if (fs::exists(m_path)) {
close();

// fs::remove(m_path);
}
}
Expand Down

0 comments on commit f25cda0

Please sign in to comment.