Skip to content

Commit

Permalink
[*] 编译参数
Browse files Browse the repository at this point in the history
  • Loading branch information
acgist committed Sep 11, 2024
1 parent a975242 commit 714dfd2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ option(JSON_BuildTests "是否编译JSON测试" OFF)

option(BUILD_SHARED_LIBS "是否编译为共享库" OFF)

message(STATUS "当前模式: ${CMAKE_BUILD_TYPE}")

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html
Expand All @@ -28,12 +26,16 @@ if(CMAKE_HOST_UNIX)
set(CMAKE_C_STANDARD 23)
set(CMAKE_CXX_STANDARD 23)
# https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c2x -Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c2x -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++23 -Wall -Wextra")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-unused-variable -Wno-unused-parameter -O0 -g")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wunused-variable -Wunused-parameter -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++23 -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-unused-variable -Wno-unused-parameter -O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wunused-variable -Wunused-parameter -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-unused-variable -Wno-unused-parameter -O0 -g")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wunused-variable -Wunused-parameter -O3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wunused-variable -Wunused-parameter -O3")
if(BUILD_SHARED_LIBS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
elseif(CMAKE_HOST_WIN32)
if(MSVC)
set(CMAKE_C_STANDARD 17)
Expand All @@ -54,6 +56,10 @@ else()
message(FATAL_ERROR "不支持的系统:${CMAKE_HOST_SYSTEM_NAME}")
endif()

message(STATUS "当前模式: ${CMAKE_BUILD_TYPE}")
message(STATUS "当前C编译参数: ${CMAKE_C_FLAGS}")
message(STATUS "当前C++编译参数: ${CMAKE_CXX_FLAGS}")

add_definitions(-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug/lib)
Expand Down
14 changes: 7 additions & 7 deletions nlp/src/source/PoetizeClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ bool lifuren::PoetizeClient::stop() {
std::unique_ptr<lifuren::PoetizeClient> lifuren::PoetizeClient::getClient(const std::string& client) {
if(client == "poetize-shifo-rnn") {
return std::make_unique<lifuren::ShifoRNNPoetizeClient>();
if(client == "poetize-shimo-rnn") {
} else if(client == "poetize-shimo-rnn") {
return std::make_unique<lifuren::ShimoRNNPoetizeClient>();
if(client == "poetize-shigui-rnn") {
} else if(client == "poetize-shigui-rnn") {
return std::make_unique<lifuren::ShiguiRNNPoetizeClient>();
if(client == "poetize-shixian-rnn") {
} else if(client == "poetize-shixian-rnn") {
return std::make_unique<lifuren::ShixianRNNPoetizeClient>();
if(client == "poetize-shisheng-rnn") {
} else if(client == "poetize-shisheng-rnn") {
return std::make_unique<lifuren::ShishengRNNPoetizeClient>();
if(client == "poetize-lidu-rnn") {
} else if(client == "poetize-lidu-rnn") {
return std::make_unique<lifuren::LiduRNNPoetizeClient>();
if(client == "poetize-suxin-rnn") {
} else if(client == "poetize-suxin-rnn") {
return std::make_unique<lifuren::SuxinRNNPoetizeClient>();
if(client == "poetize-wanyue-rnn") {
} else if(client == "poetize-wanyue-rnn") {
return std::make_unique<lifuren::WanyueRNNPoetizeClient>();
} else {
return nullptr;
Expand Down

0 comments on commit 714dfd2

Please sign in to comment.