Skip to content

Commit c1dbdce

Browse files
authored
Merge pull request #895 from Geode-solutions/fix/unity
fix(CMake): add unity build
2 parents 83d8eae + dca7d0c commit c1dbdce

File tree

16 files changed

+465
-189
lines changed

16 files changed

+465
-189
lines changed

cmake/CppTargets.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function(add_geode_library)
9999
OUTPUT_NAME ${PROJECT_NAME}_${GEODE_LIB_NAME}
100100
DEFINE_SYMBOL ${project_name}_${GEODE_LIB_NAME}_EXPORTS
101101
FOLDER "Libraries"
102+
UNITY_BUILD ON
102103
)
103104
source_group("Public Header Files" FILES "${ABSOLUTE_GEODE_LIB_PUBLIC_HEADERS}")
104105
source_group("Advanced Header Files" FILES "${ABSOLUTE_GEODE_LIB_ADVANCED_HEADERS}")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2019 - 2024 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#undef DEBUG
25+
#undef SDEBUG
26+
#define DEBUG( a ) geode_unused( a );
27+
#define SDEBUG( a ) geode_unused( a );
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2019 - 2024 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#undef DEBUG
25+
#undef SDEBUG
26+
#define DEBUG( a ) geode::Logger::debug( #a, " = ", a )
27+
#define SDEBUG( a ) geode::Logger::debug( #a, " = ", a.string() )

include/geode/basic/logger.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,10 @@ namespace geode
108108
};
109109
} // namespace geode
110110

111-
#define DEBUG( a ) geode::Logger::debug( #a, " = ", a )
112-
#define SDEBUG( a ) geode::Logger::debug( #a, " = ", a.string() )
111+
#include <geode/basic/detail/enable_debug_logger.h>
113112

114113
#ifdef OPENGEODE_DEBUG
115114
# define DEBUG_LOGGER( ... ) geode::Logger::debug( __VA_ARGS__ )
116115
#else
117116
# define DEBUG_LOGGER( ... )
118-
#endif
117+
#endif

include/geode/mesh/core/mesh_element.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#pragma once
2525

26+
#include <absl/algorithm/container.h>
27+
2628
#include <geode/basic/uuid.h>
2729

2830
#include <geode/mesh/common.h>
@@ -82,6 +84,45 @@ namespace geode
8284
{
8385
using MeshElement::MeshElement;
8486
};
87+
88+
template < typename MeshElementType >
89+
struct MeshElementsInclusion
90+
{
91+
MeshElementsInclusion() = default;
92+
93+
absl::Span< const MeshElementType > query;
94+
absl::Span< const MeshElementType > container;
95+
};
96+
97+
struct MeshVerticesInclusion : public MeshElementsInclusion< MeshVertex >
98+
{
99+
using MeshElementsInclusion< MeshVertex >::MeshElementsInclusion;
100+
};
101+
102+
struct MeshEdgesInclusion : public MeshElementsInclusion< MeshEdge >
103+
{
104+
using MeshElementsInclusion< MeshEdge >::MeshElementsInclusion;
105+
};
106+
107+
struct MeshPolygonsInclusion : public MeshElementsInclusion< MeshPolygon >
108+
{
109+
using MeshElementsInclusion< MeshPolygon >::MeshElementsInclusion;
110+
};
111+
112+
template < typename MeshElementType >
113+
bool are_mesh_elements_included(
114+
const MeshElementsInclusion< MeshElementType >& inclusion )
115+
{
116+
for( const auto& q : inclusion.query )
117+
{
118+
if( absl::c_find( inclusion.container, q )
119+
== inclusion.container.end() )
120+
{
121+
return false;
122+
}
123+
}
124+
return true;
125+
}
85126
} // namespace geode
86127

87128
namespace std

include/geode/mesh/helpers/detail/component_identifier.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*
2222
*/
2323

24+
#pragma once
25+
2426
#include <absl/container/fixed_array.h>
2527

2628
#include <geode/basic/pimpl.h>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2019 - 2024 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#pragma once
25+
26+
#include <absl/strings/string_view.h>
27+
#include <absl/types/span.h>
28+
29+
#include <geode/mesh/common.h>
30+
31+
namespace geode
32+
{
33+
FORWARD_DECLARATION_DIMENSION_CLASS( Segment );
34+
FORWARD_DECLARATION_DIMENSION_CLASS( Triangle );
35+
FORWARD_DECLARATION_DIMENSION_CLASS( TetrahedralSolid );
36+
ALIAS_3D( TetrahedralSolid );
37+
class Tetrahedron;
38+
} // namespace geode
39+
40+
namespace geode
41+
{
42+
namespace detail
43+
{
44+
template < index_t dimension >
45+
void save_segment(
46+
const Segment< dimension >& segment, absl::string_view suffix );
47+
48+
template < index_t dimension >
49+
void save_triangle(
50+
const Triangle< dimension >& triangle, absl::string_view suffix );
51+
52+
void opengeode_mesh_api save_tetrahedron(
53+
const Tetrahedron& tetrahedron, absl::string_view suffix );
54+
55+
void opengeode_mesh_api save_tetrahedra(
56+
const TetrahedralSolid3D& solid,
57+
absl::Span< const index_t > indices,
58+
absl::string_view suffix );
59+
} // namespace detail
60+
} // namespace geode
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (c) 2019 - 2024 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#pragma once
25+
26+
#include <geode/geometry/bounding_box.h>
27+
28+
#include <geode/model/common.h>
29+
30+
namespace geode
31+
{
32+
namespace detail
33+
{
34+
template < typename Filter, typename Iterator >
35+
void next_filtered_internal_iterator( Iterator& iterator )
36+
{
37+
while( iterator.operator!=( iterator )
38+
&& iterator.Relationships::InternalRangeIterator::operator*()
39+
.type()
40+
!= Filter::component_type_static() )
41+
{
42+
iterator.Relationships::InternalRangeIterator::operator++();
43+
}
44+
}
45+
46+
template < typename Filter, typename Iterator >
47+
void next_filtered_embedding_iterator( Iterator& iterator )
48+
{
49+
while(
50+
iterator.operator!=( iterator )
51+
&& iterator.Relationships::EmbeddingRangeIterator::operator*()
52+
.type()
53+
!= Filter::component_type_static() )
54+
{
55+
iterator.Relationships::EmbeddingRangeIterator::operator++();
56+
}
57+
}
58+
59+
template < index_t dimension, typename MeshComponentRange >
60+
BoundingBox< dimension > meshes_bounding_box( MeshComponentRange range )
61+
{
62+
BoundingBox< dimension > box;
63+
for( const auto& component : range )
64+
{
65+
box.add_box( component.mesh().bounding_box() );
66+
}
67+
return box;
68+
}
69+
} // namespace detail
70+
} // namespace geode

src/geode/basic/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ add_geode_library(
8787
"zip_file.h"
8888
ADVANCED_HEADERS
8989
"detail/bitsery_archive.h"
90+
"detail/disable_debug_logger.h"
91+
"detail/enable_debug_logger.h"
9092
"detail/geode_input_impl.h"
9193
"detail/geode_output_impl.h"
9294
"detail/mapping_after_deletion.h"

src/geode/mesh/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ add_geode_library(
113113
"helpers/tetrahedral_solid_scalar_function.cpp"
114114
"helpers/triangulated_surface_point_function.cpp"
115115
"helpers/triangulated_surface_scalar_function.cpp"
116+
"helpers/detail/component_identifier.cpp"
116117
"helpers/detail/curve_merger.cpp"
118+
"helpers/detail/debug.cpp"
117119
"helpers/detail/solid_merger.cpp"
118120
"helpers/detail/surface_merger.cpp"
119121
"helpers/detail/vertex_merger.cpp"
120-
"helpers/detail/component_identifier.cpp"
121122
"helpers/private/copy.cpp"
122123
"helpers/private/regular_grid_shape_function.cpp"
123124
"io/edged_curve_input.cpp"
@@ -293,10 +294,11 @@ add_geode_library(
293294
"core/detail/geode_elements.h"
294295
"core/detail/vertex_cycle.h"
295296
"helpers/detail/curve_merger.h"
297+
"helpers/detail/component_identifier.h"
298+
"helpers/detail/debug.h"
296299
"helpers/detail/solid_merger.h"
297300
"helpers/detail/surface_merger.h"
298301
"helpers/detail/vertex_merger.h"
299-
"helpers/detail/component_identifier.h"
300302
PRIVATE_HEADERS
301303
"core/private/edges_impl.h"
302304
"core/private/facet_edges_impl.h"

0 commit comments

Comments
 (0)