-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
CMake fixes #62
Merged
Merged
CMake fixes #62
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f749b06
remove fake variable
h-vetinari 87e308f
try to specify static links at compile time
hmaarrfk cf3b62a
output cmake files for inspectjon
hmaarrfk f3cc8dc
uncouple outputs
h-vetinari 8d075f5
sort & complete tests
h-vetinari 49e3cbc
cannot build CLI without shared libs
h-vetinari 4011ff8
run cmake --find-package as test
h-vetinari f6fa361
clean up bld.bat
h-vetinari 246a0b2
don't build static lib on windows
h-vetinari 7c294af
disable cmake test on windows for now
h-vetinari 22966cd
link CLI against shared builds on windows
h-vetinari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
@echo on | ||
|
||
pushd "%SRC_DIR%"\build\cmake | ||
cmake -GNinja ^ | ||
-DCMAKE_BUILD_TYPE=Release ^ | ||
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^ | ||
-DCMAKE_INSTALL_LIBDIR="lib" ^ | ||
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^ | ||
-DZSTD_BUILD_SHARED=ON | ||
if errorlevel 1 exit 1 | ||
-DZSTD_BUILD_SHARED=ON ^ | ||
-DZSTD_BUILD_STATIC=OFF ^ | ||
-DZSTD_PROGRAMS_LINK_SHARED=ON ^ | ||
. | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
cmake --build . --target install | ||
if errorlevel 1 exit 1 | ||
dir | ||
dir lib | ||
copy lib\zstd.dll %PREFIX%\Library\bin\zstd.dll | ||
if errorlevel 1 exit 1 | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
:: duplicate DLL (+ importlib) to also have files with "lib" prefix | ||
copy %PREFIX%\Library\bin\zstd.dll %PREFIX%\Library\bin\libzstd.dll | ||
if errorlevel 1 exit 1 | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
copy %PREFIX%\Library\lib\zstd.lib %PREFIX%\Library\lib\libzstd.lib | ||
if errorlevel 1 exit 1 | ||
if %ERRORLEVEL% neq 0 exit 1 |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that the previous design was completely going against this.
The goal is:
a
andzstd
.a
links tozstd
dynamicallyzstd
statically.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Respectfully, the previous design was a hack, and demonstrably broken (at least from the POV of cmake). I think it's a bad idea for the output containing the static+shared build to depend on the output for the shared-only build - it all but guarantees broken CMake metadata and/or clobbered files.
I don't understand your point here. Why should a package depending on the (already-now) shared
zstd
end up linking statically?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the off chance that you're referring to "zstd-static contains the shared libs already anyway" - this was previously the case already. In fact, the build breaks when passing both:
The error was something like "the CLI cannot be built without the shared lib". I didn't investigate further how to disable building the CLI, as I wanted to keep the previous setup of having both shared & static libs within the
zstd-static
output - the only point I changed is that it doesn't depend on thezstd
output anymore.PS. It's obviously not great to have shared + static lib in the same output, but that's the way things are currently, not least because the upstream build doesn't make it easy to build only the static one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did investigate this now, details in this comment resp. 22966cd