Skip to content

Commit

Permalink
Merge pull request #8 from camio/build-conformance-fixes
Browse files Browse the repository at this point in the history
Some modifications for Beman standard conformance
  • Loading branch information
steve-downey authored Oct 18, 2024
2 parents 8f88a5a + eaf89e3 commit 73c351c
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 68 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "papers/wg21"]
path = papers/P2988/wg21
url = https://github.com/mpark/wg21.git
[submodule "extern/googletest"]
path = extern/googletest
url = https://github.com/google/googletest.git
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ cmake_minimum_required(VERSION 3.10)

project(beman_iter_interface VERSION 0.0.0 LANGUAGES CXX)

include(FetchContent)

enable_testing()

set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)

add_subdirectory(extern)
add_subdirectory(src)
add_subdirectory(src/beman/iterator_interface26)
add_subdirectory(examples)

include(GNUInstallDirs)
Expand Down
4 changes: 1 addition & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set(BEMAN_ITERATOR_LIBRARY "beman_iterator")

include(GNUInstallDirs)

# List of all buildable examples.
Expand All @@ -19,7 +17,7 @@ foreach(EXAMPLE ${EXAMPLES})
)

# Link example with the library.
target_link_libraries(${EXAMPLE} "${BEMAN_ITERATOR_LIBRARY}")
target_link_libraries(${EXAMPLE} beman.iterator_interface26)

# Install .
install(
Expand Down
2 changes: 1 addition & 1 deletion examples/sample.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Beman/iterator/iterator_interface.hpp>
#include <beman/iterator_interface26/iterator_interface.hpp>
#include <iostream>

int main() {
Expand Down
16 changes: 15 additions & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
add_subdirectory(googletest EXCLUDE_FROM_ALL)
if(BUILD_TESTING)
# Fetch GoogleTest
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG
f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0
EXCLUDE_FROM_ALL
)
block()
set(INSTALL_GTEST OFF) # Disable GoogleTest installation
set(BUILD_TESTING OFF) # Disable GoogleTest tests
FetchContent_MakeAvailable(googletest)
endblock()
endif()
1 change: 0 additions & 1 deletion extern/googletest
Submodule googletest deleted from 1d17ea
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <type_traits>
#include <iterator>

namespace Beman {
namespace iterator {
namespace beman {
namespace iterator_interface26 {

using std::conditional_t;
using std::convertible_to;
Expand Down
1 change: 0 additions & 1 deletion src/Beman/CMakeLists.txt

This file was deleted.

49 changes: 0 additions & 49 deletions src/Beman/iterator/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/Beman/iterator/iterator_interface.cpp

This file was deleted.

1 change: 0 additions & 1 deletion src/CMakeLists.txt

This file was deleted.

50 changes: 50 additions & 0 deletions src/beman/iterator_interface26/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
add_library(beman.iterator_interface26)
add_library(beman::iterator_interface26 ALIAS beman.iterator_interface26)

target_sources(
beman.iterator_interface26
PRIVATE
iterator_interface.cpp
)

include(GNUInstallDirs)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

target_include_directories(beman.iterator_interface26 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME}> # <prefix>/include/scratch
)

install(
TARGETS beman.iterator_interface26
EXPORT ${TARGETS_EXPORT_NAME}1
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_LOWER_PROJECT_NAME)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME}
FILES_MATCHING PATTERN "*.hpp"
)

target_link_libraries(beman.iterator_interface26)

## Tests
if(BUILD_TESTING)
add_executable(iterator_interface_test "")

target_sources(
iterator_interface_test
PRIVATE
iterator_interface.t.cpp
)

target_link_libraries(iterator_interface_test beman.iterator_interface26)
target_link_libraries(iterator_interface_test GTest::gtest)
target_link_libraries(iterator_interface_test GTest::gtest_main)

include(GoogleTest)
gtest_discover_tests(iterator_interface_test)
endif()
1 change: 1 addition & 0 deletions src/beman/iterator_interface26/iterator_interface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <beman/iterator_interface26/iterator_interface.hpp>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// iterator_interface.t.cpp -*-C++-*-
#include <Beman/iterator/iterator_interface.hpp>
#include <Beman/iterator/iterator_interface.hpp>
#include <beman/iterator_interface26/iterator_interface.hpp>
#include <beman/iterator_interface26/iterator_interface.hpp>

#include <gtest/gtest.h>

#include <ranges>

namespace Beman {
namespace iterator {
namespace beman {
namespace iterator_interface26 {

namespace {} // namespace

Expand Down

0 comments on commit 73c351c

Please sign in to comment.