fix warning, make lib shared

v1
Brett 2024-01-08 08:58:14 -05:00
parent 1fed762bf8
commit 8bba4754dc
2 changed files with 12 additions and 10 deletions

View File

@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.5)
set(BLT_VERSION 0.10.1) set(BLT_VERSION 0.10.1)
set(BLT_TEST_VERSION 0.0.1) set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT)
project(BLT VERSION ${BLT_VERSION}) project(BLT VERSION ${BLT_VERSION})
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
@ -79,24 +81,24 @@ message("Profiler Files ${PROFILING_FILES}")
message("Source: ${CMAKE_SOURCE_DIR}") message("Source: ${CMAKE_SOURCE_DIR}")
message("Current Source: ${CMAKE_CURRENT_SOURCE_DIR}") message("Current Source: ${CMAKE_CURRENT_SOURCE_DIR}")
add_library(BLT ${STD_FILES} ${PROFILING_FILES} ${NBT_FILES} ${PARSE_FILES}) add_library(${BLT_TARGET} SHARED ${STD_FILES} ${PROFILING_FILES} ${NBT_FILES} ${PARSE_FILES})
target_include_directories(BLT PUBLIC include/) target_include_directories(${BLT_TARGET} PUBLIC include/)
target_include_directories(BLT PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/config/) target_include_directories(${BLT_TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/config/)
if(${ZLIB_FOUND}) if(${ZLIB_FOUND})
target_link_libraries(BLT PUBLIC ZLIB::ZLIB) target_link_libraries(${BLT_TARGET} PUBLIC ZLIB::ZLIB)
endif() endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap)
message("Including phmap") message("Including phmap")
target_include_directories(BLT PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap) target_include_directories(${BLT_TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap)
endif() endif()
if(MSVC) if(MSVC)
#target_compile_options(BLT PRIVATE /W4) #target_compile_options(${BLT_TARGET} PRIVATE /W4)
else() else()
# perhaps we should warn on unused variables, but BLT will have lots of them. # perhaps we should warn on unused variables, but BLT will have lots of them.
target_compile_options(BLT PRIVATE -Wall -Wextra -Wpedantic) target_compile_options(${BLT_TARGET} PRIVATE -Wall -Wextra -Wpedantic)
target_link_options(BLT PUBLIC -rdynamic) target_link_options(${BLT_TARGET} PUBLIC -rdynamic)
endif() endif()
message("BLT ${CMAKE_PROJECT_VERSION} Successfully included!") message("BLT ${CMAKE_PROJECT_VERSION} Successfully included!")

View File

@ -230,7 +230,7 @@ std::vector<std::string> blt::string::BinaryTreeFormatter::construct()
} }
std::vector<std::string> lines; std::vector<std::string> lines;
size_t lineLength = 0; size_t lineLength = 0;
size_t lastLineLength = 0; //size_t lastLineLength = 0;
const size_t lineHeight = format.verticalPadding * 2 + 3; const size_t lineHeight = format.verticalPadding * 2 + 3;
//std::cout << levels.size() << "\n"; //std::cout << levels.size() << "\n";
const size_t verticalSpacing = const size_t verticalSpacing =
@ -278,7 +278,7 @@ std::vector<std::string> blt::string::BinaryTreeFormatter::construct()
lineLength = std::max(lineLength, v.length()); lineLength = std::max(lineLength, v.length());
lines.push_back(createPadding(padLength) + v); lines.push_back(createPadding(padLength) + v);
maxLineLength = std::max(maxLineLength, lines.back().length()); maxLineLength = std::max(maxLineLength, lines.back().length());
lastLineLength = lines.back().length(); //lastLineLength = lines.back().length();
} }
levels.pop(); levels.pop();
if (!levels.empty()) if (!levels.empty())