-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
WIP - Handle sources as a library + cli app #18
Draft
piponazo
wants to merge
16
commits into
siara-cc:master
Choose a base branch
from
piponazo:cmakeLibAndApp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
MSVC2019 was complaining about trying to statically allocated the array: ...\test_unishox2.c(377): error C2057: expected constant expression ...\test_unishox2.c(377): error C2466: cannot allocate an array of constant size 0 ...\test_unishox2.c(377): error C2133: 'short_buf': unknown size
The size returned by sizeof(buf) was 8 when its length was actually more than 100 bytes.
By the way, if we agree on continuing on this path, I would redo the PR because the git history in my personal fork is kind of messed up 😅 |
piponazo
force-pushed
the
cmakeLibAndApp
branch
from
September 13, 2021 09:14
7558096
to
a78accc
Compare
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.
With the changes proposed here, CMake would handle the unishox2.h/cpp as a library that is compiled separately from the CLI application.
The main benefit of doing that is that CMake can handle the installation of the library so that other projects can consume the library in the "CMake standard" way. After configuring the project with CMake, one can run
make install
or similar, to install the library, hedaders and CMake configuration files in the specified installation folder:Another project also configured with CMake can easily consume
unishox
by just usingfind_package
and then using theunishox
target:The main conflicting point that I see with this PR is that I used the following command to automatically generate an export header:
Such export header would be needed to export/import the library symbols on different platforms and compilers. This is a snippet from the file generate on Windows10 + MSVC:
Previously, the code could be compiled directly with a call to the compiler like this one:
However, the addition of that export header would make strictly needed a previous configuration of the project with CMake (to generate the export header for the target system). Probably that would be the main point of discussion, in case you want to keep the project independent from any configuration system such as CMake.