-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
44 lines (35 loc) · 1.14 KB
/
CMakeLists.txt
File metadata and controls
44 lines (35 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 3.14)
project(tokenizer LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Include directories
include_directories(include)
include_directories(third_party)
if(MSVC)
add_compile_options(/utf-8)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
option(UJSON_USE_RAPIDJSON "Use RapidJSON backend" OFF)
if(UJSON_USE_RAPIDJSON)
add_definitions(-DUJSON_USE_RAPIDJSON)
include_directories(third_party/rapidjson/include)
endif()
# Oniguruma
add_subdirectory(third_party/oniguruma)
include_directories(third_party/oniguruma/src)
# Source files
set(SOURCES
src/tokenizer.cpp
third_party/utf8proc/utf8proc.c
)
# Library
add_library(tokenizer_lib STATIC ${SOURCES})
target_include_directories(tokenizer_lib PUBLIC include third_party)
target_link_libraries(tokenizer_lib onig)
target_compile_definitions(tokenizer_lib PUBLIC UTF8PROC_STATIC)
# Executable for testing
add_executable(test_main tests/test_main.cpp)
target_link_libraries(test_main tokenizer_lib)
# Simple test executable
add_executable(test_simple tests/test_simple.cpp)
target_link_libraries(test_simple tokenizer_lib)