Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump requested C++ standard version to C++17 #459

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ set(BITPIT_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "bitpit library name" FORCE)

add_library(${BITPIT_LIBRARY})

target_compile_features(${BITPIT_LIBRARY} PUBLIC cxx_std_11)
set_target_properties(${BITPIT_LIBRARY} PROPERTIES CXX_STANDARD 11)
target_compile_features(${BITPIT_LIBRARY} PUBLIC cxx_std_17)
set_target_properties(${BITPIT_LIBRARY} PROPERTIES CXX_STANDARD 17)
set_target_properties(${BITPIT_LIBRARY} PROPERTIES CXX_STANDARD_REQUIRED ON)

if (BITPIT_ENABLE_MPI)
Expand Down
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ if(BITPIT_BUILD_EXAMPLES)

add_executable(${EXAMPLE_NAME} "${EXAMPLE_SOURCES}")

target_compile_features(${EXAMPLE_NAME} PUBLIC cxx_std_11)
set_target_properties(${EXAMPLE_NAME} PROPERTIES CXX_STANDARD 11)
target_compile_features(${EXAMPLE_NAME} PUBLIC cxx_std_17)
set_target_properties(${EXAMPLE_NAME} PROPERTIES CXX_STANDARD 17)
set_target_properties(${EXAMPLE_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON)

target_link_libraries(${EXAMPLE_NAME} ${BITPIT_LIBRARY})
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ function(configureModule MODULE_NAME)
add_library(${UPPER_MODULE_NAME}_TARGET_OBJECT OBJECT)
target_sources(${UPPER_MODULE_NAME}_TARGET_OBJECT PRIVATE ${${UPPER_MODULE_NAME}_SOURCES})

target_compile_features(${UPPER_MODULE_NAME}_TARGET_OBJECT PUBLIC cxx_std_11)
set_target_properties(${UPPER_MODULE_NAME}_TARGET_OBJECT PROPERTIES CXX_STANDARD 11)
target_compile_features(${UPPER_MODULE_NAME}_TARGET_OBJECT PUBLIC cxx_std_17)
set_target_properties(${UPPER_MODULE_NAME}_TARGET_OBJECT PROPERTIES CXX_STANDARD 17)
set_target_properties(${UPPER_MODULE_NAME}_TARGET_OBJECT PROPERTIES CXX_STANDARD_REQUIRED ON)
set_target_properties(${UPPER_MODULE_NAME}_TARGET_OBJECT PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS})
set_lto_property(${UPPER_MODULE_NAME}_TARGET_OBJECT)
Expand Down
3 changes: 3 additions & 0 deletions src/common/binaryUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ void write(std::ostream &stream, const T &value, size_t size);
template<typename T>
void write(std::ostream &stream, const T *value, size_t size);

template<typename T>
void write(std::ostream &stream, T *value, size_t size);

void write(std::ostream &stream, const std::vector<bool> &container);

void write(std::ostream &stream, const std::string &string);
Expand Down
15 changes: 15 additions & 0 deletions src/common/binaryUtils.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ void write(std::ostream &stream, const T *value, size_t size)
stream.write(reinterpret_cast<const char*>(value), size);
}

/*!
\ingroup common_binary

Write the given data to the specified stream in binary format.

\param stream is the stream to write to
\param value is the data to write
\param size is the size, expressed in bytes, of the data to write
*/
template<typename T>
void write(std::ostream &stream, T *value, size_t size)
{
stream.write(reinterpret_cast<char*>(value), size);
}

/*!
\ingroup common_binary

Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ function(addTest TEST_NAME TEST_TYPE TEST_MODULES TEST_LIBRARIES WORKING_DIRECTO
# Add test target
add_executable(${TEST_TARGET_NAME} "${TEST_NAME}.cpp")

target_compile_features(${TEST_TARGET_NAME} PUBLIC cxx_std_11)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES CXX_STANDARD 11)
target_compile_features(${TEST_TARGET_NAME} PUBLIC cxx_std_17)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES CXX_STANDARD 17)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON)

target_link_libraries(${TEST_TARGET_NAME} ${BITPIT_LIBRARY})
Expand Down