Revision: 77391
http://sourceforge.net/p/brlcad/code/77391
Author: starseeker
Date: 2020-10-09 19:14:02 +0000 (Fri, 09 Oct 2020)
Log Message:
-----------
Start working on integrating the new superbuild setup back into the parent
build.
Modified Paths:
--------------
brlcad/branches/thirdparty_rework/CMakeLists.txt
brlcad/branches/thirdparty_rework/misc/CMake/BRLCAD_Install_Prefix.cmake
brlcad/branches/thirdparty_rework/misc/CMake/FindLEMON.cmake
brlcad/branches/thirdparty_rework/misc/CMake/FindPERPLEX.cmake
brlcad/branches/thirdparty_rework/misc/tools/dom2dox/CMake/FindPERPLEX.cmake
brlcad/branches/thirdparty_rework/src/libgcv/plugins/obj/wfobj/CMake/FindPERPLEX.cmake
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
brlcad/branches/thirdparty_rework/src/superbuild/netpbm.cmake
brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake
Modified: brlcad/branches/thirdparty_rework/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/CMakeLists.txt 2020-10-09 18:24:04 UTC
(rev 77390)
+++ brlcad/branches/thirdparty_rework/CMakeLists.txt 2020-10-09 19:14:02 UTC
(rev 77391)
@@ -49,9 +49,6 @@
# stored in one directory - let CMake know where to find them. If we
# are a subbuild, let the parent's CMAKE_MODULE_PATH supply files before
# our own, otherwise misc/CMake takes first priority.
-#
-# Since both the superbuild and the main build use these modules, we
-# need this definition up front.
set(BRLCAD_CMAKE_DIR "${BRLCAD_SOURCE_DIR}/misc/CMake")
list(APPEND CMAKE_MODULE_PATH "${BRLCAD_CMAKE_DIR}")
@@ -165,114 +162,8 @@
# are not using the system versions and IFF they are required based on the
# feature settings enabled.
-# In order to make this work with a minimum of disruption to BRL-CAD's primary
-# build, it is necessary that all required 3rd party dependencies not being
-# managed as part of the main build are prepared and ready *before* we do the
-# work of configuring BRL-CAD itself (beyond the initial determination of
-# feature settings, which is needed to decide whether to enable or disable the
-# 3rd party components in the first place.)
+add_subdirectory(src/superbuild)
-# Historically this was done in BRL-CAD by treating ALL 3rd party builds as
-# integrated CMake builds, which offers advantages for packaging, but is
-# practical only when the 3rd party components in question also use CMake for
-# their build systems. If they didn't, BRL-CAD had to produce such a build
-# system. That was viable early on, but only scales to a point - we cannot
-# rewrite many large, complex build systems for many large dependencies.
-
-# The alternative which allows us to use external build systems directly is the
-# ExternalProject_Add function provided by CMake, but that imposes its own
-# constraints. In particular, the "install" step of the ExternalProject is run
-# independently, not as part of the BRL-CAD install target. Originally this
-# meant that if we wanted to use ExternalProject, we had to have write access
-# to the final install location for the CMAKE_INSTALL_PREFIX during the *build*
-# process - something that can't always be assured. However, since the
-# original solution (writing our own CMake builds) doesn't scale indefinitely,
-# another solution is needed.
-
-# An initial attempt was made to integrate ExternalProject into the main build
-# and manage the build outputs, but while aspects of this worked it proved
-# impossible to produce a reliably ordered build - CMake does not provide the
-# necessary ordering mechanisms to ensure a complete execution of the
-# ExternalProject cycle before starting to build standard object file targets
-# in the primary build. This means that (for example) headers which need to be
-# generated by an ExternalProject to successfully compile object files in the
-# main build may not be there reliably.
-
-# The "standard" solution in CMake to this problem is what's called the
-# "superbuild" pattern, in which all necessary builds (including the "primary"
-# build of the project) are managed by a single, higher level build whose job
-# is to manage the ordering and dependencies among the ExternalProjet targets.
-# Because the dependency ordering between ExternalProject targets *does*
-# provide the necessary guarantees, it is possible to prepare a reliably
-# building system. Unfortunately, for BRL-CAD this greatly complicates the
-# custom logic previously prepared to support working from both build and
-# install locations, as well as the logic providing information about install
-# target locations to libbu directory management mechanisms.
-
-# To work around this issue, we exploit one other guaranteed ordering in the
-# workflow process - the configure step itself. In this mode, the setup and
-# compilation of any necessary 3rd party dependencies are invoked by the
-# configure stage, rather than the build stage. In essence, it becomes
-# the role of configure not simply to detect dependencies, but to guarantee
-# them - whether by system detection or by triggering the compilation process
-# to create them. The superbuild mechanism is still used with ExternalProject
-# to prepare them, allowing for managing non-CMake based external builds, but
-# that process is independent of the main BRL-CAD build, which just needs to
-# call find_package with the appropriate arguments.
-
-# We need some custom logic to augment ExternalProject_Add:
-# Note- make sure CMAKE_BINARY_DIR and CMAKE_INSTALL_PREFIX are finalized
-# BEFORE including this file!
-include(ExternalProject)
-include(ExternalProject_Target)
-
-# Step 1 is to write out all BRL-CAD related variables to a file for
-# loading by the 3rd party superbuild: (https://stackoverflow.com/a/9328525)
-file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/superbuild")
-file(WRITE ${CMAKE_BINARY_DIR}/superbuild/brlcad_vars.cmake "\# Feature
variables\n")
-get_cmake_property(VARS VARIABLES)
-list(SORT VARS)
-foreach(v ${VARS})
- if ("${v}" MATCHES "^BRLCAD*" AND NOT "${v}" MATCHES "DESCRIPTION$" AND NOT
"${v}" MATCHES "AVAILABLE$")
- file(APPEND ${CMAKE_BINARY_DIR}/superbuild/brlcad_vars.cmake "set(${v}
\"${${v}}\")\n")
- endif ()
-endforeach(v ${VARS})
-
-# Now we prepare and invoke the superbuild as a separate process
-execute_process(
- COMMAND ${CMAKE_COMMAND} -S ${CMAKE_SOURCE_DIR}/src/superbuild
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
-DCMAKE_BUILD_RPATH=${CMAKE_BUILD_RPATH}
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/superbuild"
- )
-execute_process(
- COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/superbuild -j12
--config Release --target all
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/superbuild"
- )
-
-if (NOT EXISTS ${CMAKE_BINARY_DIR}/superbuild.cmake)
- message(FATAL_ERROR "Third party library info file
${CMAKE_BINARY_DIR}/superbuild.cmake was not found.")
-endif (NOT EXISTS ${CMAKE_BINARY_DIR}/superbuild.cmake)
-
-# Find packages based on superbuild results
-include(${CMAKE_BINARY_DIR}/superbuild.cmake)
-find_package(LEMON)
-find_package(RE2C)
-find_package(PERPLEX)
-find_package(ZLIB)
-find_package(PNG)
-find_package(REGEX)
-find_package(NETPBM)
-if (BRLCAD_ENABLE_STEPCODE)
- find_package(STEPCODE)
-endif (BRLCAD_ENABLE_STEPCODE)
-#find_package(BSON)
-if (BRLCAD_ENABLE_GDAL)
- find_package(PROJ4)
- find_package(GDAL)
-endif (BRLCAD_ENABLE_GDAL)
-if (BRLCAD_ENABLE_TCL)
- find_package(TCL)
-endif (BRLCAD_ENABLE_TCL)
-
#---------------------------------------------------------------------
# Let CMake know where to look for our counting file for configuration
# passes. It will impact whether we print certain messages
@@ -2145,11 +2036,6 @@
set(IWIDGETS_VERSION "4.1.1")
CONFIG_H_APPEND(BRLCAD "#cmakedefine IWIDGETS_VERSION
\"${IWIDGETS_VERSION}\"\n")
-if(BRLCAD_ENABLE_TK)
- CONFIG_H_APPEND(BRLCAD "#define HAVE_TK 1\n")
-endif(BRLCAD_ENABLE_TK)
-
-
if(BRLCAD_PRINT_MSGS)
message("***********************************************************")
message("* Stage 9 of 9 - Output and Summarize Config *")
Modified:
brlcad/branches/thirdparty_rework/misc/CMake/BRLCAD_Install_Prefix.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/misc/CMake/BRLCAD_Install_Prefix.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++ brlcad/branches/thirdparty_rework/misc/CMake/BRLCAD_Install_Prefix.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -46,12 +46,12 @@
# To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value
# is available, BRLCAD_PREFIX is used to store the value in the cache.)
-if(BRLCAD_INSTALL_PREFIX)
- if(NOT "${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr/local")
- get_filename_component(PATH_NORMALIZED
"${BRLCAD_INSTALL_PREFIX}/${LIB_DIR}" ABSOLUTE)
+if(CMAKE_INSTALL_PREFIX)
+ if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
+ get_filename_component(PATH_NORMALIZED
"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}" ABSOLUTE)
set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
- endif(NOT "${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr/local")
-endif(BRLCAD_INSTALL_PREFIX)
+ endif(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
+endif(CMAKE_INSTALL_PREFIX)
if(BRLCAD_PREFIX)
if(NOT "${BRLCAD_PREFIX}" STREQUAL "/usr" AND NOT "${BRLCAD_PREFIX}"
STREQUAL "/usr/local")
get_filename_component(PATH_NORMALIZED "${BRLCAD_PREFIX}/${LIB_DIR}"
ABSOLUTE)
Modified: brlcad/branches/thirdparty_rework/misc/CMake/FindLEMON.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/misc/CMake/FindLEMON.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++ brlcad/branches/thirdparty_rework/misc/CMake/FindLEMON.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -66,9 +66,13 @@
foreach(search ${_LEMON_SEARCHES})
find_program(LEMON_EXECUTABLE lemon ${${search}} PATH_SUFFIXES bin)
endforeach()
-
mark_as_advanced(LEMON_EXECUTABLE)
+foreach(search ${_LEMON_SEARCHES})
+ find_file(LEMON_TEMPLATE lempar.c ${${search}} PATH_SUFFIXES ${DATA_DIR}
${DATA_DIR}/lemon)
+endforeach()
+mark_as_advanced(LEMON_TEMPLATE)
+
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
# look for the template in share
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
Modified: brlcad/branches/thirdparty_rework/misc/CMake/FindPERPLEX.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/misc/CMake/FindPERPLEX.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++ brlcad/branches/thirdparty_rework/misc/CMake/FindPERPLEX.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -66,9 +66,13 @@
foreach(search ${_PERPLEX_SEARCHES})
find_program(PERPLEX_EXECUTABLE perplex ${${search}} PATH_SUFFIXES bin)
endforeach()
-
mark_as_advanced(PERPLEX_EXECUTABLE)
+foreach(search ${_PERPLEX_SEARCHES})
+ find_file(PERPLEX_TEMPLATE perplex_template.c ${${search}} PATH_SUFFIXES
${DATA_DIR} ${DATA_DIR}/perplex)
+endforeach()
+mark_as_advanced(PERPLEX_TEMPLATE)
+
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} PATH)
if(perplex_path)
Modified:
brlcad/branches/thirdparty_rework/misc/tools/dom2dox/CMake/FindPERPLEX.cmake
===================================================================
---
brlcad/branches/thirdparty_rework/misc/tools/dom2dox/CMake/FindPERPLEX.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++
brlcad/branches/thirdparty_rework/misc/tools/dom2dox/CMake/FindPERPLEX.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
-find_program(PERPLEX_EXECUTABLE perplex DOC "path to the perplex executable")
+set(_PERPLEX_SEARCHES)
+
+# Search PERPLEX_ROOT first if it is set.
+if(PERPLEX_ROOT)
+ set(_PERPLEX_SEARCH_ROOT PATHS ${PERPLEX_ROOT} NO_DEFAULT_PATH)
+ list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_ROOT)
+endif()
+
+# Normal search.
+set(_PERPLEX_x86 "(x86)")
+set(_PERPLEX_SEARCH_NORMAL
+ PATHS "$ENV{ProgramFiles}/perplex"
+ "$ENV{ProgramFiles${_PERPLEX_x86}}/perplex")
+unset(_PERPLEX_x86)
+list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_NORMAL)
+
+set(PERPLEX_NAMES perplex)
+
+# Try each search configuration.
+foreach(search ${_PERPLEX_SEARCHES})
+ find_program(PERPLEX_EXECUTABLE perplex ${${search}} PATH_SUFFIXES bin)
+endforeach()
mark_as_advanced(PERPLEX_EXECUTABLE)
+foreach(search ${_PERPLEX_SEARCHES})
+ find_file(PERPLEX_TEMPLATE perplex_template.c ${${search}} PATH_SUFFIXES
${DATA_DIR} ${DATA_DIR}/perplex)
+endforeach()
+mark_as_advanced(PERPLEX_TEMPLATE)
+
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} PATH)
if(perplex_path)
Modified:
brlcad/branches/thirdparty_rework/src/libgcv/plugins/obj/wfobj/CMake/FindPERPLEX.cmake
===================================================================
---
brlcad/branches/thirdparty_rework/src/libgcv/plugins/obj/wfobj/CMake/FindPERPLEX.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++
brlcad/branches/thirdparty_rework/src/libgcv/plugins/obj/wfobj/CMake/FindPERPLEX.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
-find_program(PERPLEX_EXECUTABLE perplex DOC "path to the perplex executable")
+set(_PERPLEX_SEARCHES)
+
+# Search PERPLEX_ROOT first if it is set.
+if(PERPLEX_ROOT)
+ set(_PERPLEX_SEARCH_ROOT PATHS ${PERPLEX_ROOT} NO_DEFAULT_PATH)
+ list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_ROOT)
+endif()
+
+# Normal search.
+set(_PERPLEX_x86 "(x86)")
+set(_PERPLEX_SEARCH_NORMAL
+ PATHS "$ENV{ProgramFiles}/perplex"
+ "$ENV{ProgramFiles${_PERPLEX_x86}}/perplex")
+unset(_PERPLEX_x86)
+list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_NORMAL)
+
+set(PERPLEX_NAMES perplex)
+
+# Try each search configuration.
+foreach(search ${_PERPLEX_SEARCHES})
+ find_program(PERPLEX_EXECUTABLE perplex ${${search}} PATH_SUFFIXES bin)
+endforeach()
mark_as_advanced(PERPLEX_EXECUTABLE)
+foreach(search ${_PERPLEX_SEARCHES})
+ find_file(PERPLEX_TEMPLATE perplex_template.c ${${search}} PATH_SUFFIXES
${DATA_DIR} ${DATA_DIR}/perplex)
+endforeach()
+mark_as_advanced(PERPLEX_TEMPLATE)
+
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} PATH)
if(perplex_path)
Modified:
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
===================================================================
---
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -68,7 +68,7 @@
# Custom patch utility to replace the build directory path with the install
# directory path in text files - make sure CMAKE_BINARY_DIR and
# CMAKE_INSTALL_PREFIX are finalized before generating this file!
-configure_file(${CMAKE_SOURCE_DIR}/CMake/buildpath_replace.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
+configure_file(${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/buildpath_replace.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
add_executable(buildpath_replace
${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
function(ExternalProject_ByProducts etarg extproj extroot E_IMPORT_PREFIX
target_dir)
Modified: brlcad/branches/thirdparty_rework/src/superbuild/netpbm.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/netpbm.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++ brlcad/branches/thirdparty_rework/src/superbuild/netpbm.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -47,7 +47,9 @@
ppmfloyd.h
)
+ set(NETPBM_LIBRARY netpbm CACHE STRING "Building bundled netpbm" FORCE)
set(NETPBM_LIBRARIES netpbm CACHE STRING "Building bundled netpbm" FORCE)
+ set(NETPBM_INCLUDE_DIR
"${CMAKE_INSTALL_PREFIX}/$<CONFIG>/${INCLUDE_DIR}/netpbm" CACHE STRING
"Directory containing netpbm headers." FORCE)
set(NETPBM_INCLUDE_DIRS
"${CMAKE_INSTALL_PREFIX}/$<CONFIG>/${INCLUDE_DIR}/netpbm" CACHE STRING
"Directory containing netpbm headers." FORCE)
SetTargetFolder(NETPBM_BLD "Third Party Libraries")
Modified: brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
2020-10-09 18:24:04 UTC (rev 77390)
+++ brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
2020-10-09 19:14:02 UTC (rev 77391)
@@ -29,6 +29,12 @@
perplex_template.c
)
+ set(LEMON_TEMPLATE
"${CMAKE_BINARY_DIR}/$<CONFIG>/${DATA_DIR}/lemon/lempar.c" CACHE PATH "lemon
template" FORCE)
+ set(LEMON_EXECUTABLE
"${CMAKE_BINARY_DIR}/$<CONFIG>/${BIN_DIR}/lemon${EXE_EXT}" CACHE PATH "lemon"
FORCE)
+
+ set(PERPLEX_TEMPLATE
"${CMAKE_BINARY_DIR}/$<CONFIG>/${DATA_DIR}/perplex/perplex_template.c" CACHE
PATH "perplex template" FORCE)
+ set(PERPLEX_EXECUTABLE
"${CMAKE_BINARY_DIR}/$<CONFIG>/${BIN_DIR}/perplex${EXE_EXT}" CACHE PATH
"perplex" FORCE)
+
endif (BRLCAD_LEVEL2)
# Local Variables:
Modified: brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake 2020-10-09
18:24:04 UTC (rev 77390)
+++ brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake 2020-10-09
19:14:02 UTC (rev 77391)
@@ -47,7 +47,10 @@
zlib.h
)
+ set(ZLIB_LIBRARY_DEBUG zlib CACHE STRING "Building bundled zlib" FORCE)
+ set(ZLIB_LIBRARY_RELEASE zlib CACHE STRING "Building bundled zlib" FORCE)
set(ZLIB_LIBRARIES zlib CACHE STRING "Building bundled zlib" FORCE)
+ set(ZLIB_INCLUDE_DIR "${CMAKE_BINARY_DIR}/$<CONFIG>/${INCLUDE_DIR}" CACHE
STRING "Directory containing zlib headers." FORCE)
set(ZLIB_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/$<CONFIG>/${INCLUDE_DIR}" CACHE
STRING "Directory containing zlib headers." FORCE)
SetTargetFolder(ZLIB_BLD "Third Party Libraries")
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits