Remove most of boost usage

This commit is contained in:
Miodrag Milanovic 2025-10-22 15:27:22 +02:00
parent e5df2fd309
commit fffdc6610c
6 changed files with 13 additions and 22 deletions

View File

@ -8,7 +8,8 @@ option(STATIC_BUILD "Create static build of GateMate tools" ON)
set(PROGRAM_PREFIX "" CACHE STRING "Name prefix for executables")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -bigobj -EHsc")
else()
@ -31,7 +32,6 @@ else()
endif()
endif()
if (WASI)
set(USE_THREADS OFF)
add_definitions(
-DBOOST_EXCEPTION_DISABLE
-DBOOST_NO_EXCEPTIONS
@ -40,15 +40,8 @@ if (WASI)
-DBOOST_NO_CXX11_HDR_MUTEX
-DBOOST_NO_CXX11_HDR_ATOMIC
)
else()
set(USE_THREADS ON)
endif()
set(boost_libs filesystem program_options system)
if (USE_THREADS)
list(APPEND boost_libs thread)
else()
add_definitions(-DNO_THREADS)
endif()
set(boost_libs program_options)
find_package(Boost REQUIRED COMPONENTS ${boost_libs})

View File

@ -24,7 +24,6 @@
#include <iostream>
#include <memory>
#include <boost/optional.hpp>
#include <map>
#include <stdexcept>
#include <string>

View File

@ -20,7 +20,8 @@
#ifndef LIBGATEMATE_UTIL_HPP
#define LIBGATEMATE_UTIL_HPP
#include <boost/range/adaptor/reversed.hpp>
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iomanip>
#include <sstream>
@ -50,8 +51,8 @@ inline uint32_t parse_uint32(std::string str) { return uint32_t(strtoul(str.c_st
inline std::string to_string(const std::vector<bool> &bv)
{
std::ostringstream os;
for (auto bit : boost::adaptors::reverse(bv))
os << (bit ? '1' : '0');
for (auto it = bv.rbegin(); it != bv.rend(); ++it)
os << (*it ? '1' : '0');
return os.str();
}
@ -60,7 +61,8 @@ inline std::istream &operator>>(std::istream &in, std::vector<bool> &bv)
bv.clear();
std::string s;
in >> s;
for (auto c : boost::adaptors::reverse(s)) {
for (auto it = s.rbegin(); it != s.rend(); ++it) {
char c = *it;
assert((c == '0') || (c == '1'));
bv.push_back((c == '1'));
}

View File

@ -19,8 +19,6 @@
#include "Bitstream.hpp"
#include <bitset>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/optional.hpp>
#include <cstring>
#include <iostream>
#include "Chip.hpp"

View File

@ -17,8 +17,8 @@
*
*/
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
if (vm.count("help")) {
help:
boost::filesystem::path path(argv[0]);
std::filesystem::path path(argv[0]);
std::cerr << "Open Source Tools for GateMate FPGAs Version " << git_describe_str << std::endl;
std::cerr << "Copyright (C) 2024 The Project Peppercorn Authors" << std::endl;
std::cerr << std::endl;

View File

@ -17,9 +17,8 @@
*
*/
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
#include <boost/program_options.hpp>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <stdexcept>
@ -58,7 +57,7 @@ int main(int argc, char *argv[])
if (vm.count("help")) {
help:
boost::filesystem::path path(argv[0]);
std::filesystem::path path(argv[0]);
std::cerr << "Open Source Tools for GateMate FPGAs Version " << git_describe_str << std::endl;
std::cerr << "Copyright (C) 2024 The Project Peppercorn Authors" << std::endl;
std::cerr << std::endl;