Skip to content

Commit 7cca893

Browse files
committed
Add .gitignore to hide gen code
1 parent c31ac1a commit 7cca893

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ endif ()
1313

1414
add_subdirectory(lexer_gen)
1515

16-
set(PL_STATICLEXERPATH "${CMAKE_CURRENT_SOURCE_DIR}/include/pl/core/lexer_static.hpp")
16+
set(PL_STATICLEXERPATH "${CMAKE_CURRENT_SOURCE_DIR}/include/pl/core/generated/lexer_static.hpp")
1717

1818
add_custom_command(
1919
OUTPUT ${PL_STATICLEXERPATH}

lib/include/pl/core/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore generated code folder
2+
generated/

lib/lexer_gen/main.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,25 @@ step to optimize application start-up time.
1010
#include <lexertl/generate_cpp.hpp>
1111

1212
#include <fstream>
13-
#include <iostream>
13+
#include <filesystem>
1414

1515
int main(int argc, char *argv[])
1616
{
1717
if (argc!=2)
1818
return 1;
1919

20-
lexertl::state_machine sm;
20+
try
21+
{
22+
std::filesystem::path argPath(argv[1]);
23+
std::filesystem::path genDir = argPath.parent_path();
24+
std::filesystem::create_directory(genDir);
25+
}
26+
catch (const std::filesystem::filesystem_error &fse)
27+
{
28+
return 1;
29+
}
2130

31+
lexertl::state_machine sm;
2232
pl::core::newLexerBuild(sm);
2333
sm.minimise();
2434

lib/source/pl/core/lexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <lexertl/generator.hpp>
1414

1515
#if defined(NDEBUG)
16-
#include <pl/core/lexer_static.hpp>
16+
#include <pl/core/generated/lexer_static.hpp>
1717
#endif
1818

1919
#include <cstddef>

0 commit comments

Comments
 (0)