New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packaging updates #457
base: main
Are you sure you want to change the base?
Packaging updates #457
Conversation
I believe this has broken the MacOS universal build. I'm going to investigate what the typical approach to that is and see if there are any templates for this kind of thing in vcpkg. |
OK, wow. The universal binary bit is tricky, but I think there's an alternative that doesn't require lipo and custom commands. |
The challenge is trying to feed different compile-time constants and #defines into the code based on the target ISA. It might be possible by doing more inference of options based on the available ISA, rather than being explicit on the command line, but I failed last time I tried to do it. In particular I hit issues around multiple x86 builds, trying to get both x86 and x86h slices working. |
I attempted both an approach using static linking and an approach using CMake "object" libraries, where it produces The approach I've taken seems to work for universal binaries as well as individual (valid) combinations of SIMD ISAs and host environments, but it does still use lipo for the universal binaries. However, it moves the bulk of the per-ISA CMake configuration into the new SIMD.cmake file and allows the for loop to be isolated to only the universal-builds, eliminating the need for a large cmake_core.cmake file that gets included multiple times. I still need to address the unit test code though. |
One question, I'm unclear on the intended difference between |
|
These changes are designed to produce a more "packagable" set of artifacts suitable for inclusion in a package manager.
Sepcificially, I'd like the add
astcenc
to vcpkg to make it easier to consume for downstream projects, but vcpkg requires conformance to a set of best practices in the libraries that are published there.I could accomplish that conformance through a series of patches that would be equivalent to these changes, but it's preferred to make the changes directly upstream if possible.
The biggest change is that the project no longer builds a static library plus optionally a shared library. Instead it follows the setting specified in BUILD_SHARED_LIBRARIES to build one or the other. Additionally, it no longer forces a value for
MSVC_RUNTIME_LIBRARY
, since for windows builds via vcpkg that's handled automatically via the selection of one of the 3 windows "triplets":x64-windows
,x64-windows-static
andx64-windows-static-md
.Note that vcpkg users will still be able to target specific SIMD ISAs via options. This is an existing package that does something similar.
I've also added the use of CPack configuration files so that downstream packages can integrate this more easily into their projects by calling
find_package(astcenc)
and getting anastcenc::astcenc
imported target that they can use intarget_link_libraries
to get both the library linkage information and the include paths.I've also added a new option called
ASTCENC_LEGACY_NAMING
which defaults to ON. This causes the output binaries to have the same names as the existing CMake config, but explicitly turning it off will cause the project to use base names with ISA or shared/static suffixes.For simplicity and readability I've changed the names of all the targets in the
cmake_core.cmake
file to strings likeastcenc
for the library,veneer
for the CLI lib, andcli
for the CLI executable, then use theOUTPUT_NAME
property to actually control the name of the binary.Here's an example of building and installing with these changes...