Add boost::random_device to pcg

This commit is contained in:
Nikita Lisitsa 2020-09-23 10:59:42 +03:00
parent 342519003c
commit 06916083bb
3 changed files with 20 additions and 1 deletions

View file

@ -16,6 +16,8 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Cl
list(APPEND PSEMEK_CXX_FLAGS -Wall -Werror -Wextra -pedantic -Wno-narrowing -Wno-sign-compare) list(APPEND PSEMEK_CXX_FLAGS -Wall -Werror -Wextra -pedantic -Wno-narrowing -Wno-sign-compare)
endif() endif()
set(Boost_USE_STATIC_LIBS ON)
add_subdirectory(package) add_subdirectory(package)
add_subdirectory(tools) add_subdirectory(tools)
add_subdirectory(libs) add_subdirectory(libs)

View file

@ -1,6 +1,8 @@
find_package(Boost COMPONENTS random REQUIRED)
file(GLOB_RECURSE PSEMEK_PCG_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "include/*.hpp") file(GLOB_RECURSE PSEMEK_PCG_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "include/*.hpp")
file(GLOB_RECURSE PSEMEK_PCG_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "source/*.cpp") file(GLOB_RECURSE PSEMEK_PCG_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "source/*.cpp")
add_library(psemek-pcg ${PSEMEK_PCG_HEADERS} ${PSEMEK_PCG_SOURCES}) add_library(psemek-pcg ${PSEMEK_PCG_HEADERS} ${PSEMEK_PCG_SOURCES})
target_include_directories(psemek-pcg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories(psemek-pcg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(psemek-pcg PUBLIC psemek-util psemek-geom psemek-gfx) target_link_libraries(psemek-pcg PUBLIC psemek-util psemek-geom psemek-gfx Boost::random)

View file

@ -0,0 +1,15 @@
#pragma once
#include <boost/nondet_random.hpp>
namespace psemek::pcg
{
using random_device = boost::random_device;
// check that random_device::result_type is basically std::uint32_t
static_assert(std::is_integral_v<random_device::result_type>);
static_assert(std::is_unsigned_v<random_device::result_type>);
static_assert(sizeof(random_device::result_type) == 4);
}