Skip to content

Commit

Permalink
Merge pull request #487 from yamacir-kit/cxx20
Browse files Browse the repository at this point in the history
C++20
  • Loading branch information
yamacir-kit authored Nov 14, 2024
2 parents 1df8013 + 7a8fa9b commit fe5ec77
Show file tree
Hide file tree
Showing 137 changed files with 346 additions and 793 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
compiler: [ g++, clang++ ]
configuration: [ Debug, Release ]
system: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-14 ]
system: [ ubuntu-22.04, ubuntu-24.04, macos-14 ]
steps:
- uses: actions/checkout@v3
- run: ./script/setup-${{ matrix.system }}.sh --all
Expand Down
14 changes: 2 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16.3) # Ubuntu 20.04 LTS default
cmake_minimum_required(VERSION 3.22.1) # Ubuntu 22.04 LTS default

execute_process(
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/VERSION
Expand All @@ -25,7 +25,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "-Og -gdwarf-4") # NOTE: The `-gdwarf-4` option is set
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -DNDEBUG ${${PROJECT_NAME}_RELEASE_PLUS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-4")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand All @@ -38,16 +38,6 @@ endif()

# ---- CONFIGURE ---------------------------------------------------------------

include(TestBigEndian)

TEST_BIG_ENDIAN(IS_BIG_ENDIAN) # Use CMAKE_CXX_BYTE_ORDER if CMake >= 3.20

if(${IS_BIG_ENDIAN})
set(${PROJECT_NAME}_BYTE_ORDER "big-endian")
else()
set(${PROJECT_NAME}_BYTE_ORDER "little-endian")
endif()

execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/unicode.sh --digit-value OUTPUT_VARIABLE ${PROJECT_NAME}_UNICODE_DIGIT_VALUE)
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/unicode.sh --downcase OUTPUT_VARIABLE ${PROJECT_NAME}_UNICODE_DOWNCASE)
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/unicode.sh --property OUTPUT_VARIABLE ${PROJECT_NAME}_UNICODE_PROPERTY)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ Procedures for each standard are provided by the following R7RS-style libraries:

### Requirements

- [GCC](https://gcc.gnu.org/) (>= 9.4.0) or [Clang](https://clang.llvm.org/) (>= 11.0.0)
- [CMake](https://cmake.org/) (>= 3.16.3)
- [GCC](https://gcc.gnu.org/) (>= 11.4.0) or [Clang](https://clang.llvm.org/) (>= 14.0.0)
- [CMake](https://cmake.org/) (>= 3.22.1)
- [GNU Make](http://savannah.gnu.org/projects/make)
- [GNU Binutils](https://www.gnu.org/software/binutils/)
- [GNU Multiple Precision Arithmetic Library (GMP)](https://gmplib.org/)
Expand All @@ -90,7 +90,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.262_amd64.deb
sudo apt install build/meevax_0.5.270_amd64.deb
```

or
Expand Down Expand Up @@ -122,9 +122,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.262.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.270.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.262_amd64.deb`
| `package` | Generate debian package `meevax_0.5.270_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.262
0.5.270
2 changes: 1 addition & 1 deletion configure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:

### Requirements

- [GCC](https://gcc.gnu.org/) (>= 9.4.0) or [Clang](https://clang.llvm.org/) (>= 11.0.0)
- [GCC](https://gcc.gnu.org/) (>= 11.4.0) or [Clang](https://clang.llvm.org/) (>= 14.0.0)
- [CMake](https://cmake.org/) (>= ${CMAKE_MINIMUM_REQUIRED_VERSION})
- [GNU Make](http://savannah.gnu.org/projects/make)
- [GNU Binutils](https://www.gnu.org/software/binutils/)
Expand Down
9 changes: 3 additions & 6 deletions configure/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include <meevax/kernel/version.hpp>
#include <meevax/memory/model.hpp>

namespace meevax
{
inline namespace kernel
namespace meevax::inline kernel
{
auto help() noexcept -> std::string_view
{
Expand All @@ -39,7 +37,7 @@ inline namespace kernel
make_symbol("${${PROJECT_NAME}_SYSTEM_NAME}"),
make_symbol("${CMAKE_SYSTEM_PROCESSOR}"),
make_symbol(memory::model::name()),
make_symbol("${${PROJECT_NAME}_BYTE_ORDER}"),
make_symbol(std::endian::native == std::endian::little ? "little-endian" : "big-endian"),
make_symbol("${PROJECT_NAME}"),
make_symbol("${PROJECT_NAME}-${PROJECT_VERSION}"));

Expand All @@ -51,5 +49,4 @@ inline namespace kernel
let static const version = make_symbol("${PROJECT_VERSION}");
return version;
}
} // namespace kernel
} // namespace meevax
} // namespace meevax::kernel
4 changes: 2 additions & 2 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.16.3) # Ubuntu 20.04 LTS default
cmake_minimum_required(VERSION 3.22.1) # Ubuntu 22.04 LTS default

project(example VERSION 0.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

find_package(Meevax REQUIRED) # NOTE: case-insensitive

Expand Down
42 changes: 0 additions & 42 deletions include/meevax/bit/bit_cast.hpp

This file was deleted.

41 changes: 0 additions & 41 deletions include/meevax/bit/log2.hpp

This file was deleted.

7 changes: 2 additions & 5 deletions include/meevax/bitset/simple_bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
#include <array>
#include <bitset>

namespace meevax
{
inline namespace bitset
namespace meevax::inline bitset
{
template <auto N>
struct simple_bitset : public std::array<bool, N>
Expand All @@ -46,7 +44,6 @@ inline namespace bitset
return (*this)[i];
}
};
} // namespace bitset
} // namespace meevax
} // namespace meevax::bitset

#endif // INCLUDED_MEEVAX_BITSET_SIMPLE_BITSET_HPP
7 changes: 2 additions & 5 deletions include/meevax/chrono/duration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
#include <chrono>
#include <iostream>

namespace meevax
{
inline namespace chrono
namespace meevax::inline chrono
{
using days = std::chrono::duration<std::size_t, std::ratio_multiply<std::ratio<24>, std::chrono::hours::period>>;

Expand All @@ -39,7 +37,6 @@ inline namespace chrono
}

auto operator <<(std::ostream &, std::chrono::nanoseconds) -> std::ostream &;
} // namespace chrono
} // namespace meevax
} // namespace meevax::chrono

#endif // INCLUDED_MEEVAX_CHRONO_DURATION_HPP
7 changes: 2 additions & 5 deletions include/meevax/functional/combinator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

#include <meevax/functional/curry.hpp>

namespace meevax
{
inline namespace functional
namespace meevax::inline functional
{
inline auto i = [](auto&& x) constexpr
{
Expand All @@ -41,7 +39,6 @@ inline namespace functional
return curry(std::forward<decltype(f)>(f))
(std::forward<decltype(f)>(f));
};
} // namespace functional
} // namespace meevax
} // namespace meevax::functional

#endif // INCLUDED_MEEVAX_FUNCTIONAL_COMBINATOR_HPP
7 changes: 2 additions & 5 deletions include/meevax/functional/compose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
#include <tuple>
#include <utility>

namespace meevax
{
inline namespace functional
namespace meevax::inline functional
{
inline auto compose = [](auto&& f, auto&& g) constexpr
{
Expand All @@ -31,7 +29,6 @@ inline namespace functional
return std::get<0>(fs)(std::get<1>(fs)(std::forward<decltype(xs)>(xs)...));
};
};
} // namespace functional
} // namespace meevax
} // namespace meevax::functional

#endif // INCLUDED_MEEVAX_FUNCTIONAL_COMPOSE_HPP
7 changes: 2 additions & 5 deletions include/meevax/functional/curry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
#include <tuple>
#include <utility>

namespace meevax
{
inline namespace functional
namespace meevax::inline functional
{
template <typename F>
constexpr auto curry(F&& f) -> decltype(auto)
Expand All @@ -39,7 +37,6 @@ inline namespace functional
};
};
}
} // namespace functional
} // namespace meevax
} // namespace meevax::functional

#endif // INCLUDED_MEEVAX_FUNCTIONAL_CURRY_HPP
7 changes: 2 additions & 5 deletions include/meevax/iostream/escape_sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include <meevax/iostream/is_console.hpp>
#include <meevax/utility/unwrap_reference_wrapper.hpp>

namespace meevax
{
inline namespace iostream
namespace meevax::inline iostream
{
template <typename... Ts>
struct escape_sequence
Expand Down Expand Up @@ -110,7 +108,6 @@ inline namespace iostream
}

#undef DEFINE
} // namespace iostream
} // namespace meevax
} // namespace meevax::iostream

#endif // INCLUDED_MEEVAX_IOSTREAM_ESCAPE_SEQUENCE_HPP
7 changes: 2 additions & 5 deletions include/meevax/iostream/is_console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

#include <unistd.h>

namespace meevax
{
inline namespace iostream
namespace meevax::inline iostream
{
inline auto is_console = [](std::ostream & os)
{
Expand All @@ -42,7 +40,6 @@ inline namespace iostream
return false;
}
};
} // namespace iostream
} // namespace meevax
} // namespace meevax::iostream

#endif // INCLUDED_MEEVAX_IOSTREAM_IS_CONSOLE_HPP
7 changes: 2 additions & 5 deletions include/meevax/iostream/lexical_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include <stdexcept>
#include <typeinfo>

namespace meevax
{
inline namespace iostream
namespace meevax::inline iostream
{
template <typename To, typename... Ts>
auto lexical_cast(Ts&&... xs) -> To
Expand Down Expand Up @@ -55,7 +53,6 @@ inline namespace iostream
throw std::runtime_error(what.str());
}
}
} // namespace iostream
} // namespace meevax
} // namespace meevax::iostream

#endif // INCLUDED_MEEVAX_IOSTREAM_LEXICAL_CAST_HPP
7 changes: 2 additions & 5 deletions include/meevax/iterator/index_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
#include <memory>
#include <type_traits>

namespace meevax
{
inline namespace iterator
namespace meevax::inline iterator
{
template <typename T>
struct index_iterator
Expand Down Expand Up @@ -111,7 +109,6 @@ inline namespace iterator
return not (a == b);
}
};
} // namespace iterator
} // namespace meevax
} // namespace meevax::iterator

#endif // INCLUDED_MEEVAX_ITERATOR_INDEX_ITERATOR_HPP
Loading

0 comments on commit fe5ec77

Please sign in to comment.