Skip to content

Commit 5a4f118

Browse files
committed
Add optional url to de430.bsp download
1 parent 02f1842 commit 5a4f118

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

conanfile.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
}
4444
bskModuleOptionsString = {
4545
"autoKey": "",
46-
"pathToExternalModules": ""
46+
"pathToExternalModules": "",
47+
"url_spice_kernel": ""
4748
}
4849
bskModuleOptionsFlag = {
4950
"clean": False,
@@ -251,6 +252,7 @@ def build(self):
251252
cmake.definitions["CONAN_LINK_RUNTIME_MULTI"] = cmake.definitions["CONAN_LINK_RUNTIME"]
252253
cmake.definitions["CONAN_LINK_RUNTIME"] = False
253254
cmake.definitions["BUILD_OPNAV"] = self.options.opNav
255+
if self.options.url_spice_kernel: cmake.definitions["URL_SPICE_KERNEL"] = self.options.url_spice_kernel
254256
cmake.definitions["BUILD_VIZINTERFACE"] = self.options.vizInterface
255257
cmake.definitions["EXTERNAL_MODULES_PATH"] = self.options.pathToExternalModules
256258
cmake.definitions["PYTHON_VERSION"] = f"{sys.version_info.major}.{sys.version_info.minor}"

src/CMakeLists.txt

+9-4
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,16 @@ FetchContent_MakeAvailable(googletest)
338338
include(GoogleTest)
339339
enable_testing()
340340

341-
# Check if the large Spice files are present. If not, download from JPL site directly
341+
# Download spice file if not present
342+
set(URL_SPICE_KERNEL
343+
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp"
344+
CACHE
345+
STRING
346+
"URL from which to download spice kernel de430.bsp dependency")
342347
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/../supportData/EphemerisData/de430.bsp")
343-
message(STATUS "File de430.bsp not found, downloading file:")
348+
message(STATUS "File de430.bsp not found, downloading file from ${URL_SPICE_KERNEL}:")
344349
file(DOWNLOAD
345-
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp"
350+
"${URL_SPICE_KERNEL}"
346351
# Download it to the build directory (in case the download gets interrupted).
347352
"${CMAKE_BINARY_DIR}/data/de430.bsp"
348353
SHOW_PROGRESS
@@ -351,7 +356,7 @@ if(NOT EXISTS "${CMAKE_SOURCE_DIR}/../supportData/EphemerisData/de430.bsp")
351356
list(GET DOWNLOAD_RESULT 1 RESULT_MESSAGE)
352357
list(GET DOWNLOAD_RESULT 0 RESULT_CODE)
353358
if(NOT RESULT_CODE EQUAL 0)
354-
message(FATAL_ERROR "Failed downloading de430.bsp with error code: ${RESULT_CODE} : ${RESULT_MESSAGE}.")
359+
message(WARNING "Failed downloading de430.bsp with error code: ${RESULT_CODE} : ${RESULT_MESSAGE}.")
355360
endif()
356361
# Move the SPICE file into the appropriate directory.
357362
file(RENAME "${CMAKE_BINARY_DIR}/data/de430.bsp" "${CMAKE_SOURCE_DIR}/../supportData/EphemerisData/de430.bsp")

0 commit comments

Comments
 (0)