Port build system to CMake (2/2 from #5)#8
Merged
Conversation
added 4 commits
January 16, 2025 12:20
Calling --make-links assumes that iotools can be expected to run on the host architecture, despite the project intending to support native and cross-compilation equally well. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
The DEBUG make variable is replaced by CMAKE_BUILD_TYPE, which defaults to Debug if undefined. The Debug and Release CFLAGS are aligned with the original Makefile, all others use CMake defaults. The project's initial configuration continues to enable static-linking of iotools by default, unless overridden by "cmake -D STATIC=0". A new configurable header, config.h.in, is added to tie VER_MAJOR and VER_MINOR to the implicit PROJECT_VERSION_MAJOR and PROJECT_VERSION_MINOR variables. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
From https://cmake.org/cmake/help/latest/policy/CMP0065.html: CMake 3.3 and below, for historical reasons, always linked executables on some platforms with flags like -rdynamic to export symbols from the executables for use by any plugins they may load via dlopen(). CMake 3.4 and above prefer to do this only for executables that are explicitly marked with the ENABLE_EXPORTS target property. The OLD behavior of this policy is to always use the additional link flags when linking executables regardless of the value of the ENABLE_EXPORTS target property. The NEW behavior of this policy is to only use the additional link flags when linking executables if the ENABLE_EXPORTS target property is set to True. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Add an INSTALL_LINKS configuration option to emulate the runtime --make-links option. It leverages a new and automatically-populated .tag field in struct cmd_info for easy lookup using readelf. The CMD_PREFIX define is set from the build script, so that the lookup mechanism has a good chance of staying in sync. Embedding the escaped code directly into CMakeLists allows us to use CMAKE_READELF (circa CMake 3.16), which isn't available from external scripts. This mechanism has been tested with readelf and llvm-readelf. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a redo for #7, requested in #7 (comment).