Skip to content

cmake: keep wx_NEED_NET on for BUILD_WEBSERVER-only configurations - #620

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix/cmake-webserver-wx-net
May 15, 2026
Merged

cmake: keep wx_NEED_NET on for BUILD_WEBSERVER-only configurations#620
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix/cmake-webserver-wx-net

Conversation

@got3nks

@got3nks got3nks commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

A configure with -DBUILD_MONOLITHIC=NO -DBUILD_WEBSERVER=YES (no daemon, no GUI, no wxcas) errors at generate time:

CMake Error at src/webserver/src/CMakeLists.txt:51 (target_link_libraries):
  Target "amuleweb" links to:
    wxWidgets::NET
  but the target was not found.

amuleweb's CMakeLists.txt links wxWidgets::NET directly, and the BUILD_WEBSERVER block in cmake/options.cmake does set(wx_NEED_NET TRUE) to satisfy that. But a sanity-clamp block immediately below it (options.cmake:189-191) resets wx_NEED_NET to FALSE when none of {BUILD_DAEMON, BUILD_MONOLITHIC, BUILD_REMOTEGUI, BUILD_WXCAS} is set — BUILD_WEBSERVER is missing from that list, so the override silently fires and the wxNet target stops being created.

Common workaround for users / CI scripts is to also enable -DBUILD_DAEMON=YES, but that pulls in the entire daemon target chain just to satisfy a wxNet target that should have stayed on.

Fix

One-character change: add BUILD_WEBSERVER to the disjunction so amuleweb-only configures keep the wxNet bindings that the link line already declared.

-if (NOT (BUILD_DAEMON OR BUILD_MONOLITHIC OR BUILD_REMOTEGUI OR BUILD_WXCAS))
+if (NOT (BUILD_DAEMON OR BUILD_MONOLITHIC OR BUILD_REMOTEGUI OR BUILD_WEBSERVER OR BUILD_WXCAS))
 	set (wx_NEED_NET FALSE)
 endif()

(Comment is also updated to reflect that amuleweb is a direct wxNet consumer.)

Validation

macOS arm64, fresh build dir:

cmake -B build-macos -DBUILD_MONOLITHIC=NO -DBUILD_WEBSERVER=YES -DBUILD_TESTING=NO
  • Before: errors at generate time with the missing wxWidgets::NET target.
  • After: configures clean; cmake --build build-macos --target amuleweb produces a working amuleweb binary.

No effect on configurations that enable any of DAEMON / MONOLITHIC / REMOTEGUI / WXCAS — those already set wx_NEED_NET and the new condition is a no-op there.

The post-BUILD_* sanity block in cmake/options.cmake forces wx_NEED_NET
back to FALSE when none of BUILD_DAEMON / BUILD_MONOLITHIC /
BUILD_REMOTEGUI / BUILD_WXCAS is set, overriding the earlier
`set(wx_NEED_NET TRUE)` inside the BUILD_WEBSERVER block. But amuleweb
itself links against wxWidgets::NET unconditionally in
src/webserver/src/CMakeLists.txt, so a webserver-only configure
(cmake -B build -DBUILD_MONOLITHIC=NO -DBUILD_WEBSERVER=YES) errors
out with:

  Target "amuleweb" links to:
    wxWidgets::NET
  but the target was not found.

Common workaround is to also enable BUILD_DAEMON, but that pulls in
the entire daemon target chain just to satisfy a wxNet target that
should have stayed on.

Add BUILD_WEBSERVER to the disjunction so amuleweb-only builds keep
the wxNet bindings the link line already declared.

Verified locally on macOS arm64: cmake -B build-macos
-DBUILD_MONOLITHIC=NO -DBUILD_WEBSERVER=YES -DBUILD_TESTING=NO
configures and builds amuleweb clean (previously errored at generate
time with the missing wxWidgets::NET target).
@mrjimenez
mrjimenez merged commit 1427e14 into amule-project:master May 15, 2026
12 checks passed
@got3nks
got3nks deleted the fix/cmake-webserver-wx-net branch May 15, 2026 18:19
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Jul 27, 2026
…nnect (amule-project#620)

Adding a burst of downloads to a large queue over the remote GUI froze the
GUI for seconds and dripped the new files in at only a few per second
(issue amule-project#615). Selecting ~100 search results for download on a ~10k queue
was the reporter's repro.

CKnownFilesRem::ProcessUpdate() only wrapped the list ctrls in
BeginBatchUpdate()/EndBatchUpdate() for the post-reconnect reconcile
(issue amule-project#444). On an ordinary steady-state poll the batch was never
engaged, so each freshly-added partfile went through
CDownloadListCtrl::AddFile() with the per-item SortList() active: a full
re-sort of the entire list on every insert. For a 10k queue that is
O(n^2 log n) and blocks the GUI event loop, which in turn throttles the
outbound download requests -- hence the ~4/sec drip the reporter saw.

Batch the download list on every non-initial poll: BeginBatchUpdate()
suppresses the per-item sort, and the single SortList() runs once at the
end, and only when the poll actually added a file (downloadListGrew). A
pure in-place stat poll stays sort-free, so the common case pays nothing.
EndBatchUpdate() gains a doSort parameter (default true) to express that.
The cold-boot m_initialUpdate path keeps its own ShowFileList() batching
and is left untouched. The shared-files ctrl batching is unchanged
(reconnect-only), matching its existing behaviour.

Refs amule-project#615
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Jul 27, 2026
amule-project#621)

Downloading a large multi-selection of search results into a big queue
froze the monolithic GUI, the same way amule-project#615 did over the remote GUI --
just on a different, un-batched path.

CSearchListCtrl::DownloadSelected() loops over the selection calling
Search_Add_Download per file. In the monolithic build that notification
runs synchronously on the main thread, so each file's AddFile() fires a
per-item SortList() inline -- a full re-sort of the whole download list
on every insert, O(n^2) on a large queue.

Wrap the selection loop in the download list's BeginBatchUpdate() /
EndBatchUpdate() so the burst collapses into a single sort + repaint,
mirroring the remote GUI's poll path (amule-project#620). Monolithic-only: the remote
GUI's adds arrive later via the download-queue poll, which already
batches, so the code is gated behind #ifndef CLIENT_GUI.
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Jul 27, 2026
…reconnect (amule-project#622)

Companion to amule-project#620/amule-project#621. Adding a burst of freshly-shared files over the
remote GUI -- many downloads completing daemon-side, or a shared folder
added/rescanned on the daemon -- froze the GUI on a large share. amule-project#620
fixed the equivalent download-list case but deliberately left the
shared-files ctrl batched reconnect-only.

CKnownFilesRem::ProcessUpdate() adds each new shared file via
CSharedFilesCtrl::ShowFile() -> AddItemData(), which on this virtual list
does a sorted insert AND rebuilds the entire row index (RebuildRowIndex)
on every call -- O(n) per insert, O(n^2) for a burst on an n-file share.
Unlike the download list, a plain Freeze/deferred-sort batch wouldn't
help, because the per-insert cost is the row-index rebuild, not a sort.

Give the shared-files ctrl the same append-path batching the download
list already uses: during a batch, ShowFile() appends with
AppendItemDataNow() (O(1), and it keeps the row index and item count live
so the interleaved reconcile prune and in-place UpdateItem() stay
correct), and the single SortList() is deferred to EndBatchUpdate(doSort).
The non-batch single-add path is unchanged. ProcessUpdate() now batches
the shared list on every non-initial poll and sorts once at the end only
if the poll added a file (sharedListGrew).

Monolithic is unaffected: its bulk shared paths funnel through the
batched Reload() -> ShowFileList(), and the dir-watcher coalesces bursts
into a single Reload(). Verified by building amule and amulegui.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants