Skip to content

Commit e6a3ade

Browse files
committed
RC release 3.7.0; Decouple library name and version from main version; Require and use C++17, and use string_view where possible; Snip superfluous const
1 parent d7f92d7 commit e6a3ade

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+610
-733
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.pyc
22
**/*.deps/
3+
/build/
34
/.ccls-cache/
45
/*.pc
56
/aclocal.m4
@@ -60,6 +61,7 @@
6061

6162
/compile_commands.json
6263
/lttoolbox/lt-comp
64+
/lttoolbox/lt-compose
6365
/lttoolbox/lt-proc
6466
/lttoolbox/lt-trim
6567
/lttoolbox/Makefile

CMakeLists.txt

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
22
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
33
project(lttoolbox
4-
VERSION 3.5.2
4+
VERSION 3.7.0
55
LANGUAGES CXX C
66
)
77
set(VERSION ${PROJECT_VERSION})
8-
set(VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
9-
set(VERSION_API "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
10-
set(SOVERSION 1.0.0)
8+
set(VERSION_ABI 3)
119
set(PACKAGE_BUGREPORT "[email protected]")
1210

1311
add_definitions("-DPACKAGE_VERSION=\"${PROJECT_VERSION}\"")
@@ -68,7 +66,7 @@ else()
6866
endforeach()
6967

7068
# Require latest possible C++ standard
71-
foreach(flag "-std=c++20" "-std=c++2a" "-std=c++17" "-std=c++1z" "-std=c++14" "-std=c++1y")
69+
foreach(flag "-std=c++23" "-std=c++2b" "-std=c++20" "-std=c++2a" "-std=c++17")
7270
string(REGEX REPLACE "[^a-z0-9]" "-" _flag ${flag})
7371
CHECK_CXX_COMPILER_FLAG(${flag} COMPILER_SUPPORTS_${_flag})
7472
if(COMPILER_SUPPORTS_${_flag})
@@ -78,7 +76,7 @@ else()
7876
endif()
7977
endforeach()
8078
if(NOT _ENABLED_CXX)
81-
message(FATAL_ERROR "Could not enable at least C++14 (C++1y) - upgrade your compiler")
79+
message(FATAL_ERROR "Could not enable at least C++17 - upgrade your compiler")
8280
endif()
8381

8482
# Generate pkg-config file
@@ -106,6 +104,10 @@ else()
106104
add_definitions(-D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE)
107105
endif()
108106

107+
if(NOT APPLE)
108+
find_package(Threads REQUIRED)
109+
endif()
110+
109111
# Unlocked I/O functions
110112
include(CheckSymbolExists)
111113
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE)
@@ -128,6 +130,9 @@ else()
128130
set(GETOPT_LIB)
129131
endif()
130132

133+
# ICU
134+
find_package(ICU COMPONENTS i18n io uc REQUIRED)
135+
131136
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
132137

133138
if(BUILD_TESTING)

configure.ac

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
AC_PREREQ(2.52)
22

33
m4_define([PKG_VERSION_MAJOR], [3])
4-
m4_define([PKG_VERSION_MINOR], [6])
5-
m4_define([PKG_VERSION_PATCH], [10])
6-
m4_include([m4/ax_pthread.m4])
4+
m4_define([PKG_VERSION_MINOR], [7])
5+
m4_define([PKG_VERSION_PATCH], [0])
6+
7+
# Bump if the ABI (not API) changed in a backwards-incompatible manner
8+
m4_define([PKG_VERSION_ABI], [3])
79

810
AC_INIT([lttoolbox], [PKG_VERSION_MAJOR.PKG_VERSION_MINOR.PKG_VERSION_PATCH], [[email protected]], [lttoolbox], [https://wiki.apertium.org/wiki/Lttoolbox])
911

1012
VERSION=$PACKAGE_VERSION
11-
VERSION_MAJOR=PKG_VERSION_MAJOR
12-
VERSION_API=PKG_VERSION_MAJOR.PKG_VERSION_MINOR
13-
SOVERSION=1:0:0
13+
VERSION_ABI=PKG_VERSION_ABI
1414

1515
AC_SUBST(PACKAGE_NAME)
1616
AC_SUBST(PACKAGE_VERSION)
17-
AC_SUBST(VERSION_MAJOR)
18-
AC_SUBST(VERSION_API)
19-
AC_SUBST(SOVERSION)
17+
AC_SUBST(VERSION_ABI)
2018

2119
AM_INIT_AUTOMAKE
2220
AC_CONFIG_MACRO_DIR([m4])
@@ -72,12 +70,12 @@ AM_CONDITIONAL([WINDOWS], [test x$version_type = xwindows])
7270

7371
# Require highest supported C++ standard
7472
AC_LANG(C++)
75-
for version in 23 2b 20 2a 17 1z 14 1y; do
73+
for version in 23 2b 20 2a 17; do
7674
version_flag="-std=c++${version}"
7775
AX_CHECK_COMPILE_FLAG([${version_flag}], [break], [version_flag=none])
7876
done
7977
AS_IF([test "$version_flag" == none], [
80-
AC_MSG_ERROR([Could not enable at least C++1y (C++14) - upgrade your compiler])
78+
AC_MSG_ERROR([Could not enable at least C++17 - upgrade your compiler])
8179
])
8280
CXXFLAGS="$CXXFLAGS ${version_flag}"
8381

lttoolbox.pc.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ includedir=@includedir@
66
Name: lttoolbox
77
Description: Augmented letter transducer tools for natural language processing
88
Version: @VERSION@
9-
Libs: -L${libdir} -llttoolbox@VERSION_MAJOR@
10-
Cflags: -I${includedir}/lttoolbox-@VERSION_API@
9+
Cflags: -I${includedir}
10+
Libs: -L${libdir} -l@PACKAGE_NAME@

lttoolbox/CMakeLists.txt

+30-18
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
set(LIBLTTOOLBOX_HEADERS
2+
acx.h
23
alphabet.h
34
att_compiler.h
45
buffer.h
6+
cli.h
57
compiler.h
68
compression.h
79
deserialiser.h
810
entry_token.h
911
exception.h
1012
expander.h
13+
file_utils.h
1114
fst_processor.h
15+
input_file.h
1216
lt_locale.h
13-
ltstr.h
1417
match_exe.h
1518
match_node.h
1619
match_state.h
@@ -20,21 +23,28 @@ set(LIBLTTOOLBOX_HEADERS
2023
regexp_compiler.h
2124
serialiser.h
2225
sorted_vector.h
26+
sorted_vector.hpp
2327
state.h
24-
string_to_wostream.h
28+
string_utils.h
2529
tmx_compiler.h
26-
trans_exe.h
2730
transducer.h
31+
trans_exe.h
32+
ustring.h
2833
xml_parse_util.h
34+
xml_walk_util.h
2935
)
3036
set(LIBLTTOOLBOX_SOURCES
37+
acx.cc
3138
alphabet.cc
3239
att_compiler.cc
40+
cli.cc
3341
compiler.cc
3442
compression.cc
3543
entry_token.cc
3644
expander.cc
45+
file_utils.cc
3746
fst_processor.cc
47+
input_file.cc
3848
lt_locale.cc
3949
match_exe.cc
4050
match_node.cc
@@ -44,10 +54,13 @@ set(LIBLTTOOLBOX_SOURCES
4454
regexp_compiler.cc
4555
sorted_vector.cc
4656
state.cc
57+
string_utils.cc
4758
tmx_compiler.cc
48-
trans_exe.cc
4959
transducer.cc
60+
trans_exe.cc
61+
ustring.cc
5062
xml_parse_util.cc
63+
xml_walk_util.cc
5164
${LIBLTTOOLBOX_HEADERS}
5265
)
5366
if(WIN32)
@@ -70,42 +83,41 @@ else()
7083
set(GETOPT)
7184
endif()
7285

73-
set(LibLttoolbox "lttoolbox${PROJECT_VERSION_MAJOR}-${VERSION_API}")
74-
add_library(${LibLttoolbox} ${LIBLTTOOLBOX_SOURCES})
75-
target_compile_definitions(${LibLttoolbox} PRIVATE LTTOOLBOX_EXPORTS)
76-
set_target_properties(${LibLttoolbox} PROPERTIES SOVERSION ${SOVERSION} VERSION ${VERSION})
77-
target_link_libraries(${LibLttoolbox} ${LIBXML2_LIBRARIES})
86+
add_library(lttoolbox ${LIBLTTOOLBOX_SOURCES})
87+
target_compile_definitions(lttoolbox PRIVATE LTTOOLBOX_EXPORTS)
88+
set_target_properties(lttoolbox PROPERTIES SOVERSION ${VERSION_ABI})
89+
target_link_libraries(lttoolbox ${LIBXML2_LIBRARIES} ${ICU_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
7890

7991
add_executable(lt-print lt_print.cc)
80-
target_link_libraries(lt-print ${LibLttoolbox} ${GETOPT_LIB})
92+
target_link_libraries(lt-print lttoolbox ${GETOPT_LIB})
8193

8294
add_executable(lt-trim lt_trim.cc)
83-
target_link_libraries(lt-trim ${LibLttoolbox} ${GETOPT_LIB})
95+
target_link_libraries(lt-trim lttoolbox ${GETOPT_LIB})
8496

8597
add_executable(lt-comp lt_comp.cc)
86-
target_link_libraries(lt-comp ${LibLttoolbox} ${GETOPT_LIB})
98+
target_link_libraries(lt-comp lttoolbox ${GETOPT_LIB})
8799

88100
add_executable(lt-proc lt_proc.cc)
89-
target_link_libraries(lt-proc ${LibLttoolbox} ${GETOPT_LIB})
101+
target_link_libraries(lt-proc lttoolbox ${GETOPT_LIB})
90102

91103
add_executable(lt-expand lt_expand.cc)
92-
target_link_libraries(lt-expand ${LibLttoolbox} ${GETOPT_LIB})
104+
target_link_libraries(lt-expand lttoolbox ${GETOPT_LIB})
93105

94106
add_executable(lt-tmxcomp lt_tmxcomp.cc)
95-
target_link_libraries(lt-tmxcomp ${LibLttoolbox} ${GETOPT_LIB})
107+
target_link_libraries(lt-tmxcomp lttoolbox ${GETOPT_LIB})
96108

97109
add_executable(lt-tmxproc lt_tmxproc.cc)
98-
target_link_libraries(lt-tmxproc ${LibLttoolbox} ${GETOPT_LIB})
110+
target_link_libraries(lt-tmxproc lttoolbox ${GETOPT_LIB})
99111

100112
if(BUILD_TESTING)
101113
add_test(NAME tests COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/tests/run_tests.py" $<TARGET_FILE_DIR:lt-comp>)
102114
set_tests_properties(tests PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED")
103115
endif()
104116

105-
install(TARGETS ${LibLttoolbox}
117+
install(TARGETS lttoolbox
106118
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
107119
install(FILES ${LIBLTTOOLBOX_HEADERS}
108-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lttoolbox-${VERSION_API}/lttoolbox)
120+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lttoolbox)
109121
install(TARGETS lt-print lt-trim lt-comp lt-proc lt-expand lt-tmxcomp lt-tmxproc
110122
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
111123

lttoolbox/Makefile.am

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ cc_sources = acx.cc alphabet.cc att_compiler.cc cli.cc compiler.cc compression.c
1111
regexp_compiler.cc sorted_vector.cc state.cc string_utils.cc transducer.cc \
1212
trans_exe.cc xml_parse_util.cc xml_walk_util.cc tmx_compiler.cc ustring.cc
1313

14-
library_includedir = $(includedir)/$(PACKAGE_NAME)-$(VERSION_API)/$(PACKAGE_NAME)
14+
library_includedir = $(includedir)/$(PACKAGE_NAME)
1515
library_include_HEADERS = $(h_sources)
1616

1717
bin_PROGRAMS = lt-comp lt-proc lt-expand lt-paradigm lt-tmxcomp lt-tmxproc lt-print lt-trim lt-compose lt-append lsx-comp lt-invert lt-restrict lt-apply-acx
1818
instdir = lttoolbox
1919

20-
lib_LTLIBRARIES= liblttoolbox3.la
21-
liblttoolbox3_la_SOURCES= $(h_sources) $(cc_sources)
22-
liblttoolbox3_la_LDFLAGS= -version-info $(SOVERSION) -release $(VERSION_API)
23-
liblttoolbox3_la_LIBADD= $(ICU_LIBS)
20+
lib_LTLIBRARIES= liblttoolbox.la
21+
liblttoolbox_la_SOURCES= $(h_sources) $(cc_sources)
22+
liblttoolbox_la_LDFLAGS= -version-info $(VERSION_ABI)
23+
liblttoolbox_la_LIBADD= $(ICU_LIBS)
2424

2525
lttoolboxdir = $(prefix)/share/lttoolbox
2626
lttoolboxinclude = $(prefix)/include
2727
lttoolboxlib = $(prefix)/lib
2828

2929
lttoolbox_DATA = dix.dtd dix.rng dix.rnc acx.rng xsd/dix.xsd xsd/acx.xsd
3030

31-
LDADD = liblttoolbox$(VERSION_MAJOR).la $(PTHREAD_LIBS)
32-
AM_LDFLAGS = -llttoolbox$(VERSION_MAJOR) $(LIBXML_LIBS) $(ICU_LIBS)
31+
LDADD = liblttoolbox.la $(PTHREAD_LIBS)
32+
AM_LDFLAGS = -llttoolbox $(LIBXML_LIBS) $(ICU_LIBS)
3333

3434
lt_append_SOURCES = lt_append.cc
3535
lt_print_SOURCES = lt_print.cc

lttoolbox/acx.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ std::map<int32_t, sorted_vector<int32_t>> readACX(const char* file)
5454
vec.insert(get_val(equiv_node));
5555
}
5656
if (!vec.empty()) {
57-
acx.insert(std::make_pair(key, vec));
57+
acx.insert({key, vec});
5858
}
5959
}
6060
return acx;

0 commit comments

Comments
 (0)