2024-12-08 23:33:57 +08:00
|
|
|
cmake_minimum_required(VERSION 3.23)
|
2023-07-13 22:12:02 +08:00
|
|
|
project(NlpCodec LANGUAGES CXX)
|
2023-06-26 22:00:10 +08:00
|
|
|
|
2024-12-08 23:33:57 +08:00
|
|
|
# Find ZLib packages
|
2023-06-26 22:00:10 +08:00
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
|
2024-12-08 23:33:57 +08:00
|
|
|
# Build executable
|
|
|
|
add_executable(NlpCodec "")
|
|
|
|
# Setup sources file and no need to setup headers
|
|
|
|
target_sources(NlpCodec
|
|
|
|
PRIVATE
|
|
|
|
NlpCodec.cpp
|
|
|
|
)
|
|
|
|
# Link with ZLib
|
2023-07-13 22:12:02 +08:00
|
|
|
target_link_libraries(NlpCodec
|
2023-06-26 22:00:10 +08:00
|
|
|
PRIVATE
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
)
|
2024-12-08 23:33:57 +08:00
|
|
|
# Setup standard
|
|
|
|
set_target_properties(NlpCodec
|
|
|
|
PROPERTIES
|
|
|
|
CXX_STANDARD 20
|
|
|
|
CXX_STANDARD_REQUIRED 20
|
|
|
|
CXX_EXTENSION OFF
|
|
|
|
)
|
|
|
|
|
|
|
|
# Extra options for MSVC
|
|
|
|
# Unicode charset
|
|
|
|
target_compile_definitions(NlpCodec
|
|
|
|
PRIVATE
|
|
|
|
$<$<CXX_COMPILER_ID:MSVC>:UNICODE>
|
|
|
|
$<$<CXX_COMPILER_ID:MSVC>:_UNICODE>
|
|
|
|
)
|
|
|
|
# Order UTF-8 in both runtime and source environment
|
|
|
|
target_compile_options(NlpCodec
|
2023-06-26 22:00:10 +08:00
|
|
|
PRIVATE
|
2024-12-08 23:33:57 +08:00
|
|
|
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
2023-06-26 22:00:10 +08:00
|
|
|
)
|
2024-12-08 23:33:57 +08:00
|
|
|
|
|
|
|
# Install built artifact
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
install(TARGETS NlpCodec
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
)
|
|
|
|
|