Skip to content

Commit

Permalink
Add a "unity" param to add_module
Browse files Browse the repository at this point in the history
* Turns out that target properties don't propagate to dependents the way
  compile definitions and options do.
  • Loading branch information
ximinez committed Jan 9, 2025
1 parent a7f4436 commit 2b12370
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 7 additions & 7 deletions cmake/RippledCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,35 +70,35 @@ include(add_module)
include(target_link_modules)

# Level 01
add_module(xrpl beast)
add_module(xrpl beast ${unity})
target_link_libraries(xrpl.libxrpl.beast PUBLIC
xrpl.imports.main
xrpl.libpb
)

# Level 02
add_module(xrpl basics)
add_module(xrpl basics ${unity})
target_link_libraries(xrpl.libxrpl.basics PUBLIC xrpl.libxrpl.beast)

# Level 03
add_module(xrpl json)
add_module(xrpl json ${unity})
target_link_libraries(xrpl.libxrpl.json PUBLIC xrpl.libxrpl.basics)

add_module(xrpl crypto)
add_module(xrpl crypto ${unity})
target_link_libraries(xrpl.libxrpl.crypto PUBLIC xrpl.libxrpl.basics)

# Level 04
add_module(xrpl protocol)
add_module(xrpl protocol ${unity})
target_link_libraries(xrpl.libxrpl.protocol PUBLIC
xrpl.libxrpl.crypto
xrpl.libxrpl.json
)

# Level 05
add_module(xrpl resource)
add_module(xrpl resource ${unity})
target_link_libraries(xrpl.libxrpl.resource PUBLIC xrpl.libxrpl.protocol)

add_module(xrpl server)
add_module(xrpl server ${unity})
target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol)


Expand Down
9 changes: 6 additions & 3 deletions cmake/add_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ include(isolate_headers)
# that cannot include headers from other directories in include/
# unless they come through linked libraries.
#
# add_module(parent a)
# add_module(parent b)
# add_module(parent a true)
# add_module(parent b false)
# target_link_libraries(project.libparent.b PUBLIC project.libparent.a)
function(add_module parent name)
function(add_module parent name unity)
set(target ${PROJECT_NAME}.lib${parent}.${name})
add_library(${target} OBJECT)
if(unity)
set_target_properties(${target} PROPERTIES UNITY_BUILD ON)
endif()
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}/*.cpp"
)
Expand Down

0 comments on commit 2b12370

Please sign in to comment.