Skip to content

Commit 0c27c3e

Browse files
committed
Use re2
1 parent a8e6f85 commit 0c27c3e

File tree

5 files changed

+58
-1529
lines changed

5 files changed

+58
-1529
lines changed

CMakeLists.txt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,40 @@ endif()
2424

2525
# <TClient>
2626

27+
# re2
28+
29+
find_package(PkgConfig QUIET)
30+
if(PkgConfig_FOUND)
31+
pkg_check_modules(RE2 QUIET re2)
32+
else()
33+
find_package(re2 REQUIRED)
34+
message(STATUS "PkgConfig not found")
35+
message(STATUS " RE2 will probably be built even if installed")
36+
endif()
37+
if (NOT RE2_FOUND)
38+
message(STATUS "RE2 not found")
39+
message(STATUS " building 2025-08-12 instead")
40+
message(STATUS " you should install RE2 for a faster build")
41+
include(FetchContent)
42+
FetchContent_Declare(
43+
re2
44+
GIT_REPOSITORY https://github.com/google/re2.git
45+
GIT_TAG 2025-08-12
46+
GIT_SHALLOW TRUE
47+
)
48+
FetchContent_MakeAvailable(re2)
49+
set(RE2_LIBRARIES, re2::re2)
50+
endif()
51+
52+
# data_version.txt
53+
2754
set(DATA_VERSION_FILE "${CMAKE_BINARY_DIR}/data/data_version.txt")
2855
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/data")
2956

3057
file(WRITE "${DATA_VERSION_FILE}" "DDNet ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}\n")
3158

59+
# tclient version
60+
3261
file(STRINGS src/game/version.h TCLIENT_VERSION_LINE
3362
LIMIT_COUNT 1
3463
REGEX "^#define TCLIENT_VERSION "
@@ -2262,7 +2291,6 @@ set_src(ENGINE_SHARED GLOB_RECURSE src/engine/shared
22622291
websockets.h
22632292
)
22642293
set_src(ENGINE_EXTERNAL GLOB src/engine/external
2265-
remimu.h
22662294
spt.cpp
22672295
spt.h
22682296
tinyexpr.cpp
@@ -2737,6 +2765,7 @@ if(CLIENT)
27372765

27382766
# Libraries
27392767
set(LIBS_CLIENT
2768+
${RE2_LIBRARIES} # TClient
27402769
${FREETYPE_LIBRARIES}
27412770
${GLEW_LIBRARIES}
27422771
${PNG_LIBRARIES}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Here is a list of variables which are available:
3535
| `ifreq` | `s[a] s[b] r[command]` | Comapre 2 values, if a matches the regex b run the command |
3636
| `ifrneq` | `s[a] s[b] r[command]` | Comapre 2 values, if a doesnt match the regex b run the command |
3737

38-
(Note the regex engine is [Remimu](https://github.com/wareya/Remimu))
38+
(Note the regex engine is [RE2](https://github.com/google/re2/))
3939

4040
With the commands listed above and the substitutions you can create simple comparisons, here is a few examples.
4141

0 commit comments

Comments
 (0)