-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
132 lines (112 loc) · 4.04 KB
/
CMakeLists.txt
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
cmake_minimum_required(VERSION 3.18)
include(cmake/vcpkg.cmake)
project(cedilla VERSION 1.0)
enable_testing()
set(PY_VERSION 3.7)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
set(Python_FIND_IMPLEMENTATIONS PyPy)
find_package(Python3 COMPONENTS Interpreter)
message("-- Found Python ${Python3_EXECUTABLE}")
include(cmake/unicode_data.cmake)
set(CMAKE_CXX_STANDARD 17)
add_executable(namesgen tools/names.cpp)
find_package(Threads REQUIRED)
find_package(TBB CONFIG REQUIRED)
find_package(range-v3 CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(pugixml CONFIG REQUIRED)
target_link_libraries(namesgen PRIVATE
Threads::Threads
pugixml
fmt::fmt
TBB::tbb
range-v3-concepts
)
SET(HEADERS_DIR ${PROJECT_BINARY_DIR}/include/cedilla/)
add_executable(namesreversegen
tools/namesreverse.cpp
)
target_link_libraries(namesreversegen PRIVATE
pugixml
fmt::fmt
TBB::tbb
range-v3-concepts
Threads::Threads
)
target_compile_options(namesreversegen PRIVATE "-fopenmp-simd" "-march=native")
add_custom_command(
COMMENT "Generating Properties Header"
OUTPUT ${HEADERS_DIR}/properties.hpp
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND mkdir -p ${HEADERS_DIR}
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/cedilla
COMMAND ${Python3_EXECUTABLE}
${PROJECT_SOURCE_DIR}/tools/gen.py
${PROJECT_BINARY_DIR}/cedilla/generated_props.hpp
${PROJECT_BINARY_DIR}/cedilla/generated_props_extra.hpp
${PROJECT_BINARY_DIR}/ucd/
COMMAND ${Python3_EXECUTABLE} -m quom
${PROJECT_SOURCE_DIR}/src/all.hpp
-I ${PROJECT_BINARY_DIR}
-I ${PROJECT_SOURCE_DIR}/src/
${HEADERS_DIR}/properties.hpp
COMMAND clang-format ${HEADERS_DIR}/properties.hpp -i
DEPENDS
${PROJECT_SOURCE_DIR}/src/all.hpp
${PROJECT_SOURCE_DIR}/src/cedilla/synopsys.h
${PROJECT_SOURCE_DIR}/src/cedilla/base.h
${PROJECT_SOURCE_DIR}/src/cedilla/unicode.h
${PROJECT_SOURCE_DIR}/src/cedilla/regex.h
${PROJECT_SOURCE_DIR}/tools/gen.py
${PROJECT_BINARY_DIR}/ucd/14.0/ucd.nounihan.flat.xml
${PROJECT_BINARY_DIR}/ucd/PropertyValueAliases.txt
${PROJECT_BINARY_DIR}/ucd/14.0/emoji-data.txt
)
add_custom_command(
COMMENT "Generating name_to_cp.hpp"
OUTPUT ${HEADERS_DIR}/name_to_cp.hpp
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND mkdir -p ${HEADERS_DIR}
COMMAND namesreversegen
${PROJECT_BINARY_DIR}/ucd/14.0/ucd.nounihan.flat.xml > ${HEADERS_DIR}/name_to_cp.hpp
COMMAND cat ${PROJECT_SOURCE_DIR}/src/name_to_cp.hpp >> ${HEADERS_DIR}/name_to_cp.hpp
COMMAND clang-format ${HEADERS_DIR}/name_to_cp.hpp -i
DEPENDS
${PROJECT_BINARY_DIR}/ucd/14.0/ucd.nounihan.flat.xml
${PROJECT_SOURCE_DIR}/src/name_to_cp.hpp
)
add_custom_command(
COMMENT "Generating cp_to_name.hpp"
OUTPUT ${HEADERS_DIR}/cp_to_name.hpp
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND mkdir -p ${HEADERS_DIR}
COMMAND namesgen
${PROJECT_BINARY_DIR}/ucd/14.0/ucd.nounihan.flat.xml ${HEADERS_DIR}/cp_to_name.hpp
COMMAND cat ${PROJECT_SOURCE_DIR}/src/names.hpp >> ${HEADERS_DIR}/cp_to_name.hpp
COMMAND clang-format ${HEADERS_DIR}/cp_to_name.hpp -i
DEPENDS
${PROJECT_BINARY_DIR}/ucd/14.0/ucd.nounihan.flat.xml
${PROJECT_SOURCE_DIR}/src/names.hpp
namesgen
)
add_library(std_ext_uni STATIC
${HEADERS_DIR}/cp_to_name.hpp
${HEADERS_DIR}/name_to_cp.hpp
${HEADERS_DIR}/properties.hpp
src/unicode.cpp
)
add_custom_target("single-header")
add_custom_command(TARGET "single-header"
COMMAND cp ${HEADERS_DIR}* ${PROJECT_SOURCE_DIR}/generated_includes/cedilla/
DEPENDS
include/cedilla/name_to_cp.hpp include/cedilla/cp_to_name.hpp
include/cedilla/properties.hpp
)
target_compile_options(std_ext_uni INTERFACE -std=c++17)
if(MSVC)
target_compile_options(std_ext_uni INTERFACE /W4 /WX)
else()
target_compile_options(std_ext_uni INTERFACE -Wall -Wextra -Werror)
endif()
target_include_directories(std_ext_uni PUBLIC ${PROJECT_BINARY_DIR}/include/)
add_subdirectory(tests)