Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update cpp standard + new way of linking with find_package #67

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project(FuzzyMatch)

cmake_minimum_required(VERSION 3.5.1)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

if(TARGET OpenNMTTokenizer)
Expand Down
2 changes: 1 addition & 1 deletion cli/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ target_include_directories(${PROJECT_NAME} PUBLIC

target_link_libraries(${PROJECT_NAME}-cli
${PROJECT_NAME}
${Boost_LIBRARIES}
Boost::program_options
)
11 changes: 11 additions & 0 deletions include/fuzzy/sentence.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
#include <vector>
#include <unordered_map>

//
// Even latest Debian Sid (March 2023) uses Boost 1.74 which does not behave well with very fresh compilers and triggers this error:
// https://github.com/pavel-odintsov/fastnetmon/issues/970
// This bug was fixed in fresh Boost versions: https://github.com/boostorg/serialization/issues/219 and we apply workaround only for 1.74
//

#include <boost/serialization/version.hpp>
#if BOOST_VERSION / 100000 == 1 && BOOST_VERSION / 100 % 1000 == 74
#include <boost/serialization/library_version_type.hpp>
#endif

#include <boost/serialization/string.hpp>
#include <boost/serialization/unordered_map.hpp>

Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC
target_link_libraries(${PROJECT_NAME}
${OPENNMT_TOKENIZER_LIB}
${ICU_LIBRARIES}
${Boost_LIBRARIES}
Boost::serialization
Boost::iostreams
Boost::system
Threads::Threads
)
2 changes: 2 additions & 0 deletions src/fuzzy_match.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ namespace fuzzy
_ptokenizer->add_alphabet_to_segment("Kanbun");
_ptokenizer->add_alphabet_to_segment("Katakana");
_ptokenizer->add_alphabet_to_segment("Hiragana");
_ptokenizer->add_alphabet_to_segment("Thai");
_ptokenizer->add_alphabet_to_segment("Myanmar"); // Burmese
}

void
Expand Down
9 changes: 5 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ add_executable(${PROJECT_NAME}-test test.cc)

find_package(GTest REQUIRED)

find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(Boost COMPONENTS filesystem system serialization REQUIRED)

include_directories(
${source_dir}/include
${GTEST_INCLUDE_DIRS}
${GTest_INCLUDE_DIRS}
)

target_include_directories(${PROJECT_NAME}-test PUBLIC
Expand All @@ -17,8 +17,9 @@ target_include_directories(${PROJECT_NAME}-test PUBLIC
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
GTest::GTest GTest::Main
${Boost_FILESYSTEM_LIBRARY}
${GTEST_LIBRARIES}
Boost::filesystem
Boost::serialization
Boost::system
)

set(${PROJECT_NAME}-test-args "${CMAKE_CURRENT_LIST_DIR}/data/")
Expand Down
Loading