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
add Crc32c to tiledb build via ExternalProject_Add #3455
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
289ea4b
add Crc32c to tiledb build via ExternalProject_Add
dhoke4tdb 1f45bba
add new files (add Crc32c to tiledb build via ExternalProject_Add)
dhoke4tdb e339cdb
changes to support building all dependents
dhoke4tdb d706f9f
remove cruft and unused path
dhoke4tdb 8fca6c6
correct copy/paste oversights
dhoke4tdb fc255de
clean up whitespace
dhoke4tdb fb9b75c
Merge branch 'dev' into mrgdev.2.dlh/sc-20447-add-crc32-to-build-2022…
dhoke4tdb c3f64b1
add 'prefix' underscore to transient option, add use that for transie…
dhoke4tdb File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# | ||
# FindCrc32c_EP.cmake | ||
# | ||
# The MIT License | ||
# | ||
# Copyright (c) 2022 TileDB, Inc. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
# | ||
# Finds the Crc32c library, installing with an ExternalProject as necessary. | ||
# This module defines: | ||
# - Crc32c_INCLUDE_DIR, directory containing headers | ||
# - Crc32c_LIBRARIES, the Magic library path | ||
# - Crc32c_FOUND, whether Magic has been found | ||
# - The Crc32c::crc32c imported target | ||
|
||
# Include some common helper functions. | ||
include(TileDBCommon) | ||
|
||
if(TILEDB_CRC32C_EP_BUILT) | ||
find_package(Crc32c CONFIG REQUIRED | ||
HINTS | ||
${TILEDB_EP_INSTALL_PREFIX}/lib/cmake | ||
${TILEDB_DEPS_NO_DEFAULT_PATH}) | ||
elseif (NOT TILEDB_FORCE_ALL_DEPS) | ||
# seems no standard findabsl.cmake, so silence warnings with QUIET | ||
find_package(Crc32c QUIET ${TILEDB_DEPS_NO_DEFAULT_PATH}) | ||
endif() | ||
|
||
# if not yet built add it as an external project | ||
if (NOT TILEDB_CRC32C_EP_BUILT AND NOT Crc32c_FOUND) | ||
if (TILEDB_SUPERBUILD) | ||
message(STATUS "Adding crc32c as an external project") | ||
|
||
set(TILEDB_CRC32C_BUILD_VERSION 1.1.2) | ||
set(TILEDB_CRC32C_URL | ||
"https://github.com/google/crc32c/archive/refs/tags/${TILEDB_CRC32C_BUILD_VERSION}.tar.gz") | ||
set(TILEDB_CRC32C_SHA256 | ||
"ac07840513072b7fcebda6e821068aa04889018f24e10e46181068fb214d7e56") | ||
|
||
ExternalProject_Add( | ||
ep_crc32c | ||
EXCLUDE_FROM_ALL ON | ||
PREFIX "externals" | ||
INSTALL_DIR "${TILEDB_EP_INSTALL_PREFIX}" | ||
URL ${TILEDB_CRC32C_URL} | ||
URL_HASH SHA256=${TILEDB_CRC32C_SHA256} | ||
LIST_SEPARATOR | | ||
CMAKE_ARGS | ||
-DCMAKE_PREFIX_PATH=${TILEDB_EP_INSTALL_PREFIX} | ||
-DCMAKE_INSTALL_PREFIX=${TILEDB_EP_INSTALL_PREFIX} | ||
-DCRC32C_BUILD_TESTS=OFF | ||
-DCRC32C_BUILD_BENCHMARKS=OFF | ||
-DCRC32C_USE_GLOG=OFF | ||
LOG_DOWNLOAD ON | ||
LOG_CONFIGURE ON | ||
LOG_BUILD ON | ||
LOG_INSTALL ON) | ||
|
||
list(APPEND TILEDB_EXTERNAL_PROJECTS ep_crc32c) | ||
list(APPEND FORWARD_EP_CMAKE_ARGS | ||
-DTILEDB_CRC32C_EP_BUILT=TRUE | ||
) | ||
else() | ||
message(FATAL_ERROR "Unable to find crc32c") | ||
endif() | ||
endif () | ||
|
||
if (Crc32c_FOUND AND NOT TARGET Crc32c::crc32c) | ||
message(STATUS "Found crc32c, adding imported target: ${Crc32c_LIBRARIES}") | ||
add_library(Crc32c::crc32c UNKNOWN IMPORTED) | ||
set_target_properties(Crc32c::crc32c PROPERTIES | ||
IMPORTED_LOCATION "${Crc32c_LIBRARIES}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${Crc32c_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|
||
# If we built a static EP, install it if required. | ||
if (TILEDB_CRC32C_EP_BUILT AND TILEDB_INSTALL_STATIC_DEPS) | ||
install_target_libs(Crc32c::crc32c) | ||
endif() |
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
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# | ||
# test/external/CMakeLists.txt | ||
# | ||
# | ||
# The MIT License | ||
# | ||
# Copyright (c) 2022 TileDB, Inc. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
# | ||
|
||
if(NOT TILEDB_ABSEIL) | ||
message("skipping target unit_link_absl, found NOT TILEDB_ABSEIL") | ||
else() | ||
message("adding target unit_link_absl, have TILEDB_ABSEIL") | ||
|
||
add_executable(unit_link_absl EXCLUDE_FROM_ALL src/absl_link_test.cc) | ||
|
||
find_package(absl CONFIG REQUIRED | ||
PATHS | ||
${TILEDB_EP_INSTALL_PREFIX}/lib/cmake | ||
${TILEDB_DEPS_NO_DEFAULT_PATH} | ||
) | ||
|
||
include(${CMAKE_CURRENT_SOURCE_DIR}/src/absl_library_targets.cmake) | ||
|
||
target_link_libraries(unit_link_absl PRIVATE ${TILEDB_ABSL_LIBRARY_TARGETS}) | ||
|
||
target_include_directories(unit_link_absl PRIVATE ${TILEDB_EP_INSTALL_PREFIX} ${TILEDB_EP_INSTALL_PREFIX}/include ) | ||
|
||
endif() | ||
|
||
if(NOT TILEDB_CRC32) | ||
message("skipping target unit_link_crc32, found NOT TILEDB_CRC32") | ||
else() | ||
message("adding target unit_link_absl, have TILEDB_ABSEIL") | ||
|
||
add_executable(unit_link_crc32 EXCLUDE_FROM_ALL src/crc32_link_test.cc) | ||
|
||
find_package(Crc32c CONFIG REQUIRED | ||
PATHS | ||
${TILEDB_EP_INSTALL_PREFIX}/lib/cmake | ||
${TILEDB_DEPS_NO_DEFAULT_PATH} | ||
) | ||
|
||
target_link_libraries(unit_link_crc32 PRIVATE Crc32c::crc32c) | ||
|
||
target_include_directories(unit_link_crc32 PRIVATE ${TILEDB_EP_INSTALL_PREFIX} ${TILEDB_EP_INSTALL_PREFIX}/include ) | ||
endif() |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* @file crc32_lilnk_test.cc | ||
* | ||
* @section LICENSE | ||
* | ||
* The MIT License | ||
* | ||
* @copyright Copyright (c) 2022 TileDB Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @section DESCRIPTION | ||
* | ||
* Tests for linkage to Crc32c | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
|
||
#include <include/crc32c/crc32c.h> | ||
|
||
int main() | ||
{ | ||
uint8_t buf[32]; | ||
|
||
printf("crc32 of indeterminate buffer is %u\n", crc32c::Crc32c(buf, sizeof(buf))); | ||
|
||
return 0 ; | ||
} |
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.
nig: Magic -> Crc
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.
Addition of the link test is currently subject to same flags as building being activated by bootstrap[.ps1]
If I take away those switches/visibility, how do you want to handle building/link-test enabling?
(The code would be present, but no way to activate it...?)
[edit - Occurs to me 'later' with variable left in place, can invoke cmake directly, although this will require knowledge of any (additional) vars and cmake parameters (on windows, -X A64? others?) that may have to be specified to obtain other 'normal' default settings that may be required (several cmake variables are defaulted to ON by bootstrap.ps1).]
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 was thinking of enabling via
cmake -D...
, but you're right, we don't invoke it directly. For now let's prefix the option with_
so we can use it in CI and remove later once it is implicitly enabled/tested via-DTILEDB_GCS=ON
.