Large C++ files generated from .slint files can cause link problems with MSVC.
When that happens, MSVC itself suggests /bigobj as remedy.
It's not apparent that there's a downside to using this option, apart from
backwaords binary compatibility - which is not a concern for us.
The discussion at https://developercommunity.visualstudio.com/t/Enable-bigobj-by-default/1031214 suggests that perhaps this
will become the default one day.
To simplify our examples and avoid users running into this, let's enable it by default.
Amend 8406e1050d by fixing the condition
to apply the install_name when the cache variable used to detect package
builds is defined, not _not_ defined.
cc #2075
Set install_name to include rpath as per commit
916b927f4f only when doing top-level
builds that are meant to be installed via "make install".
cc #2075
Thanks to @jschwe, there's a way to instruct corrosion to supply link
flags that set the install name and work around cargo/rustc behavior.
In exchange, now that we're using rpath, to be able to continue to run
the tests and examples against a build tree, we need to set
CMAKE_BUILD_RPATH.
Fixes#2075
Now that the binaries are placed in their respective
CMAKE_RUNTIME_OUTPUT_DIRECTORY, that's config suffixed, let's use the
ctest signature that accepts a cmake target and thus automatically
figures out the correct location of the executable.
This requires the following changes:
- Delay configuring SlintConfig.cmake:
Corrosion sets the `IMPORTED` locations late to allow us to set
OUTPUT_DIRECTORY target properties. The configuration of
SlintConfig.cmake must be deferred until after Corrosion set the
locations. Since we are writing to a config file Generator expressions
are not an option.
- Remove BUILD_TYPE mapping from SlintConfig.cmake:
As discussed in https://github.com/slint-ui/slint/pull/1785#issuecomment-1294630845
remove the mapping of the build types since corrosion now always sets
the `IMPORTED_LOCATION` property.
User facing improvements enabled by the update:
- Corrosion will not fail anymore if the user has a Rust toolchain >=1.60
installed, but the default toolchain is < 1.60.
- Corrosion will respect OUTPUT_DIRECTORY properties and move target
artifacts to the expected locations