Extracted StrUtils to a separate target and replaced remaining boost code

dev
Tomasz Kapuściński 2023-08-15 12:25:14 +02:00
parent 1034c2e45c
commit 5b79a4eb38
7 changed files with 20 additions and 8 deletions

View File

@ -166,7 +166,9 @@ target_sources(CBot PRIVATE
)
target_include_directories(CBot PUBLIC src)
target_link_libraries(CBot PRIVATE Boost::headers)
target_link_libraries(CBot PRIVATE
Colobot-Common
)
if(COLOBOT_LINT_BUILD)
add_fake_header_sources("src/CBot" CBot)

View File

@ -23,7 +23,7 @@
#include "CBot/CBotUtils.h"
#include <boost/algorithm/string.hpp>
#include <common/stringutils.h>
namespace CBot
{
@ -253,8 +253,7 @@ bool rStrUpper( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
// but no second parameter
if ( pVar->GetNext() != nullptr ){ ex = CBotErrOverParam ; return true; }
boost::to_upper(s);
s = StrUtils::ToUpper(s);
// puts the value on the stack
pResult->SetValString( s );
@ -276,8 +275,7 @@ bool rStrLower( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
// but no second parameter
if ( pVar->GetNext() != nullptr ){ ex = CBotErrOverParam ; return true; }
boost::to_lower(s);
s = StrUtils::ToLower(s);
// puts the value on the stack
pResult->SetValString( s );

View File

@ -443,6 +443,9 @@ else()
set(COLOBOT_I18N_DIR ${COLOBOT_INSTALL_I18N_DIR})
endif()
# Subdirectory with common implementation
add_subdirectory(colobot-common)
# Add CBot
add_subdirectory(CBot)

View File

@ -0,0 +1,10 @@
add_library(Colobot-Common STATIC)
target_sources(Colobot-Common PRIVATE
src/common/stringutils.cpp
src/common/stringutils.h
)
target_include_directories(Colobot-Common PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
)

View File

@ -89,8 +89,6 @@ add_library(colobotbase STATIC
common/settings.cpp
common/settings.h
common/singleton.h
common/stringutils.cpp
common/stringutils.h
common/timeutils.cpp
common/timeutils.h
common/thread/worker_thread.h
@ -495,6 +493,7 @@ target_include_directories(colobotbase PUBLIC
# Main libraries
target_link_libraries(colobotbase PUBLIC
CBot
Colobot-Common
localename
SDL2::Core
SDL2::Image