From 13eeb92fb0236c441555334ef51dfd30baccd516 Mon Sep 17 00:00:00 2001 From: Clifford Yapp <238416+starseeker@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:10:03 -0500 Subject: [PATCH] Remove src/bext submodule in favor of an explicitly stored SHA1 Also, no longer deleting the cloned srcs and bext build from the BRL-CAD build dir unless an option enabling that is explicitly set. We still need it for CI, since space is at a premium there and we need to clear the build outputs, but otherwise removing these makes it more difficult to debug any problems. --- .github/workflows/analysis.yml | 2 +- .github/workflows/check.yml | 6 +- .gitmodules | 4 - CMakeLists.txt | 95 +-------- HACKING | 12 +- TODO | 13 -- misc/CMake/BRLCAD_EXT_Setup.cmake | 222 +++++++++++++--------- misc/CMake/BRLCAD_ExternalDeps.cmake | 6 +- misc/CMake/distcheck_repo_verify.cmake.in | 9 +- misc/CMake/source_archive_setup.cmake.in | 33 ---- sh/CMakeLists.txt | 1 - sh/update_bext.sh | 10 - src/bext | 1 - 13 files changed, 160 insertions(+), 254 deletions(-) delete mode 100755 sh/update_bext.sh delete mode 160000 src/bext diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 894c3d107f7..69613efd169 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -118,7 +118,7 @@ jobs: - name: Configure run: | export PATH=$ENV{GITHUB_WORKSPACE}:$PATH - cmake -S . -B build_lcov -DBRLCAD_ENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -DBRLCAD_EXT_PARALLEL=1 -DBRLCAD_ENABLE_QT=ON + cmake -S . -B build_lcov -DBRLCAD_ENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -DBRLCAD_EXT_PARALLEL=1 -DBRLCAD_ENABLE_QT=ON -DBRLCAD_BEXT_CLEANUP=ON - name: Build run: | diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4463bd9af91..6223559391b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -118,7 +118,7 @@ jobs: shell: cmd run: | call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat" - cmake -S . -B build_winstd -DBRLCAD_EXT_PARALLEL=1 -DBRLCAD_BUNDLED_LIBS=Bundled -DBRLCAD_ENABLE_QT=ON -DCMAKE_BUILD_TYPE=Release + cmake -S . -B build_winstd -DBRLCAD_EXT_PARALLEL=1 -DBRLCAD_BUNDLED_LIBS=Bundled -DBRLCAD_ENABLE_QT=ON -DCMAKE_BUILD_TYPE=Release -DBRLCAD_BEXT_CLEANUP=ON - name: Build shell: cmd @@ -187,7 +187,7 @@ jobs: - name: Configure run: | export PATH=$ENV{GITHUB_WORKSPACE}:$PATH - cmake -S . -G Ninja -B build_linux -DCMAKE_BUILD_TYPE=Release -DBRLCAD_EXT_PARALLEL=1 -DBRLCAD_ENABLE_QT=ON + cmake -S . -G Ninja -B build_linux -DCMAKE_BUILD_TYPE=Release -DBRLCAD_EXT_PARALLEL=1 -DBRLCAD_ENABLE_QT=ON -DBRLCAD_BEXT_CLEANUP=ON - name: Build run: | @@ -297,6 +297,6 @@ jobs: run: | cmake -E make_directory ./build_archives export PATH=$ENV{GITHUB_WORKSPACE}:$PATH - cmake -S . -B build_archives -DCMAKE_BUILD_TYPE=Release -DBRLCAD_EXT_PARALLEL=1 -DCPACK_INCLUDE_EXT=OFF + cmake -S . -B build_archives -DCMAKE_BUILD_TYPE=Release -DBRLCAD_EXT_PARALLEL=1 -DBRLCAD_BEXT_CLEANUP=ON cmake --build build_archives --config Release --target distcheck-source_archives diff --git a/.gitmodules b/.gitmodules index 9f8a20d36de..e69de29bb2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "src/bext"] - path = src/bext - url = https://github.com/BRL-CAD/bext.git - branch = main diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fdfec32dc1..ab40bf64565 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,90 +206,16 @@ include(BRLCAD_Environment_Setup) # an incorrect include directory for Eigen based on bext build info. set(CMAKE_FIND_USE_PACKAGE_REGISTRY FALSE) -# Populate these early, even though their main use is in -# misc/CMake/BRLCAD_ExternalDeps.cmake - find_program and find_package calls -# may also make use of them, particularly BRLCAD_EXT_NOINSTALL_DIR -set(BRLCAD_EXT_DIR_ENV "$ENV{BRLCAD_EXT_DIR}") -if(BRLCAD_EXT_DIR_ENV AND NOT DEFINED BRLCAD_EXT_DIR) - set(BRLCAD_EXT_DIR ${BRLCAD_EXT_DIR_ENV}) -endif(BRLCAD_EXT_DIR_ENV AND NOT DEFINED BRLCAD_EXT_DIR) - -if(DEFINED BRLCAD_EXT_DIR) - # Make sure we cache the BRLCAD_EXT_DIR setting - if we don't, then a re-configure - # with CMake is going to ignore a previously specified directory - set(BRLCAD_EXT_DIR "${BRLCAD_EXT_DIR}" CACHE PATH "BRL-CAD external dependency sources") - - if(NOT DEFINED BRLCAD_EXT_INSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/install") - set(BRLCAD_EXT_INSTALL_DIR "${BRLCAD_EXT_DIR}/install") - endif(NOT DEFINED BRLCAD_EXT_INSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/install") - # Need to handle the case where BRLCAD_EXT_DIR is a symlink - if it - # is, we need to expand the symlink in order for the tar tricks we use - # later for file copying to work... - if(DEFINED BRLCAD_EXT_INSTALL_DIR AND IS_SYMLINK ${BRLCAD_EXT_INSTALL_DIR}) - file(REAL_PATH "${BRLCAD_EXT_INSTALL_DIR}" EXT_PATH) - set(BRLCAD_EXT_INSTALL_DIR "${EXT_PATH}") - endif(DEFINED BRLCAD_EXT_INSTALL_DIR AND IS_SYMLINK ${BRLCAD_EXT_INSTALL_DIR}) - - # For noinstall we don't need to worry about symlinks since we'll be using - # the contents in place. - if(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/noinstall") - set(BRLCAD_EXT_NOINSTALL_DIR "${BRLCAD_EXT_DIR}/noinstall") - endif(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/noinstall") -endif(DEFINED BRLCAD_EXT_DIR) - -# If we're doing the non-src-other build, we've got to have bext for at least a -# few custom components no matter how many system packages are installed. -if(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR OR NOT DEFINED BRLCAD_EXT_INSTALL_DIR) - message( - WARNING - "External dependencies will be downloaded, configured, and built automatically as-needed. Set BRLCAD_EXT_DIR to specify instead." - ) - message( - STATUS - "BRLCAD_EXT_DIR specifies prebuilt external dependencies directory\n" - "containing 'install' and 'noinstall' folders, outputs from installing\n" - "https://github.com/BRL-CAD/bext.\n" - ) -endif(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR OR NOT DEFINED BRLCAD_EXT_INSTALL_DIR) - -# By default, we don't bundle bext into the source tarball for performance -# reasons, but the support is there if the dev wants to pay the price in time -# and disk space. -if(NOT DEFINED CPACK_INCLUDE_EXT) - set(CPACK_INCLUDE_EXT OFF) -endif(NOT DEFINED CPACK_INCLUDE_EXT) - -# Before we do a lot of configure work, check whether we've got a type mismatch -# between bext and the BRL-CAD build type. If not, on Windows at least, it's a -# fatal error. +#--------------------------------------------------------------------- +# Prepare External dependencies (bext) repository management +include(BRLCAD_ExternalDeps) + +# Sets the bext SHA1 hash. There are also some steps in this process that need +# to happen early to allow find_package and find_program to work as expected. # -# NOTE: This test must come AFTER the inclusion of BRLCAD_Build_Types -if(CMAKE_BUILD_TYPE AND EXISTS "${BRLCAD_EXT_NOINSTALL_DIR}") - find_program(DUMPBIN_EXEC dumpbin) - set(TEST_BINFILE ${BRLCAD_EXT_NOINSTALL_DIR}/bin/strclear.exe) - if(DUMPBIN_EXEC AND EXISTS ${TEST_BINFILE}) - # dumpbin doesn't like CMake style paths - file(TO_NATIVE_PATH "${TEST_BINFILE}" TBFN) - # https://stackoverflow.com/a/28304716/2037687 - execute_process(COMMAND ${DUMPBIN_EXEC} /dependents ${TBFN} OUTPUT_VARIABLE DB_OUT ERROR_VARIABLE DB_OUT) - if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - if("${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" OR "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") - message( - FATAL_ERROR - "Release build specified, but supplied bext binaries in ${BRLCAD_EXT_DIR} are compiled as Debug binaries." - ) - endif("${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" OR "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") - endif("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - if(NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" AND NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") - message( - FATAL_ERROR - "Debug build specified, but supplied bext binaries in ${BRLCAD_EXT_DIR} are compiled as Release binaries." - ) - endif(NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" AND NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") - endif("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - endif(DUMPBIN_EXEC AND EXISTS ${TEST_BINFILE}) -endif(CMAKE_BUILD_TYPE AND EXISTS "${BRLCAD_EXT_NOINSTALL_DIR}") +# If a pre-existing bext install directory is specified, we also check the +# types on platforms where bext and the main BRL-CAD's build type must align. +brlcad_bext_init() #--------------------------------------------------------------------- # Define various utilities. @@ -2167,8 +2093,7 @@ add_subdirectory(misc/tools) include(${CMAKE_SOURCE_DIR}/src/source_dirs.cmake) # Now we have the necessary info - trigger the primary management logic -include(BRLCAD_ExternalDeps) -brlcad_process_ext() +brlcad_bext_process() # Define some Tcl related variables for libtclcad if(BRLCAD_ITCL_BUILD) diff --git a/HACKING b/HACKING index f53cfd4d8eb..3977834d2d9 100644 --- a/HACKING +++ b/HACKING @@ -1380,17 +1380,11 @@ Release steps are as follows: ##################################################################### # 08: Update the bext submodule in BRL-CAD's main repository. + (TODO - this can probably be scripted...) - rm -rf src/bext && git checkout -- src/bext - git submodule update --init - git submodule update --remote - git add src/bext - cd src/bext - BSHA1=$(git log -1 --pretty=format:"%h") - cd ../.. - git commit -m "Update bext submodule to SHA1 $BSHA1" + # NON-AUTO: Update BEXT_SHA1 hash in misc/CMake/BRLCAD_EXT_Setup.cmake + git commit -m "Update bext submodule to SHA1 " git push - rm -rf src/bext && git checkout -- src/bext ##################################################################### # 09: Update ChangeLog. Use the YYYY-MM-DD of previous NEWS entry. diff --git a/TODO b/TODO index 4bf44fbbe15..8a854fb6d7c 100644 --- a/TODO +++ b/TODO @@ -51,19 +51,6 @@ THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS THESE ARE UNSCHEDULED BACKLOG TASKS ----------------------------------- -* replace src/bext submodule with a SHA1 stored in the top level - CMakeLists.txt file. Having the submodule active is proving - a bit problematic. While it does allow for a recursive clone, - working with it has been challenging. The most critical feature - it provides is allowing git bisect to work, and we can achieve - that with a SHA1 stored in the top level. Will need to update - the cloning logic accordingly. - -* adjust build logic to not delete the in-build-dir checkout and - build directories by default. Makes it too hard to debug when - something goes wrong. Update the CI system logic to explicitly - remove the outputs (where we need to for space reasons). - * calculate maximum/minimum presented area az/el for a given model * optimize mged/libged init and exit performance. profiling shows diff --git a/misc/CMake/BRLCAD_EXT_Setup.cmake b/misc/CMake/BRLCAD_EXT_Setup.cmake index b50dda3a1e3..0798a53c109 100644 --- a/misc/CMake/BRLCAD_EXT_Setup.cmake +++ b/misc/CMake/BRLCAD_EXT_Setup.cmake @@ -31,6 +31,107 @@ include(CMakeParseArguments) + +# Preliminary setup and variable population +function(brlcad_bext_init) + + # ************************************************************************** + # ************************************************************************** + # In lieu of a submodule, we store the hash for the targeted bext repository + # in the top level CMakeLists.txt file. This needs to be updated whenever + # BRL-CAD needs to target a new version of bext. + set(BEXT_SHA1 0c539a0395d3bed52093457b72f98f3b74e2dbda) + # ************************************************************************** + # ************************************************************************** + + # Populate these early, even though their main use is in + # misc/CMake/BRLCAD_ExternalDeps.cmake - find_program and find_package calls + # may also make use of them, particularly BRLCAD_EXT_NOINSTALL_DIR + set(BRLCAD_EXT_DIR_ENV "$ENV{BRLCAD_EXT_DIR}") + if(BRLCAD_EXT_DIR_ENV AND NOT DEFINED BRLCAD_EXT_DIR) + set(BRLCAD_EXT_DIR ${BRLCAD_EXT_DIR_ENV}) + endif(BRLCAD_EXT_DIR_ENV AND NOT DEFINED BRLCAD_EXT_DIR) + + # Handle a pre-defined BRLCAD_EXT_DIR variable + if(DEFINED BRLCAD_EXT_DIR) + # Make sure we cache the BRLCAD_EXT_DIR setting - if we don't, then a re-configure + # with CMake is going to ignore a previously specified directory + set(BRLCAD_EXT_DIR "${BRLCAD_EXT_DIR}" CACHE PATH "BRL-CAD external dependency sources") + + if(NOT DEFINED BRLCAD_EXT_INSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/install") + set(BRLCAD_EXT_INSTALL_DIR "${BRLCAD_EXT_DIR}/install") + endif(NOT DEFINED BRLCAD_EXT_INSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/install") + # Need to handle the case where BRLCAD_EXT_DIR is a symlink - if it + # is, we need to expand the symlink in order for the tar tricks we use + # later for file copying to work... + if(DEFINED BRLCAD_EXT_INSTALL_DIR AND IS_SYMLINK ${BRLCAD_EXT_INSTALL_DIR}) + file(REAL_PATH "${BRLCAD_EXT_INSTALL_DIR}" EXT_PATH) + set(BRLCAD_EXT_INSTALL_DIR "${EXT_PATH}") + endif(DEFINED BRLCAD_EXT_INSTALL_DIR AND IS_SYMLINK ${BRLCAD_EXT_INSTALL_DIR}) + + # For noinstall we don't need to worry about symlinks since we'll be using + # the contents in place. + if(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/noinstall") + set(BRLCAD_EXT_NOINSTALL_DIR "${BRLCAD_EXT_DIR}/noinstall") + endif(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR AND EXISTS "${BRLCAD_EXT_DIR}/noinstall") + endif(DEFINED BRLCAD_EXT_DIR) + + # If we're doing the non-src-other build, we've got to have bext for at least a + # few custom components no matter how many system packages are installed. + if(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR OR NOT DEFINED BRLCAD_EXT_INSTALL_DIR) + message( + WARNING + "External dependencies will be downloaded, configured, and built automatically as-needed. Set BRLCAD_EXT_DIR to specify instead." + ) + message( + STATUS + "BRLCAD_EXT_DIR specifies prebuilt external dependencies directory\n" + "containing 'install' and 'noinstall' folders, outputs from installing\n" + "https://github.com/BRL-CAD/bext.\n" + ) + endif(NOT DEFINED BRLCAD_EXT_NOINSTALL_DIR OR NOT DEFINED BRLCAD_EXT_INSTALL_DIR) + + # Before we do a lot of configure work, check whether we've got a type mismatch + # between bext and the BRL-CAD build type. If not, on Windows at least, it's a + # fatal error. + # + # NOTE: This test must come AFTER the inclusion of BRLCAD_Build_Types + if(CMAKE_BUILD_TYPE AND EXISTS "${BRLCAD_EXT_NOINSTALL_DIR}") + find_program(DUMPBIN_EXEC dumpbin) + set(TEST_BINFILE ${BRLCAD_EXT_NOINSTALL_DIR}/bin/strclear.exe) + if(DUMPBIN_EXEC AND EXISTS ${TEST_BINFILE}) + # dumpbin doesn't like CMake style paths + file(TO_NATIVE_PATH "${TEST_BINFILE}" TBFN) + # https://stackoverflow.com/a/28304716/2037687 + execute_process(COMMAND ${DUMPBIN_EXEC} /dependents ${TBFN} OUTPUT_VARIABLE DB_OUT ERROR_VARIABLE DB_OUT) + if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + if("${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" OR "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") + message( + FATAL_ERROR + "Release build specified, but supplied bext binaries in ${BRLCAD_EXT_DIR} are compiled as Debug binaries." + ) + endif("${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" OR "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") + endif("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + if(NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" AND NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") + message( + FATAL_ERROR + "Debug build specified, but supplied bext binaries in ${BRLCAD_EXT_DIR} are compiled as Release binaries." + ) + endif(NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" AND NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*") + endif("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + endif(DUMPBIN_EXEC AND EXISTS ${TEST_BINFILE}) + endif(CMAKE_BUILD_TYPE AND EXISTS "${BRLCAD_EXT_NOINSTALL_DIR}") + + # Persist key variables + set(BEXT_SHA1 ${BEXT_SHA1} PARENT_SCOPE) + set(BRLCAD_EXT_DIR ${BRLCAD_EXT_DIR} PARENT_SCOPE) + set(BRLCAD_EXT_INSTALL_DIR ${BRLCAD_EXT_INSTALL_DIR} PARENT_SCOPE) + set(BRLCAD_EXT_NOINSTALL_DIR ${BRLCAD_EXT_NOINSTALL_DIR} PARENT_SCOPE) + +endfunction() + + # Build a local copy of bext if we were unable to locate one function(brlcad_rel_version BRLCAD_REL) @@ -43,42 +144,6 @@ function(brlcad_rel_version BRLCAD_REL) set(${BRLCAD_REL} "rel-${VMAJOR}-${VMINOR}-${VPATCH}" PARENT_SCOPE) endfunction() -# Extract the current src/bext submodule SHA1 -function(bext_sha1 SHA1_VAR) - if(NOT GIT_EXEC) - set(${SHA1_VAR} "" PARENT_SCOPE) - return() - endif() - if (NOT EXISTS "${PROJECT_SOURCE_DIR}/.git") - set(${SHA1_VAR} "" PARENT_SCOPE) - return() - endif() - execute_process( - COMMAND ${GIT_EXEC} branch --show-current - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE BRANCH_STATUS - OUTPUT_VARIABLE BRANCH_STR - ERROR_VARIABLE BRANCH_STR - ) - string(STRIP "${BRANCH_STR}" BRANCH_STR) - execute_process( - COMMAND ${GIT_EXEC} ls-tree ${BRANCH_STR} src/bext - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE LS_TREE_STATUS - OUTPUT_VARIABLE LS_TREE_STR - ERROR_VARIABLE LS_TREE_STR - ) - if(NOT LS_TREE_STATUS AND LS_TREE_STR) - string(REPLACE " " ";" LS_TREE_STR "${LS_TREE_STR}") - string(REPLACE "\t" ";" LS_TREE_STR "${LS_TREE_STR}") - list(GET LS_TREE_STR 2 LOCAL_SHA1) - set(${SHA1_VAR} "${LOCAL_SHA1}" PARENT_SCOPE) - else() - message(WARNING "git error: ${LS_TREE_STR}") - set(${SHA1_VAR} "" PARENT_SCOPE) - endif() -endfunction() - # Look up branch or tag SHA1 hashes from primary github.com repo function(remote_sha1 SHA1_VAR BRANCH) if(NOT GIT_EXEC) @@ -128,12 +193,8 @@ function(bext_sha1_checks) return() endif() - # Get the current src/bext SHA1. This will be the version - # used for cloning - bext_sha1(LOCAL_SHA1) - - # The next two tags are used for validation of the src/bext - # SHA1 against the upstream bext repository state + # The next two tags are used for validation of the currently specified SHA1 + # against the upstream bext repository state brlcad_rel_version(BRLCAD_REL) remote_sha1(REMOTE_VER_SHA1 ${BRLCAD_REL}) set(TARGET_BRANCH main) @@ -147,42 +208,42 @@ function(bext_sha1_checks) # If this logic isn't working, first thing to check is whether # we are successfully getting SHA1 hashes - #message("bext SHA1: ${LOCAL_SHA1}") + #message("bext SHA1: ${BEXT_SHA1}") #message("remote VERSION SHA1: ${REMOTE_VER_SHA1}") #message("remote ${TARGET_BRANCH} SHA1: ${REMOTE_BRANCH_SHA1}") #message("OLD_SHA1: ${OLD_SHA1}") - # If we don't have a matching release tag, check whether the src/bext SHA1 + # If we don't have a matching release tag, check whether the specified SHA1 # and the bext sha1 line up. It's not (always) a show stopper if they - # do not, but the general intent is that src/bext should keep up with the + # do not, but the general intent is that specified should keep up with the # bext branch. - if(LOCAL_SHA1 AND REMOTE_BRANCH_SHA1 AND NOT REMOTE_VER_SHA1) - if(NOT "${LOCAL_SHA1}" STREQUAL "${REMOTE_BRANCH_SHA1}") + if(BEXT_SHA1 AND REMOTE_BRANCH_SHA1 AND NOT REMOTE_VER_SHA1) + if(NOT "${BEXT_SHA1}" STREQUAL "${REMOTE_BRANCH_SHA1}") message( WARNING - "The local src/bext submodule SHA1 (${LOCAL_SHA1}) does not match the latest bext ${TARGET_BRANCH} branch SHA1 (${REMOTE_BRANCH_SHA1}). This typically indicates upstream BRL-CAD has updated the bext repository and you will want to update your local clone. If you are the developer performing the updates, you should run\ngit submodule update --remote\nto update src/bext to reference the latest external sources." + "The local SHA1 (${BEXT_SHA1}) does not match the latest bext ${TARGET_BRANCH} branch SHA1 (${REMOTE_BRANCH_SHA1}). This typically indicates upstream BRL-CAD has updated the bext repository and you will want to update your local clone. To clear this warning, set BEXT_SHA1 in misc/CMake/BRLCAD_EXT_Setup.cmake to ${REMOTE_BRANCH_SHA1}." ) endif() - endif(LOCAL_SHA1 AND REMOTE_BRANCH_SHA1 AND NOT REMOTE_VER_SHA1) + endif(BEXT_SHA1 AND REMOTE_BRANCH_SHA1 AND NOT REMOTE_VER_SHA1) - # If we do have a versioned tag in github.com, check that src/bext + # If we do have a versioned tag in github.com, check that the locally specified SHA1 # matches it. This check is primarily useful during release prep. - if(LOCAL_SHA1 AND REMOTE_VER_SHA1) - if(NOT "${LOCAL_SHA1}" STREQUAL "${REMOTE_VER_SHA1}") + if(BEXT_SHA1 AND REMOTE_VER_SHA1) + if(NOT "${BEXT_SHA1}" STREQUAL "${REMOTE_VER_SHA1}") message( WARNING - "The local src/bext submodule SHA1 (${LOCAL_SHA1}) does not match the ${BRLCAD_REL} SHA1 (${REMOTE_VER_SHA1}). If preparing a release, remember to update src/bext's submodule to point to bext's ${BRLCAD_REL} tag." + "The local SHA1 (${BEXT_SHA1}) does not match the ${BRLCAD_REL} SHA1 (${REMOTE_VER_SHA1}). If preparing a release, remember to update BEXT_SHA1 in misc/CMake/BRLCAD_EXT_Setup.cmake to point to bext's ${BRLCAD_REL} tag." ) endif() - endif(LOCAL_SHA1 AND REMOTE_VER_SHA1) + endif(BEXT_SHA1 AND REMOTE_VER_SHA1) # A clone into the build directory is transient - we don't keep it beyond the # configure stage in order to save space. However, we do want to be able to # detect if the bext we built no longer matches upstream, so a cached record # of the bext SHA1 used is retained. If we have such a record, see if it - # matches our target LOCAL_SHA1. If not, we need to clear any old bext build + # matches our target BEXT_SHA1. If not, we need to clear any old bext build # products from the build directory and start fresh. - if (OLD_SHA1 AND NOT "${OLD_SHA1}" STREQUAL "${LOCAL_SHA1}") + if (OLD_SHA1 AND NOT "${OLD_SHA1}" STREQUAL "${BEXT_SHA1}") message("Previously compiled bext build products do not match current target - resetting.") if (EXISTS "${CMAKE_INSTALL_PREFIX}/include/brlcad/bu.h") message(WARNING "${CMAKE_INSTALL_PREFIX} appears to contain a BRL-CAD install. We are resetting bext components in the build, but not clearing the installed contents - to avoid any unexpected behaviors, recommend clearing ${CMAKE_INSTALL_PREFIX}.") @@ -226,40 +287,27 @@ function(setup_bext_dir) endif() endif() - # If src/bext is actually populated, we'll always use that - # regardless of the SHA1 values. - if(EXISTS "${CMAKE_SOURCE_DIR}/src/bext/README.md") - set(BRLCAD_EXT_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/bext") - endif() - - # If we don't have a pre-populated src/bext, it's time to clone. + # If we don't have a user-specified source directory, it's time to clone. if (NOT BRLCAD_EXT_SOURCE_DIR) - # Get the current src/bext SHA1, if available. This will be the version we - # want to use for building, since it is the verion associated with this - # BRL-CAD version. - bext_sha1(LOCAL_SHA1) - # With a pre-populated bext source directory we could build even without # git, but if we don't have bext sources AND we don't have git at this # stage we're done. if (NOT GIT_EXEC) - message(FATAL_ERROR "No bext sources present in src/bext, and git executable not found.") + message(FATAL_ERROR "No bext sources specified, and git executable not found.") endif() # Warn if we can't get a target SHA1 hash, since there's a good chance # we'll wind up with a bext that doesn't match the BRL-CAD checkout. - if (NOT LOCAL_SHA1) - message(WARNING "Unable to retrieve SHA1 hash from src/bext - will attempt to use latest main. If you are building a release or older version of BRL-CAD this may not work, in which case you will need to manually retrieve the appropriate bext checkout.") + if (NOT BEXT_SHA1) + message(FATAL_ERROR "BEXT_SHA1 hash is unset. This should be set in the top level BRL-CAD CMakeLists.txt file.") endif() - # src/bext wasn't populated, so we're cloning into the build dir + # no pre-existing sources, so we're cloning into the build dir set(BRLCAD_EXT_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/bext") # Write current SHA1 for subsequent processing - if (LOCAL_SHA1) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bext.sha1" "${LOCAL_SHA1}") - distclean("${CMAKE_CURRENT_BINARY_DIR}/bext.sha1") - endif() + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bext.sha1" "${BEXT_SHA1}") + distclean("${CMAKE_CURRENT_BINARY_DIR}/bext.sha1") # Clone message("BRL-CAD bext clone command: ${GIT_EXEC} clone https://github.com/BRL-CAD/bext.git") @@ -267,16 +315,16 @@ function(setup_bext_dir) COMMAND ${GIT_EXEC} clone https://github.com/BRL-CAD/bext.git WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - if (LOCAL_SHA1) - message("BRL-CAD bext checkout command: ${GIT_EXEC} -c advice.detachedHead=false checkout ${LOCAL_SHA1}") - execute_process( - COMMAND ${GIT_EXEC} -c advice.detachedHead=false checkout ${LOCAL_SHA1} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bext - ) - endif() + message("BRL-CAD bext checkout command: ${GIT_EXEC} -c advice.detachedHead=false checkout ${BEXT_SHA1}") + execute_process( + COMMAND ${GIT_EXEC} -c advice.detachedHead=false checkout ${BEXT_SHA1} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bext + ) # Configure process will need to clean up bext - set(BEXT_SRC_CLEANUP TRUE PARENT_SCOPE) + if (BRLCAD_BEXT_CLEANUP) + set(BEXT_SRC_CLEANUP TRUE PARENT_SCOPE) + endif (BRLCAD_BEXT_CLEANUP) endif() @@ -317,7 +365,11 @@ function(brlcad_ext_setup) set(BEXT_BLD_CLEANUP FALSE) if(NOT EXISTS ${BRLCAD_EXT_BUILD_DIR}) file(MAKE_DIRECTORY ${BRLCAD_EXT_BUILD_DIR}) - set(BEXT_BLD_CLEANUP TRUE) + if (BRLCAD_BEXT_CLEANUP) + # If the cleanup step is specifically enabled, we need to clear the build + # dir after completing to save space. + set(BEXT_BLD_CLEANUP TRUE) + endif(BRLCAD_BEXT_CLEANUP) endif(NOT EXISTS ${BRLCAD_EXT_BUILD_DIR}) # Need to control options for this based on BRL-CAD configure settings. diff --git a/misc/CMake/BRLCAD_ExternalDeps.cmake b/misc/CMake/BRLCAD_ExternalDeps.cmake index 48f2c1d236c..c94ed695fc5 100644 --- a/misc/CMake/BRLCAD_ExternalDeps.cmake +++ b/misc/CMake/BRLCAD_ExternalDeps.cmake @@ -501,7 +501,7 @@ function(rpath_build_dir_process ROOT_DIR lf) endif(APPLE) endfunction(rpath_build_dir_process) -# Utility routines for bext management +# bext repository management include(BRLCAD_EXT_Setup) ##################################################################### @@ -509,7 +509,7 @@ include(BRLCAD_EXT_Setup) # keep the build directory copies of ${BRLCAD_EXT_DIR}/install files # in sync with the BRLCAD_EXT_DIR originals, if they change. ##################################################################### -function(brlcad_process_ext) +function(brlcad_bext_process) if(BRLCAD_DISABLE_RELOCATION) return() @@ -935,7 +935,7 @@ function(brlcad_process_ext) foreach(ef ${TP_NOINST_FILES}) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${BRLCAD_EXT_NOINSTALL_DIR}/${ef}) endforeach(ef ${TP_NOINST_FILES}) -endfunction(brlcad_process_ext) +endfunction(brlcad_bext_process) ##################################################################### # We want find_package calls that re-run every time configure is run, diff --git a/misc/CMake/distcheck_repo_verify.cmake.in b/misc/CMake/distcheck_repo_verify.cmake.in index 43b674ee29d..0eb67ae3914 100644 --- a/misc/CMake/distcheck_repo_verify.cmake.in +++ b/misc/CMake/distcheck_repo_verify.cmake.in @@ -45,15 +45,12 @@ set(NOT_DISTCHECK_READY 0) set(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") # Avoid empty items in lists, so we don't trigger a CMake warning -# Also ignore src/bext submodule function(scrub_list SLIST) set(NONEMPTY) foreach(sf ${${SLIST}}) - if(NOT "${sf}" STREQUAL "src/bext") - if(NOT "${sf}" STREQUAL "") - list(APPEND NONEMPTY "${sf}") - endif(NOT "${sf}" STREQUAL "") - endif(NOT "${sf}" STREQUAL "src/bext") + if(NOT "${sf}" STREQUAL "") + list(APPEND NONEMPTY "${sf}") + endif(NOT "${sf}" STREQUAL "") endforeach(sf ${${SLIST}}) string(REGEX REPLACE "^;" "" NONEMPTY "${NONEMPTY}") set(${SLIST} ${NONEMPTY} PARENT_SCOPE) diff --git a/misc/CMake/source_archive_setup.cmake.in b/misc/CMake/source_archive_setup.cmake.in index 5f60e328d0d..1ad29554b67 100644 --- a/misc/CMake/source_archive_setup.cmake.in +++ b/misc/CMake/source_archive_setup.cmake.in @@ -131,39 +131,6 @@ if(NOT EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/create_builddir_source_archive.done") endwhile(HAVE_EMPTY_DIRS) message("Removing empty directories... done.") - # If we're instructed to, populate the ext directory to make a self contained - # tarball - set(CPACK_INCLUDE_EXT @CPACK_INCLUDE_EXT@) - if(CPACK_INCLUDE_EXT) - if(NOT EXISTS "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext") - message("Populating src/bext...") - find_program(GIT_EXEC git REQUIRED) - execute_process( - COMMAND ${GIT_EXEC} clone -b RELEASE https://github.com/BRL-CAD/bext.git - WORKING_DIRECTORY "@CMAKE_BINARY_DIR@/source_archive_contents/src" - ) - execute_process( - COMMAND ${CMAKE_COMMAND} -E make_directory "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext/build" - ) - execute_process( - COMMAND ${CMAKE_COMMAND} .. -DENABLE_ALL=ON -DUSE_APPLESEED=ON -DUSE_OSPRAY=ON - WORKING_DIRECTORY "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext/build" - ) - execute_process( - COMMAND ${CMAKE_COMMAND} -E rm -r "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext/build" - ) - execute_process( - COMMAND ${CMAKE_COMMAND} -E rm -r "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext/.git" - ) - file(GLOB_RECURSE gcontents RELATIVE "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext" ".git*") - foreach(SF ${gcontents}) - execute_process( - COMMAND ${CMAKE_COMMAND} -E rm -r "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext/${SF}" - ) - endforeach(SF ${gcontents}) - message("Populating src/bext... done.") - endif(NOT EXISTS "@CMAKE_BINARY_DIR@/source_archive_contents/src/bext") - endif(CPACK_INCLUDE_EXT) endif(NOT EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/create_builddir_source_archive.done") # Local Variables: diff --git a/sh/CMakeLists.txt b/sh/CMakeLists.txt index 91a17857fe9..b9784868465 100644 --- a/sh/CMakeLists.txt +++ b/sh/CMakeLists.txt @@ -33,7 +33,6 @@ set( make_rpm.sh news2tracker.sh template.sh - update_bext.sh ws.sh sandbox/metaring.sh sandbox/orbit.sh diff --git a/sh/update_bext.sh b/sh/update_bext.sh deleted file mode 100755 index 5305fc89baf..00000000000 --- a/sh/update_bext.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -git submodule update --remote --recursive - -git add src/bext - -git commit -m "update external deps to latest" - -git push - diff --git a/src/bext b/src/bext deleted file mode 160000 index 0c539a0395d..00000000000 --- a/src/bext +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0c539a0395d3bed52093457b72f98f3b74e2dbda