Skip to content
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 optional url to de430.bsp download #372

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
}
bskModuleOptionsString = {
"autoKey": "",
"pathToExternalModules": ""
"pathToExternalModules": "",
"url_spice_kernel": ""
}
bskModuleOptionsFlag = {
"clean": False,
Expand Down Expand Up @@ -251,6 +252,7 @@ def build(self):
cmake.definitions["CONAN_LINK_RUNTIME_MULTI"] = cmake.definitions["CONAN_LINK_RUNTIME"]
cmake.definitions["CONAN_LINK_RUNTIME"] = False
cmake.definitions["BUILD_OPNAV"] = self.options.opNav
if self.options.url_spice_kernel: cmake.definitions["URL_SPICE_KERNEL"] = self.options.url_spice_kernel
cmake.definitions["BUILD_VIZINTERFACE"] = self.options.vizInterface
cmake.definitions["EXTERNAL_MODULES_PATH"] = self.options.pathToExternalModules
cmake.definitions["PYTHON_VERSION"] = f"{sys.version_info.major}.{sys.version_info.minor}"
Expand Down
13 changes: 9 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,16 @@ FetchContent_MakeAvailable(googletest)
include(GoogleTest)
enable_testing()

# Check if the large Spice files are present. If not, download from JPL site directly
# Download spice file if not present
set(URL_SPICE_KERNEL
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp"
CACHE
STRING
"URL from which to download spice kernel de430.bsp dependency")
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/../supportData/EphemerisData/de430.bsp")
message(STATUS "File de430.bsp not found, downloading file:")
message(STATUS "File de430.bsp not found, downloading file from ${URL_SPICE_KERNEL}:")
file(DOWNLOAD
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp"
"${URL_SPICE_KERNEL}"
# Download it to the build directory (in case the download gets interrupted).
"${CMAKE_BINARY_DIR}/data/de430.bsp"
SHOW_PROGRESS
Expand All @@ -351,7 +356,7 @@ if(NOT EXISTS "${CMAKE_SOURCE_DIR}/../supportData/EphemerisData/de430.bsp")
list(GET DOWNLOAD_RESULT 1 RESULT_MESSAGE)
list(GET DOWNLOAD_RESULT 0 RESULT_CODE)
if(NOT RESULT_CODE EQUAL 0)
message(FATAL_ERROR "Failed downloading de430.bsp with error code: ${RESULT_CODE} : ${RESULT_MESSAGE}.")
message(WARNING "Failed downloading de430.bsp with error code: ${RESULT_CODE} : ${RESULT_MESSAGE}.")
endif()
# Move the SPICE file into the appropriate directory.
file(RENAME "${CMAKE_BINARY_DIR}/data/de430.bsp" "${CMAKE_SOURCE_DIR}/../supportData/EphemerisData/de430.bsp")
Expand Down
Loading