Skip to content

Commit

Permalink
Move to a merged source and test directory layout
Browse files Browse the repository at this point in the history
  • Loading branch information
BurningEnlightenment committed Feb 18, 2022
1 parent d4a997a commit 16c43ab
Show file tree
Hide file tree
Showing 24 changed files with 131 additions and 31 deletions.
60 changes: 35 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,39 +100,17 @@ add_library(Deeplex::concrete ALIAS concrete)
target_link_libraries(concrete INTERFACE Deeplex::concrete_compiler_settings)

target_include_directories(concrete INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external/predef/include>
$<INSTALL_INTERFACE:include>
)

set(CNCR_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/dplx")
foreach (header IN ITEMS
cncr/bit.hpp
cncr/misc.hpp
cncr/mp_lite.hpp
cncr/pack_utils.hpp
cncr/windows-proper.h
cncr/workaround.h
overloaded.hpp
predef/workaround.h
scope_guard.hpp
)
target_sources(concrete INTERFACE $<BUILD_INTERFACE:${CNCR_INC_DIR}/${header}>)
endforeach()


########################################################################
# library test project
if (BUILD_TESTING)
add_executable(concrete-tests)
set_target_properties(concrete-tests PROPERTIES
OUTPUT_NAME concrete-tests-$<CONFIG>
)
target_sources(concrete-tests PRIVATE
tests/test_utils.hpp

tests/misc.test.cpp
tests/pack_utils.test.cpp
src/cncr_tests/test_utils.hpp
)

target_link_libraries(concrete-tests PRIVATE
Expand All @@ -141,9 +119,37 @@ if (BUILD_TESTING)
Catch2::Catch2 Catch2::Catch2WithMain
)

target_include_directories(concrete-tests PRIVATE
scr/cncr_tests
)

add_test(NAME concrete-tests COMMAND concrete-tests)
endif()

########################################################################
# source files
set(CNCR_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/dplx")
foreach (header IN ITEMS
cncr/bit.hpp
cncr/misc.hpp
cncr/mp_lite.hpp
cncr/pack_utils.hpp
cncr/windows-proper.h
cncr/workaround.h
overloaded.hpp
predef/workaround.h
scope_guard.hpp
)
set(_HDR_PATH ${CNCR_INC_DIR}/${header})
list(APPEND CNCR_HDRS $<BUILD_INTERFACE:${_HDR_PATH}>)
get_filename_component(_HDR_NAME ${_HDR_PATH} NAME_WLE)
get_filename_component(_HDR_DIR ${_HDR_PATH} DIRECTORY)
list(APPEND CNCR_TEST_SRCS ${_HDR_DIR}/${_HDR_NAME}.test.cpp)
endforeach()
target_sources(concrete INTERFACE ${CNCR_HDRS})
target_sources(concrete-tests PRIVATE ${CNCR_TEST_SRCS})


########################################################################
# docs
if (BUILD_DOCS)
Expand All @@ -152,7 +158,11 @@ endif()

########################################################################
# cmake install
install(DIRECTORY include/ TYPE INCLUDE)
install(DIRECTORY src/dplx
TYPE INCLUDE
FILES_MATCHING
REGEX ".*\\.h(pp)?"
)
install(DIRECTORY external/predef/include/ TYPE INCLUDE)

install(TARGETS concrete compiler_settings EXPORT concrete-targets)
Expand Down
6 changes: 5 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_TESTING": true,
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/zinstall"
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/zinstall",
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
}
}
},
{
Expand Down
1 change: 0 additions & 1 deletion external/predef/include/dplx/predef/other.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ Distributed under the Boost Software License, Version 1.0.

#include <dplx/predef/other/endian.h>
#include <dplx/predef/other/wordsize.h>
#include <dplx/predef/other/workaround.h>

#endif
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/dplx/cncr/bit.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/cncr/bit.hpp"
File renamed without changes.
3 changes: 1 addition & 2 deletions tests/misc.test.cpp → src/dplx/cncr/misc.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/cncr/misc.hpp"
#include "dplx/cncr/mp_lite.hpp"

#include <catch2/catch.hpp>

#include "test_utils.hpp"
#include "cncr_tests/test_utils.hpp"

namespace cncr_tests
{
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions src/dplx/cncr/mp_lite.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/cncr/mp_lite.hpp"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// Copyright Henrik Steffen Gaßmann 2019
// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
Expand All @@ -9,7 +9,7 @@

#include <catch2/catch.hpp>

#include "test_utils.hpp"
#include "cncr_tests/test_utils.hpp"

namespace cncr_tests
{
Expand Down
24 changes: 24 additions & 0 deletions src/dplx/cncr/type_utils.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

// Copyright Henrik Steffen Gaßmann 2020.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#pragma once

#include <type_traits>

namespace dplx::cncr
{

template <typename T>
struct remove_cref
{
using type = typename std::remove_const<
typename std::remove_reference<T>::type>::type;
};
template <typename T>
using remove_cref_t = typename remove_cref<T>::type;

} // namespace dplx::cncr
8 changes: 8 additions & 0 deletions src/dplx/cncr/type_utils.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/cncr/type_utils.hpp"
File renamed without changes.
8 changes: 8 additions & 0 deletions src/dplx/cncr/windows-proper.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/cncr/windows-proper.h"
File renamed without changes.
8 changes: 8 additions & 0 deletions src/dplx/cncr/workaround.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/cncr/workaround.h"
File renamed without changes.
8 changes: 8 additions & 0 deletions src/dplx/overloaded.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/overloaded.hpp"
File renamed without changes.
8 changes: 8 additions & 0 deletions src/dplx/predef/workaround.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/predef/workaround.h"
File renamed without changes.
8 changes: 8 additions & 0 deletions src/dplx/scope_guard.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Copyright Henrik Steffen Gaßmann 2022
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)

#include "dplx/scope_guard.hpp"

0 comments on commit 16c43ab

Please sign in to comment.