build: fetch libbsdl from git when ../libbsdl is absent
Fall back to FetchContent (BSDL_GIT_REPOSITORY/BSDL_GIT_TAG) so a fresh clone configures without a manual side-checkout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -16,12 +16,25 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include(EssimFrontend)
|
||||
|
||||
# ----------------------------------------------------------------- core deps
|
||||
# libbsdl — standalone BSDL parser (LGPL-2.1), dynamically linked (EUPL-1.2,
|
||||
# which the LGPL permits). Override its path with -DBSDL_DIR=...
|
||||
# libbsdl — standalone BSDL parser (LGPL-2.1), dynamically linked. Local sibling
|
||||
# ../libbsdl (override -DBSDL_DIR=...) if present, else fetched from git.
|
||||
set(BSDL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../libbsdl" CACHE PATH "libbsdl source tree")
|
||||
set(BSDL_GIT_REPOSITORY "https://git.beafrancois.fr/electronics/libbsdl.git" CACHE STRING "libbsdl git repo (used when BSDL_DIR is absent)")
|
||||
set(BSDL_GIT_TAG "main" CACHE STRING "libbsdl git revision to fetch")
|
||||
set(BSDL_BUILD_CLI OFF CACHE BOOL "" FORCE)
|
||||
set(BSDL_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(${BSDL_DIR} ${CMAKE_BINARY_DIR}/libbsdl)
|
||||
if(EXISTS "${BSDL_DIR}/CMakeLists.txt")
|
||||
message(STATUS "essim: libbsdl from local tree '${BSDL_DIR}'")
|
||||
add_subdirectory(${BSDL_DIR} ${CMAKE_BINARY_DIR}/libbsdl)
|
||||
else()
|
||||
message(STATUS "essim: libbsdl absent — fetching ${BSDL_GIT_REPOSITORY} (${BSDL_GIT_TAG})")
|
||||
FetchContent_Declare(libbsdl
|
||||
GIT_REPOSITORY ${BSDL_GIT_REPOSITORY}
|
||||
GIT_TAG ${BSDL_GIT_TAG}
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(libbsdl)
|
||||
endif()
|
||||
|
||||
find_package(libzip REQUIRED)
|
||||
find_package(pugixml REQUIRED)
|
||||
|
||||
Reference in New Issue
Block a user