Skip to content

Commit d502075

Browse files
committed
fix(CMake): add unity build
1 parent 83d8eae commit d502075

File tree

15 files changed

+426
-189
lines changed

15 files changed

+426
-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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
#include <geode/basic/logger.h>
25+
26+
#undef DEBUG
27+
#undef SDEBUG
28+
#define DEBUG( a ) geode_unused( a );
29+
#define SDEBUG( a ) geode_unused( a );
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
#include <geode/basic/logger.h>
25+
26+
#undef DEBUG
27+
#undef SDEBUG
28+
#define DEBUG( a ) geode::Logger::debug( #a, " = ", a )
29+
#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/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: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
28+
#include <geode/mesh/common.h>
29+
30+
namespace geode
31+
{
32+
FORWARD_DECLARATION_DIMENSION_CLASS( Segment );
33+
FORWARD_DECLARATION_DIMENSION_CLASS( Triangle );
34+
FORWARD_DECLARATION_DIMENSION_CLASS( TetrahedralSolid );
35+
ALIAS_3D( TetrahedralSolid );
36+
class Tetrahedron;
37+
} // namespace geode
38+
39+
namespace geode
40+
{
41+
namespace detail
42+
{
43+
template < index_t dimension >
44+
void save_segment(
45+
const Segment< dimension >& segment, absl::string_view suffix );
46+
47+
template < index_t dimension >
48+
void save_triangle(
49+
const Triangle< dimension >& triangle, absl::string_view suffix );
50+
51+
void opengeode_mesh_api save_tetrahedron(
52+
const Tetrahedron& tetrahedron, absl::string_view suffix );
53+
54+
void opengeode_mesh_api save_tetrahedra(
55+
const TetrahedralSolid3D& solid,
56+
absl::Span< const index_t > ids,
57+
absl::string_view suffix );
58+
} // namespace detail
59+
} // namespace geode
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
#include <geode/model/mixin/core/relationships.h>
30+
31+
namespace geode
32+
{
33+
namespace detail
34+
{
35+
template < typename Filter, typename Iterator >
36+
void next_filtered_internal_iterator( Iterator& iterator )
37+
{
38+
while( iterator.operator!=( iterator )
39+
&& iterator.Relationships::InternalRangeIterator::operator*()
40+
.type()
41+
!= Filter::component_type_static() )
42+
{
43+
iterator.Relationships::InternalRangeIterator::operator++();
44+
}
45+
}
46+
47+
template < typename Filter, typename Iterator >
48+
void next_filtered_embedding_iterator( Iterator& iterator )
49+
{
50+
while(
51+
iterator.operator!=( iterator )
52+
&& iterator.Relationships::EmbeddingRangeIterator::operator*()
53+
.type()
54+
!= Filter::component_type_static() )
55+
{
56+
iterator.Relationships::EmbeddingRangeIterator::operator++();
57+
}
58+
}
59+
60+
template < index_t dimension, typename MeshComponentRange >
61+
BoundingBox< dimension > meshes_bounding_box( MeshComponentRange range )
62+
{
63+
BoundingBox< dimension > box;
64+
for( const auto& component : range )
65+
{
66+
box.add_box( component.mesh().bounding_box() );
67+
}
68+
return box;
69+
}
70+
} // namespace detail
71+
} // 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"

src/geode/mesh/core/geode/geode_regular_grid_solid.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@
3939
namespace
4040
{
4141
static constexpr std::array< std::array< geode::local_index_t, 3 >, 8 >
42-
cell_vertices_translations{ { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 },
43-
{ 1, 1, 0 }, { 0, 0, 1 }, { 1, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 } } };
42+
solid_cell_vertices_translations{ { { 0, 0, 0 }, { 1, 0, 0 },
43+
{ 0, 1, 0 }, { 1, 1, 0 }, { 0, 0, 1 }, { 1, 0, 1 }, { 0, 1, 1 },
44+
{ 1, 1, 1 } } };
4445

4546
// -X +X -Y +Y -Z +Z
4647
static constexpr std::array< std::array< geode::local_index_t, 4 >, 6 >
47-
cell_facet_vertices{ { { 0, 2, 6, 4 }, { 1, 5, 7, 3 }, { 0, 4, 5, 1 },
48-
{ 2, 3, 7, 6 }, { 0, 1, 3, 2 }, { 4, 6, 7, 5 } } };
48+
solid_cell_facet_vertices{ { { 0, 2, 6, 4 }, { 1, 5, 7, 3 },
49+
{ 0, 4, 5, 1 }, { 2, 3, 7, 6 }, { 0, 1, 3, 2 }, { 4, 6, 7, 5 } } };
4950
} // namespace
5051

5152
namespace geode
@@ -81,7 +82,8 @@ namespace geode
8182
for( const auto d : LRange{ 3 } )
8283
{
8384
cell_vertex[d] +=
84-
cell_vertices_translations[polyhedron_vertex.vertex_id][d];
85+
solid_cell_vertices_translations[polyhedron_vertex
86+
.vertex_id][d];
8587
}
8688
return vertex_index( grid, cell_vertex );
8789
}
@@ -91,8 +93,8 @@ namespace geode
9193
{
9294
const auto& facet = polyhedron_facet_vertex.polyhedron_facet;
9395
const auto vertex =
94-
cell_facet_vertices[facet.facet_id]
95-
[polyhedron_facet_vertex.vertex_id];
96+
solid_cell_facet_vertices[facet.facet_id]
97+
[polyhedron_facet_vertex.vertex_id];
9698
return { facet.polyhedron_id, vertex };
9799
}
98100

0 commit comments

Comments
 (0)