Skip to content

fix(cmake): FindLibNoise: correct include dir, support Debian/Ubuntu header layout - #1130

Open
Danux-Be wants to merge 2 commits into
CytopiaTeam:masterfrom
Danux-Be:fix-findlibnoise
Open

fix(cmake): FindLibNoise: correct include dir, support Debian/Ubuntu header layout#1130
Danux-Be wants to merge 2 commits into
CytopiaTeam:masterfrom
Danux-Be:fix-findlibnoise

Conversation

@Danux-Be

Copy link
Copy Markdown
Contributor

Two related fixes to FindLibNoise.cmake, discovered while building the project with distro packages (no Conan):

1. Include dir resolved to the wrong directory

The module searched for noise.h with PATH_SUFFIXES include include/noise …, so LibNoise_INCLUDE_DIR resolved to <prefix>/include/noise. Since the sources include libnoise as <noise/noise.h>, the include dir must be the parent (<prefix>/include). System installs failed at build time (fatal error: noise/noise.h: No such file or directory) unless one passed a manual -DLibNoise_INCLUDE_DIR override.

The module now searches for noise/noise.h with suffix include.

2. Debian/Ubuntu install the headers under libnoise/, not noise/

libnoise-dev (Ubuntu 24.04: 1.0.0+repack-1build1) puts the headers in <prefix>/include/libnoise/. When only that layout is found, the module now creates a noise-compat directory in the build tree with a noise -> <prefix>/include/libnoise symlink, so <noise/noise.h> keeps resolving — zero changes needed in the sources.

Testing

Both layouts verified end-to-end (configure → full build → test suite):

  • Source-style layout (headers at <prefix>/include/noise/): builds, 53/53 tests pass
  • Debian layout (GitHub runner, apt libnoise-dev): green CI including ctest — see run Danux-Be/Cytopia #33274938804 (Build + Test + artifact upload, ~2m30)

The module searched for 'noise.h' with PATH_SUFFIXES 'include/noise',
which resolves to <prefix>/include/noise. Since the sources include
libnoise as <noise/noise.h>, the include dir must be <prefix>/include.

Searching for 'noise/noise.h' with suffix 'include' makes system
installs work without a manual -DLibNoise_INCLUDE_DIR override.
Distro packages install the headers in <prefix>/include/libnoise/ while
the sources include <noise/noise.h> (upstream/Conan layout uses
<prefix>/include/noise/). When only the libnoise/ layout is found, the
find module now creates a noise-compat directory in the build tree with
a 'noise' symlink pointing at the distro folder.

Verified against both layouts: the game and the test suite build with
distro packages (Ubuntu libnoise-dev 1.0.0) and with a source install.
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.

1 participant