Commit Graph
18 Commits
Author SHA1 Message Date
Oliver Hamlet 81388873da Add bits for cross-compiling to Windows using MinGW
Some tests have been updated because UTF-8 is used as the native
path encoding with MinGW/Wine, unlike MSVC/Windows.

Some of the tests fail:

- 4 Rust tests fail because long paths are not enabled and so the
  paths used when creating symlinks and junction paths are too
  long. I've tested them with x86_64-pc-windows-gnu and
  x86_64-pc-windows-gnullvm, and both see the same behaviour. The
  tests pass when the MinGW-built executable is run on Windows, so
  this is a Wine limitation.
- 12 C++ tests fail because directory symlink creation is not
  implemented. They fail whether the MinGW-built executable is run
  in Wine or on Windows, so this is a MinGW limitation.
- 1 C++ filesystem test fails because long paths are not enabled.

The failing tests are skipped at runtime when built with MinGW,
aside from the one test for long paths being enabled, which expects
them to be disabled when built with MinGW.

If long paths are enabled, e.g. by running

wine reg add HKLM\\System\\CurrentControlSet\\Control\\Filesystem /v LongPathsEnabled /t REG_DWORD /d 1 /f

then many more tests fail because the C++ tests create long paths
when that Registry value is set, but it doesn't seem to actually
enable long path support in Wine, so various filesystem operations
fail.
2026-02-03 08:52:23 +00:00
Oliver Hamlet c6c3056d35 Move where Windows libraries are linked
To where they're actually used. The tests don't need them, and MinGW complains if they aren't linked to the first layer of the C++ wrapper.
2026-01-31 15:29:33 +00:00
Oliver Hamlet c322e27e1e Rename CMake target from loot to libloot
On Windows using "loot" causes a name collisions with LOOT itself:

- for the MSVC project name, it clashes with LOOT's own project,
  despite the difference in case. This means that you can't build LOOT
  in Visual Studio when using FetchContent to handle the libloot
  dependency (running CMake on the CLI works though).
- for the PDB file, LOOT has LOOT.pdb and libloot has loot.pdb, which
  appear to be the same due to file paths being case-insensitive. This
  makes it more difficult to debug LOOT with the relevant debug info
  loaded.

Renaming the CMake target adds a "lib" prefix to the Visual Studio
project name and the artifact filenames:

- loot.vcxproj* -> libloot.vcxproj*
- loot.dll -> libloot.dll
- loot.lib -> libloot.lib
- loot.pdb -> libloot.pdb

The Linux build artifact filenames are unchanged, as they already had
the "lib" prefix.
2026-01-02 13:16:46 +00:00
Oliver Hamlet 86ff2a665b Improve CMake system and compiler checks 2025-11-02 19:54:16 +00:00
Oliver Hamlet 961642ad6e Avoid setting CMAKE_* variables globally
Instead set their target-specific equivalents.

The POSITION_INDEPENDENT_CODE property isn't set because it already defaults to ON for shared libraries.
2025-10-03 17:41:33 +01:00
Oliver Hamlet 6bc6113bb7 Test with long paths on Windows
Long paths can be greater than 260 characters long, but each path component is still limited to 255 characters. The latter is also commonly the component length limit on Linux.

Support for long paths requires Windows 10 1607 or later and a Registry value to be set[1], so to make the cause of test failures clearer when that isn't the case, there's one test that checks that Registry value is set, and long paths are not used in the other tests if it isn't set, so only that one test should failed if the system isn't configured as expected.

GitHub Action's Windows runners do have the Registry value set[2].

This doesn't set the manifest for the Rust tests because it seems to be very difficult to set a manifest for only the tests, and it's not worth the effort when the only tests that fail are those that try to create a symlink, especially since those cases are also covered by the C++ tests.

[1]: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later
[2]: https://github.com/actions/runner-images/blob/releases/win22/20250921/images/windows/scripts/build/Configure-BaseImage.ps1#L73
2025-09-28 13:41:04 +01:00
Oliver Hamlet 2b59b6f76a Set /MP for specific CMake targets
So that libloot doesn't override the global setting if included as a dependency.
2025-08-01 18:19:48 +01:00
Oliver Hamlet b492e34ab9 Fix linking tests against static libloot 2025-07-23 19:11:07 +01:00
Oliver Hamlet fdd84b11b8 Fix using libloot through CMake's FetchContent
- Use PROJECT_SOURCE_DIR and PROJECT_BUILD_DIR instead of CMAKE_SOURCE_DIR and CMAKE_BUILD_DIR because libloot's CMakeLists.txt may not be the top-level one.
- Specify the working directory when calling cargo
- Define an alias and export the loot target so that it's usable without installing the built artifacts first
2025-07-23 18:20:57 +01:00
Oliver Hamlet b6d9cb0d9e Remove the libloot_internals_tests target
Move its tests to libloot_tests, as there's nothing in the internals that can't be just as easily tested through the public API.
2025-07-22 19:56:21 +01:00
Oliver Hamlet 155fce02be Match the order of compile options in C++ libloot 2025-06-08 20:26:08 +01:00
Oliver Hamlet 2d846d17e9 Fix indentation in CMake file 2025-06-08 20:26:08 +01:00
Oliver Hamlet 180196f395 Update Google Test to v1.16.0 2025-06-08 20:26:08 +01:00
Oliver Hamlet 649b4748bd Remove ConditionalMetadata
While it makes sense, it doesn't really add any value and there is value in having all the relevant data and methods in a single class.
2025-06-08 20:26:07 +01:00
Oliver Hamlet a4ff2ba4bb Fix some indentation in tests.cmake 2025-05-08 19:27:13 +01:00
Oliver Hamlet 0947b23f2b Fix missing CTest discovery of internals tests 2025-05-08 19:27:13 +01:00
Oliver Hamlet eabc7a5d85 Sync with libloot v0.26.1
Aside from adding GameType::oblivionRemastered and its usage, this is almost entirely about moving C++ files and tests around.
2025-05-02 17:56:49 +01:00
Oliver Hamlet 83d9420422 Rename cxx directory to cpp
Also update the crate name and references to it. This helps distinguish the C++ wrapper that's built using CXX from CXX itself.
2025-04-29 17:42:46 +01:00