chore: update CMakeLists.txt

- update CMakeLists.txt. Add an option to disable the generation of testbench.
- rename testbench name to YYCCTestbench.
- allow emoji test in code.
This commit is contained in:
yyc12345 2024-06-06 13:16:55 +08:00
parent 642db411f5
commit 019034a9c2
3 changed files with 15 additions and 10 deletions

View File

@ -4,9 +4,14 @@ project(YYCC
LANGUAGES CXX LANGUAGES CXX
) )
# Provide options
option(YYCC_BUILD_TESTBENCH "Build testbench of YYCCommonplace." OFF)
# Import 2 build targets # Import 2 build targets
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(testbench) if (YYCC_BUILD_TESTBENCH)
add_subdirectory(testbench)
endif ()
# Install project package infos # Install project package infos
# Package target # Package target

View File

@ -1,35 +1,35 @@
# Create executable testbench # Create executable testbench
add_executable(Testbench "") add_executable(YYCCTestbench "")
# Setup testbench sources # Setup testbench sources
target_sources(Testbench target_sources(YYCCTestbench
PRIVATE PRIVATE
${CMAKE_CURRENT_LIST_DIR}/main.cpp ${CMAKE_CURRENT_LIST_DIR}/main.cpp
) )
# Add YYCC as its library # Add YYCC as its library
target_include_directories(Testbench target_include_directories(YYCCTestbench
PRIVATE PRIVATE
YYCCommonplace YYCCommonplace
) )
target_link_libraries(Testbench target_link_libraries(YYCCTestbench
PRIVATE PRIVATE
YYCCommonplace YYCCommonplace
) )
# Setup C++ standard # Setup C++ standard
set_target_properties(Testbench set_target_properties(YYCCTestbench
PROPERTIES PROPERTIES
CXX_STANDARD 17 CXX_STANDARD 17
CXX_STANDARD_REQUIRED 17 CXX_STANDARD_REQUIRED 17
CXX_EXTENSION OFF CXX_EXTENSION OFF
) )
# Order build as UTF-8 in MSVC # Order build as UTF-8 in MSVC
target_compile_options(Testbench target_compile_options(YYCCTestbench
PRIVATE PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/utf-8> $<$<CXX_COMPILER_ID:MSVC>:/utf-8>
) )
# Install binary # Install binary
install(TARGETS Testbench install(TARGETS YYCCTestbench
EXPORT TestbenchTargets EXPORT YYCCTestbenchTargets
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin RUNTIME DESTINATION bin

View File

@ -29,7 +29,7 @@ namespace Testbench {
"fran\u00E7ais langue \u00E9trang\u00E8re", // FRANCE "fran\u00E7ais langue \u00E9trang\u00E8re", // FRANCE
"ma\u00F1ana ol\u00E9", // SPAIN "ma\u00F1ana ol\u00E9", // SPAIN
"\u222E E\u22C5da = Q, n \u2192 \u221E, \u2211 f(i) = \u220F g(i)", // MATHMATICS "\u222E E\u22C5da = Q, n \u2192 \u221E, \u2211 f(i) = \u220F g(i)", // MATHMATICS
//"\xF0\x9F\x8D\xA3 \xE2\x9C\x96 \xF0\x9F\x8D\xBA", // EMOJI "\xF0\x9F\x8D\xA3 \xE2\x9C\x96 \xF0\x9F\x8D\xBA", // EMOJI
}; };
for (const auto* ptr : c_TestStrings) { for (const auto* ptr : c_TestStrings) {
YYCC::ConsoleHelper::FPrintf(stdout, "\t%s\n", ptr); YYCC::ConsoleHelper::FPrintf(stdout, "\t%s\n", ptr);