Skip to content

Commit

Permalink
Simplify core addon linking
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Feb 19, 2024
1 parent b9d0f75 commit d836c5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 49 deletions.
37 changes: 11 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ include(bare)

bare_target(target)

# Prepend the core CMake module directory to ensure that `include(bare)`
# resolves to our overrides when including native addons.
list(PREPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

if(NOT PROJECT_IS_TOP_LEVEL)
# Propagate the new module path upwards so embedders don't have to override
# it themselves.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
endif()

install_node_modules(LOCKFILE)

mirror_drive(
Expand Down Expand Up @@ -200,14 +190,6 @@ target_link_libraries(
utf
)

link_bare_module(bare bare-buffer)
link_bare_module(bare bare-hrtime)
link_bare_module(bare bare-inspect)
link_bare_module(bare bare-module)
link_bare_module(bare bare-os)
link_bare_module(bare bare-timers)
link_bare_module(bare bare-url)

add_library(bare_shared SHARED)

set_target_properties(
Expand Down Expand Up @@ -313,18 +295,21 @@ target_link_libraries(
$<LINK_LIBRARY:WHOLE_ARCHIVE,bare_static>
)

# Now that the `bare_bin` target has been defined, we can statically link any
# required native modules.

link_bare_module(bare bare-buffer)
link_bare_module(bare bare-hrtime)
link_bare_module(bare bare-inspect)
link_bare_module(bare bare-module)
link_bare_module(bare bare-os)
link_bare_module(bare bare-timers)
link_bare_module(bare bare-url)

link_bare_module(bare_bin bare-pipe)
link_bare_module(bare_bin bare-repl)
link_bare_module(bare_bin bare-tty)

install(
TARGETS bare_bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
BUNDLE DESTINATION bin
)

if(PROJECT_IS_TOP_LEVEL)
enable_testing()

Expand Down
23 changes: 0 additions & 23 deletions cmake/bare.cmake

This file was deleted.

0 comments on commit d836c5d

Please sign in to comment.