Revision: 77370
http://sourceforge.net/p/brlcad/code/77370
Author: starseeker
Date: 2020-10-08 20:23:14 +0000 (Thu, 08 Oct 2020)
Log Message:
-----------
Start roughing out another approach, this time trying to plan ahead a bit more
for multiconfig (in particular the new Ninja multiconfig, which requires
multiconfig RPath handling...)
Modified Paths:
--------------
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
brlcad/branches/thirdparty_rework/src/superbuild/CMake/RPath_Setup.cmake
brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt
brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake
Modified:
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
===================================================================
---
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
2020-10-08 18:27:01 UTC (rev 77369)
+++
brlcad/branches/thirdparty_rework/src/superbuild/CMake/ExternalProject_Target.cmake
2020-10-08 20:23:14 UTC (rev 77370)
@@ -22,18 +22,57 @@
# to be ready. The key variable CMAKE_BUILD_RPATH comes from running the
# function cmake_set_rpath, which must be available.
+# Be quite about tool outputs by default
+if(NOT DEFINED EXTPROJ_VERBOSE)
+ set(EXTPROJ_VERBOSE 0)
+endif(NOT DEFINED EXTPROJ_VERBOSE)
+
+# When staging files in the build directory, we have to be aware of multiple
+# configurations. This is done post-ExternalProject build, at the parent build
+# time, so it needs to be a custom command. Until add_custom_command outputs
+# can use $<CONFIG>, we need to handle multi-config situations manually with
+# multiple copy commands.
+#
+# cmake -E copy follows symlinks to get the final file, which is not what we
+# want in this situation. To avoid this, we create a copy script which uses
+# file(COPY) and run that script with cmake -P
+file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/cp.cmake"
"get_filename_component(DDIR \${DEST} DIRECTORY)\nfile(COPY \${SRC} DESTINATION
\${DDIR})")
+
+function(fcfgcpy outvar extproj root dir ofile tfile)
+ #message("extproj: ${extproj}")
+ #message("root: ${root}")
+ #message("dir: ${dir}")
+ #message("ofile: ${ofile}")
+ #message("tfile: ${tfile}")
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_custom_command(
+ OUTPUT "${CMAKE_BINARY_DIR}/${dir}/${tfile}"
+ COMMAND ${CMAKE_COMMAND} -DSRC="${root}/${ofile}"
-DDEST="${CMAKE_BINARY_DIR}/${dir}/${tfile}" -P
"${CMAKE_BINARY_DIR}/CMakeFiles/cp.cmake"
+ DEPENDS ${extproj}
+ )
+ set(TOUT ${TOUT} "${CMAKE_BINARY_DIR}/${dir}/${tfile}")
+ else (NOT CMAKE_CONFIGURATION_TYPES)
+ foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+ add_custom_command(
+ OUTPUT "${CMAKE_BINARY_DIR}/${CFG_TYPE}/${dir}/${tfile}"
+ COMMAND ${CMAKE_COMMAND} -DSRC="${root}/${ofile}"
-DDEST="${CMAKE_BINARY_DIR}/${CFG_TYPE}/${dir}/${tfile}" -P
"${CMAKE_BINARY_DIR}/CMakeFiles/cp.cmake"
+ DEPENDS ${extproj}
+ )
+ set(TOUT ${TOUT} "${CMAKE_BINARY_DIR}/${CFG_TYPE}/${dir}/${tfile}")
+ endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+ endif (NOT CMAKE_CONFIGURATION_TYPES)
+ set(${outvar} ${TOUT} PARENT_SCOPE)
+endfunction(fcfgcpy file)
+
+
# 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(${BDEPS_SOURCE_DIR}/CMake/buildpath_replace.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
+configure_file(${CMAKE_SOURCE_DIR}/CMake/buildpath_replace.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
add_executable(buildpath_replace
${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
-# Custom patch utility for external RPath preparation
-configure_file(${BDEPS_SOURCE_DIR}/CMake/rpath_replace.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/rpath_replace.cxx @ONLY)
-add_executable(rpath_replace ${CMAKE_CURRENT_BINARY_DIR}/rpath_replace.cxx)
+function(ExternalProject_ByProducts etarg extproj extroot E_IMPORT_PREFIX
target_dir)
-function(ExternalProject_ByProducts extproj E_IMPORT_PREFIX)
-
cmake_parse_arguments(E "FIXPATH" "" "" ${ARGN})
if (EXTPROJ_VERBOSE)
@@ -55,25 +94,33 @@
endif (EXTPROJ_VERBOSE)
+ unset(TOUT)
foreach (bpf ${E_UNPARSED_ARGUMENTS})
+ # If a relative prefix was specified, construct the "source" file using it.
+ # This is used to save verbosity in ByProducts input lists.
+ if (E_IMPORT_PREFIX)
+ set(ofile ${E_IMPORT_PREFIX}/${bpf})
+ else (E_IMPORT_PREFIX)
+ set(ofile ${bpf})
+ endif (E_IMPORT_PREFIX)
- set(D_IMPORT_PREFIX "${E_IMPORT_PREFIX}")
- get_filename_component(BPF_DIR "${bpf}" DIRECTORY)
- if (BPF_DIR)
- set(D_IMPORT_PREFIX "${D_IMPORT_PREFIX}/${BPF_DIR}")
- endif (BPF_DIR)
+ fcfgcpy(TOUT ${extproj} ${extroot} "${target_dir}" ${ofile} ${bpf})
- set(I_IMPORT_PREFIX ${CMAKE_BINARY_DIR}/${E_IMPORT_PREFIX})
- install(FILES "${I_IMPORT_PREFIX}/${bpf}" DESTINATION
"${D_IMPORT_PREFIX}/")
+ install(FILES "${CMAKE_BINARY_DIR}/$<CONFIG>/${target_dir}/${bpf}"
DESTINATION "${target_dir}/")
if (E_FIXPATH)
# Note - proper quoting for install(CODE) is extremely important for
CPack, see
# https://stackoverflow.com/a/48487133
- install(CODE "execute_process(COMMAND
${CMAKE_BINARY_DIR}/${BIN_DIR}/buildpath_replace${CMAKE_EXECUTABLE_SUFFIX}
\"\${CMAKE_INSTALL_PREFIX}/${E_IMPORT_PREFIX}/${bpf}\")")
+ install(CODE "execute_process(COMMAND $<TARGET_FILE:buildpath_replace>
\"\${CMAKE_INSTALL_PREFIX}/${E_IMPORT_PREFIX}/${bpf}\")")
endif (E_FIXPATH)
-
endforeach (bpf ${E_UNPARSED_ARGUMENTS})
+ if (E_UNPARSED_ARGUMENTS)
+ string(MD5 UKEY "${E_UNPARSED_ARGUMENTS}")
+ add_custom_target(${etarg}_${UKEY} ALL DEPENDS ${TOUT})
+ add_dependencies(${etarg} ${etarg}_${UKEY})
+ endif (E_UNPARSED_ARGUMENTS)
+
endfunction(ExternalProject_ByProducts)
@@ -90,6 +137,7 @@
else()
set(IMPORT_PREFIX "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
endif(ET_STATIC)
+ message("prefix: ${IMPORT_PREFIX}")
if(IN_IMPORT_PREFIX)
set(IMPORT_PREFIX "${IMPORT_PREFIX}/${IN_IMPORT_PREFIX}")
endif(IN_IMPORT_PREFIX)
@@ -100,19 +148,21 @@
IMPORTED_SONAME_NOCONFIG "${IN_LINK_TARGET}"
)
+ message("${IMPORT_PREFIX}/${IN_LINK_TARGET}")
+ message("${IN_LINK_TARGET}")
+
else(NOT CMAKE_CONFIGURATION_TYPES)
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
- # The config variables are the ones set in this mode, but everything is
being targeted to
- # one consistent top-level layout. Adjust accordingly.
+ # The config variables are the ones set in this mode.
if(ET_STATIC)
- set(IMPORT_PREFIX
"${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}/../../${LIB_DIR}")
+ set(IMPORT_PREFIX "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
elseif(ET_EXEC)
- set(IMPORT_PREFIX
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}/../../${BIN_DIR}")
+ set(IMPORT_PREFIX "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
else()
- set(IMPORT_PREFIX
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}/../../${LIB_DIR}")
+ set(IMPORT_PREFIX "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
endif(ET_STATIC)
if(IN_IMPORT_PREFIX)
@@ -119,6 +169,8 @@
set(IMPORT_PREFIX "${IMPORT_PREFIX}/${IN_IMPORT_PREFIX}")
endif(IN_IMPORT_PREFIX)
+ message("IMPORT_PREFIX: ${IMPORT_PREFIX}")
+
if("${CFG_TYPE_UPPER}" STREQUAL "DEBUG")
set(LINK_TARGET ${ET_LINK_TARGET_DEBUG})
else("${CFG_TYPE_UPPER}" STREQUAL "DEBUG")
@@ -125,6 +177,8 @@
set(LINK_TARGET ${IN_LINK_TARGET})
endif("${CFG_TYPE_UPPER}" STREQUAL "DEBUG")
+ message("LINK_TARGET: ${LINK_TARGET}")
+
set_target_properties(${etarg} PROPERTIES
IMPORTED_LOCATION_${CFG_TYPE_UPPER} "${IMPORT_PREFIX}/${LINK_TARGET}"
IMPORTED_SONAME_${CFG_TYPE_UPPER} "${LINK_TARGET}"
@@ -148,7 +202,7 @@
# MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release
# )
- endif(NOT CMAKE_CONFIGURATION_TYPES)
+ endif(NOT CMAKE_CONFIGURATION_TYPES)
endfunction(ET_target_props)
@@ -192,7 +246,6 @@
set(NEW_RPATH "$ENV{DESTDIR}${RRPATH}:@loader_path/${OPATH}")
endif (NOT APPLE)
if (NOT DEFINED CMAKE_BUILD_RPATH)
- return()
message(FATAL_ERROR "ET_RPath run without CMAKE_BUILD_RPATH defined - run
cmake_set_rpath before defining external projects.")
endif (NOT DEFINED CMAKE_BUILD_RPATH)
if (NOT "${SUB_DIR}" STREQUAL "")
@@ -204,16 +257,18 @@
# https://stackoverflow.com/a/48487133
install(CODE "
file(RPATH_CHANGE
- FILE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OUTPUT_DIR}/${OFINAL}\"
+ FILE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OFINAL}\"
OLD_RPATH \"${CMAKE_BUILD_RPATH}\"
NEW_RPATH \"${NEW_RPATH}\")
")
endfunction(ET_RPath)
-function(ExternalProject_Target etarg extproj)
- cmake_parse_arguments(E "RPATH;EXEC"
"SUBDIR;OUTPUT_FILE;LINK_TARGET;LINK_TARGET_DEBUG;STATIC_OUTPUT_FILE;STATIC_LINK_TARGET;STATIC_LINK_TARGET_DEBUG"
"SYMLINKS;DEPS" ${ARGN})
+function(ExternalProject_Target etarg extproj extroot)
+
+ cmake_parse_arguments(E "RPATH"
"EXEC;SHARED;STATIC;LINK_TARGET;LINK_TARGET_DEBUG;STATIC_LINK_TARGET;STATIC_LINK_TARGET_DEBUG"
"SYMLINKS;DEPS" ${ARGN})
+
if(NOT TARGET ${extproj})
message(FATAL_ERROR "${extprog} is not a target")
endif(NOT TARGET ${extproj})
@@ -226,25 +281,26 @@
message(FATAL_ERROR "Target ${etarg}-static is already defined\n")
endif(E_STATIC AND TARGET ${etarg}-static)
- if (EXTPROJ_VERBOSE)
- message("${extproj}: Adding target \"${etarg}\"")
- endif (EXTPROJ_VERBOSE)
+ message("${extproj}: Adding target \"${etarg}\"")
- if (E_STATIC_OUTPUT_FILE)
- set(E_STATIC 1)
- endif (E_STATIC_OUTPUT_FILE)
-
- if (E_OUTPUT_FILE AND NOT E_EXEC)
- set(E_SHARED 1)
- endif (E_OUTPUT_FILE AND NOT E_EXEC)
-
- if (E_LINK_TARGET_DEBUG AND NOT MSVC)
- set(LINK_TARGET_DEBUG "${E_LINK_TARGET_DEBUG}")
- endif (E_LINK_TARGET_DEBUG AND NOT MSVC)
-
+ if (E_LINK_TARGET AND NOT MSVC)
+ set(LINK_TARGET "${E_LINK_TARGET}")
+ endif (E_LINK_TARGET AND NOT MSVC)
+ if (NOT MSVC)
+ if (E_LINK_TARGET_DEBUG)
+ set(LINK_TARGET_DEBUG "${E_LINK_TARGET_DEBUG}")
+ elseif (E_LINK_TARGET)
+ set(LINK_TARGET_DEBUG "${E_LINK_TARGET}")
+ else (E_LINK_TARGET_DEBUG)
+ set(LINK_TARGET_DEBUG "${E_SHARED}")
+ endif (E_LINK_TARGET_DEBUG)
+ endif (NOT MSVC)
if (E_STATIC_LINK_TARGET_DEBUG AND NOT MSVC)
- set(STATIC LINK_TARGET_DEBUG "${E_STATIC_LINK_TARGET_DEBUG}")
+ set(LINK_TARGET "${E_STATIC_LINK_TARGET}")
endif (E_STATIC_LINK_TARGET_DEBUG AND NOT MSVC)
+ if (E_STATIC_LINK_TARGET_DEBUG AND NOT MSVC)
+ set(STATIC_LINK_TARGET_DEBUG "${E_STATIC_LINK_TARGET_DEBUG}")
+ endif (E_STATIC_LINK_TARGET_DEBUG AND NOT MSVC)
# Create imported target - need to both make the target itself
# and set the necessary properties. See also
@@ -252,59 +308,91 @@
# Because the outputs are not properly build target outputs of the primary
# CMake project, we need to install as either FILES or PROGRAMS
- if (NOT E_EXEC)
+ set(TOUT)
- # Handle shared library
- if (E_SHARED)
- add_library(${etarg} SHARED IMPORTED GLOBAL)
- if (E_LINK_TARGET AND NOT MSVC)
- ET_target_props(${etarg} "${E_IMPORT_PREFIX}" ${E_LINK_TARGET}
LINK_TARGET_DEBUG "${LINK_TARGET_DEBUG}")
- else (E_LINK_TARGET AND NOT MSVC)
- ET_target_props(${etarg} "${E_IMPORT_PREFIX}" ${E_OUTPUT_FILE}
LINK_TARGET_DEBUG "${LINK_TARGET_DEBUG}")
- endif (E_LINK_TARGET AND NOT MSVC)
+ # Handle shared library
+ message("Adding imported library: ${etarg}")
+ message("Adding imported library: ${E_SHARED}")
+ if (E_SHARED)
+ add_library(${etarg} SHARED IMPORTED GLOBAL)
+ string(REPLACE "${LIB_DIR}/" "" ENAME ${E_SHARED})
+ fcfgcpy(TOUT ${extproj} ${extroot} ${LIB_DIR} ${E_SHARED} ${ENAME})
+ if (E_LINK_TARGET AND NOT MSVC)
+ ET_target_props(${etarg} "${E_IMPORT_PREFIX}" ${E_LINK_TARGET}
LINK_TARGET_DEBUG "${LINK_TARGET_DEBUG}")
+ string(REPLACE "${LIB_DIR}/" "" ENAME ${E_LINK_TARGET})
+ else (E_LINK_TARGET AND NOT MSVC)
+ ET_target_props(${etarg} "${E_IMPORT_PREFIX}" ${E_SHARED}
LINK_TARGET_DEBUG "${LINK_TARGET_DEBUG}")
+ endif (E_LINK_TARGET AND NOT MSVC)
- install(FILES
"${CMAKE_BINARY_DIR}/${LIB_DIR}/${E_SUBDIR}/${E_OUTPUT_FILE}" DESTINATION
${LIB_DIR}/${E_SUBDIR})
- if (E_RPATH AND NOT MSVC)
- ET_RPath("${LIB_DIR}" "${LIB_DIR}" "${E_SUBDIR}" "${E_OUTPUT_FILE}")
- endif (E_RPATH AND NOT MSVC)
- endif (E_SHARED)
+ install(FILES "${CMAKE_BINARY_DIR}/$<CONFIG>/${E_SHARED}" DESTINATION
${LIB_DIR}/${E_SUBDIR})
- # If we do have a static lib as well, handle that
- if (E_STATIC AND BUILD_STATIC_LIBS)
- add_library(${etarg}-static STATIC IMPORTED GLOBAL)
- if (E_STATIC_LINK_TARGET AND NOT MSVC)
- ET_target_props(${etarg}-static "${E_IMPORT_PREFIX}"
${E_STATIC_LINK_TARGET} STATIC_LINK_TARGET_DEBUG "${STATIC_LINK_TARGET_DEBUG}"
STATIC)
- else (E_STATIC_LINK_TARGET AND NOT MSVC)
- ET_target_props(${etarg}-static "${E_IMPORT_PREFIX}"
${E_STATIC_OUTPUT_FILE} STATIC_LINK_TARGET_DEBUG "${STATIC_LINK_TARGET_DEBUG}"
STATIC)
- endif (E_STATIC_LINK_TARGET AND NOT MSVC)
- if (MSVC)
- install(FILES
"${CMAKE_BINARY_DIR}/${BIN_DIR}/${E_SUBDIR}/${E_OUTPUT_FILE}" DESTINATION
${BIN_DIR}/${E_SUBDIR})
- else (MSVC)
- install(FILES
"${CMAKE_BINARY_DIR}/${LIB_DIR}/${E_SUBDIR}/${E_OUTPUT_FILE}" DESTINATION
${LIB_DIR}/${E_SUBDIR})
- endif (MSVC)
- endif (E_STATIC AND BUILD_STATIC_LIBS)
+ # Perform RPath magic
+ if (E_RPATH AND NOT MSVC)
+ ET_RPath("${LIB_DIR}" "${LIB_DIR}" "" "${E_SHARED}")
+ endif (E_RPATH AND NOT MSVC)
- else (NOT E_EXEC)
+ endif (E_SHARED)
+ # If we do have a static lib as well, handle that
+ if (E_STATIC AND BUILD_STATIC_LIBS)
+ add_library(${etarg}-static STATIC IMPORTED GLOBAL)
+ if (E_STATIC_LINK_TARGET AND NOT MSVC)
+ ET_target_props(${etarg}-static "${E_IMPORT_PREFIX}"
${E_STATIC_LINK_TARGET} STATIC_LINK_TARGET_DEBUG "${STATIC_LINK_TARGET_DEBUG}"
STATIC)
+ else (E_STATIC_LINK_TARGET AND NOT MSVC)
+ ET_target_props(${etarg}-static "${E_IMPORT_PREFIX}"
${E_STATIC_OUTPUT_FILE} STATIC_LINK_TARGET_DEBUG "${STATIC_LINK_TARGET_DEBUG}"
STATIC)
+ endif (E_STATIC_LINK_TARGET AND NOT MSVC)
+ if (MSVC)
+ string(REPLACE "${BIN_DIR}/" "" ENAME ${E_STATIC})
+ fcfgcpy(TOUT ${extproj} ${extroot} ${BIN_DIR} ${E_STATIC} ${ENAME})
+ install(FILES "${CMAKE_BINARY_DIR}/$<CONFIG>/${E_STATIC}" DESTINATION
${BIN_DIR}/${E_SUBDIR})
+ else (MSVC)
+ string(REPLACE "${LIB_DIR}/" "" ENAME ${E_STATIC})
+ fcfgcpy(TOUT ${extproj} ${extroot} ${LIB_DIR} ${E_STATIC} ${ENAME})
+ install(FILES "${CMAKE_BINARY_DIR}/$<CONFIG>/${E_STATIC}" DESTINATION
${LIB_DIR}/${E_SUBDIR})
+ endif (MSVC)
+ # Let CMake know there is a target dependency here, despite this being an
import target
+ add_dependencies(${etarg}-static ${extproj})
+ endif (E_STATIC AND BUILD_STATIC_LIBS)
+
+ if (E_EXEC)
add_executable(${etarg} IMPORTED GLOBAL)
- ET_target_props(${etarg} "${E_IMPORT_PREFIX}" ${E_OUTPUT_FILE} EXEC)
- install(PROGRAMS
"${CMAKE_BINARY_DIR}/${BIN_DIR}/${E_SUBDIR}/${E_OUTPUT_FILE}" DESTINATION
${BIN_DIR}/${E_SUBDIR})
+
+ string(REPLACE "${BIN_DIR}/" "" ENAME ${E_EXEC})
+ fcfgcpy(TOUT ${extproj} ${extroot} ${BIN_DIR} ${E_EXEC} ${ENAME})
+ ET_target_props(${etarg} "${E_IMPORT_PREFIX}" ${E_EXEC} EXEC)
+ install(PROGRAMS "${CMAKE_BINARY_DIR}/$<CONFIG>/${E_EXEC}" DESTINATION
${BIN_DIR}/${E_SUBDIR})
+
+ # Let CMake know there is a target dependency here, despite this being an
import target
+ add_dependencies(${etarg} ${extproj})
+
+ # Perform RPath magic
if (E_RPATH AND NOT MSVC)
- ET_RPath("${LIB_DIR}" "${BIN_DIR}" "${E_SUBDIR}" "${E_OUTPUT_FILE}")
+ ET_RPath("${LIB_DIR}" "${BIN_DIR}" "" "${E_EXEC}")
endif (E_RPATH AND NOT MSVC)
+ endif (E_EXEC)
- endif (NOT E_EXEC)
-
- # Let CMake know there is a target dependency here, despite this being an
import target
- add_dependencies(${etarg} ${extproj})
-
- # Add install rules for any symlinks the caller has listed
+ # Add install rules for any symlinks the caller has listed
if(E_SYMLINKS AND NOT MSVC)
foreach(slink ${E_SYMLINKS})
- install(FILES "${CMAKE_BINARY_DIR}/${LIB_DIR}/${E_SUBDIR}/${slink}"
DESTINATION ${LIB_DIR}/${E_SUBDIR})
+ string(REPLACE "${LIB_DIR}/" "" ENAME ${slink})
+ fcfgcpy(TOUT ${extproj} ${extroot} ${LIB_DIR} ${slink} ${ENAME})
+ install(FILES "${CMAKE_BINARY_DIR}/$<CONFIG>/${LIB_DIR}/${ENAME}"
DESTINATION ${LIB_DIR})
endforeach(slink ${E_SYMLINKS})
endif(E_SYMLINKS AND NOT MSVC)
+ # Let CMake know there is a target dependency here, despite this being an
import target
+
+ if (TOUT)
+ add_custom_target(${etarg}_stage ALL DEPENDS ${TOUT})
+ endif (TOUT)
+
+ if (TARGET ${etarg})
+ add_dependencies(${etarg} ${etarg}_stage ${extproj})
+ endif (TARGET ${etarg})
+ if (TARGET ${etarg}-static)
+ add_dependencies(${etarg}-static ${etarg}_stage ${extproj})
+ endif (TARGET ${etarg}-static)
+
endfunction(ExternalProject_Target)
# Local Variables:
Modified:
brlcad/branches/thirdparty_rework/src/superbuild/CMake/RPath_Setup.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/CMake/RPath_Setup.cmake
2020-10-08 18:27:01 UTC (rev 77369)
+++ brlcad/branches/thirdparty_rework/src/superbuild/CMake/RPath_Setup.cmake
2020-10-08 20:23:14 UTC (rev 77370)
@@ -29,109 +29,177 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+include(CMakeParseArguments)
+
+# Relative path specifiers are platform specific. Encapsulate them in a
+# function to hide the details from other code.
+function(relative_rpath outvar)
+
+ cmake_parse_arguments(R "" "SUFFIX" "" ${ARGN})
+
+ if (R_SUFFIX)
+ set(DPATH)
+ set(CPATH "${R_SUFFIX}")
+ while (NOT "${CPATH}" STREQUAL "")
+ set(DPATH "../${DPATH}")
+ get_filename_component(CPATH "${CPATH}" DIRECTORY)
+ endwhile()
+ else ()
+ set(DPATH "../")
+ endif (R_SUFFIX)
+
+ if (APPLE)
+ set(${outvar} ";@loader_path/${DPATH}${LIB_DIR}" PARENT_SCOPE)
+ else (APPLE)
+ set(${outvar} ":\$ORIGIN/${DPATH}${LIB_DIR}" PARENT_SCOPE)
+ endif (APPLE)
+
+endfunction(relative_rpath)
+
+# Set (or restore) a standard BRL-CAD setting for CMAKE_BUILD_RPATH.
+function(std_build_rpath)
+ # If we're in multiconfig mode, we need to look relative to the current
+ # build configuration, not the top level lib directory.
+ if (CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/$<CONFIG>/${LIB_DIR}")
+ else (CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/${LIB_DIR}")
+ endif (CMAKE_CONFIGURATION_TYPES)
+
+ # Done - let the parent know what the answers are
+ set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" PARENT_SCOPE)
+endfunction(std_build_rpath)
+
#---------------------------------------------------------------------
-# The following logic is what allows binaries to run successfully in
-# the build directory AND install directory.
-# http://www.cmake.org/Wiki/CMake_RPATH_handling
+# Settings for CMAKE_RPATH_BUILD that support custom manipulation of
+# external project outputs.
-include(CMakeParseArguments)
+# TODO - investigate using BUILD_RPATH and INSTALL_RPATH on a per
+# target basis for more precise control (for example, when setting
+# up paths for libs in subdirs... not sure yet if it could be helpful
+# but should be explored.
-# For a given path, calculate the $ORIGIN style path needed relative
-# to CMAKE_INSTALL_PREFIX
-function(SUFFIX_STRING POPATH INIT_PATH)
+# Note in particular that BUILD_RPATH supports generator expressions,
+# in case that's of use to pull other properties on which to base
+# rpaths...
- get_filename_component(CPATH "${INIT_PATH}" REALPATH)
- set(RELDIRS)
- set(FPATH)
- while (NOT "${CPATH}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
- get_filename_component(CDIR "${CPATH}" NAME)
- get_filename_component(CPATH "${CPATH}" DIRECTORY)
- if (NOT "${RELDIRS}" STREQUAL "")
- set(RELDIRS "${CDIR}/${RELDIRS}")
- set(FPATH "../${FPATH}")
- else (NOT "${RELDIRS}" STREQUAL "")
- set(RELDIRS "${CDIR}")
- set(FPATH "../")
- endif (NOT "${RELDIRS}" STREQUAL "")
- endwhile()
+# Can use set_property: https://stackoverflow.com/a/40147991
- set(FPATH "${FPATH}${RELDIRS}")
+# To allow CMake to manipulate RPaths, we need to make sure they are all the
+# same length and long enough to hold the longest candidate path we will need.
+#
+# NOTE: Since we haven't yet created any lib subdirectories that may be created
+# by 3rd party builds, we can't check them for explicit length - for now, we
+# use 20 as an upper bound on how long a directory name we might need there,
+# but that will need to be updated in the event a more verbosely named library
+# subdirectory shows up.
+function(longest_rpath outvar)
- set(${POPATH} ${FPATH} PARENT_SCOPE)
-endfunction(SUFFIX_STRING)
+ cmake_parse_arguments(R "" "SUFFIX" "" ${ARGN})
+ # Microsoft platforms don't do RPATH
+ if (MSVC)
+ return()
+ endif (MSVC)
-if(NOT COMMAND cmake_set_rpath)
+ # The possible roots are CMAKE_INSTALL_PREFIX and CMAKE_BINARY_DIR.
+ # Find out which is longer
+ string(LENGTH "${CMAKE_INSTALL_PREFIX}" ILEN)
+ string(LENGTH "${CMAKE_BINARY_DIR}" BLEN)
+ if ("${ILEN}" GREATER "${BLEN}")
+ set(ROOT_LEN "${ILEN}")
+ else ("${ILEN}" GREATER "${BLEN}")
+ set(ROOT_LEN "${BLEN}")
+ endif ("${ILEN}" GREATER "${BLEN}")
- function(cmake_set_rpath)
+ # Find the longest of the configuration string names
+ # (this will be zero in a non-multiconfig build)
+ set(CONF_LEN 0)
+ foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
+ string(LENGTH "/${cfg}" CLEN)
+ if ("${CLEN}" GREATER "${CONF_LEN}")
+ set(CONF_LEN ${CLEN})
+ endif ("${CLEN}" GREATER "${CONF_LEN}")
+ endforeach(cfg ${CMAKE_CONFIGURATION_TYPES})
- # See if we have a suffix for the paths
- cmake_parse_arguments(R "" "SUFFIX" "" ${ARGN})
+ # The length of LIB_DIR itself needs to be factored in
+ if (R_SUFFIX)
+ string(LENGTH "/${LIB_DIR}/${R_SUFFIX}" LIB_LEN)
+ else (R_SUFFIX)
+ string(LENGTH "/${LIB_DIR}" LIB_LEN)
+ endif (R_SUFFIX)
- # We want the full RPATH set in the build tree so we can run programs
without
- # needing to set LD_LIBRARY_PATH
- set(CMAKE_SKIP_BUILD_RPATH FALSE PARENT_SCOPE)
+ # Hardcoded estimate of maximum lib subdir length
+ #
+ # *** UPDATE THIS IF UNABLE TO SET RPATH FOR LIBRARIES IN SUBDIRS ***
+ #
+ set(SUBLIB_LEN 20)
- # We DON'T want the final install directory RPATH set in the build
directory
- # - it should only be set to the installation value when actually
installed.
- set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE PARENT_SCOPE)
+ # Include the relative path specifier length:
+ if (R_SUFFIX)
+ relative_rpath(RELPATH SUFFIX "${R_SUFFIX}")
+ else (R_SUFFIX)
+ relative_rpath(RELPATH)
+ endif (R_SUFFIX)
+ string(LENGTH "${RELPATH}" REL_LEN)
- # Add the automatically determined parts of the RPATH which point to
- # directories outside the build tree to the install RPATH
- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE PARENT_SCOPE)
+ math(EXPR len "${ROOT_LEN} + ${CONF_LEN} + ${LIB_LEN} + ${SUBLIB_LEN} +
${REL_LEN}")
- # Set an initial RPATH to use for length calculations
- if(NOT R_SUFFIX)
- set(LSUFFIX "${LIB_DIR}")
- else(NOT R_SUFFIX)
- set(LSUFFIX "${LIB_DIR}/${R_SUFFIX}")
- endif(NOT R_SUFFIX)
+ set(${outvar} ${len} PARENT_SCOPE)
- # Calculate how many ../ offsets are needed to return from this directory
- # to the install origin
- set(OPATH)
- SUFFIX_STRING(OPATH "${CMAKE_INSTALL_PREFIX}/${LSUFFIX}")
+endfunction(longest_rpath)
- # Set RPATH value to use when installing. This should be set to always
- # prefer the version in the installed path when possible, but fall back on
a
- # location relative to the loading file's path if the installed version is
- # not present. How to do so is platform specific.
- if(NOT APPLE)
- set(CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_PREFIX}/${LSUFFIX}:\$ORIGIN/${OPATH}/${LSUFFIX}")
- else(NOT APPLE)
- set(CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_PREFIX}/${LSUFFIX};@loader_path/${OPATH}/${LSUFFIX}")
- endif(NOT APPLE)
- # Determine what the build time RPATH will be that is used to support
- # CMake's RPATH manipulation, so it can be used in external projects.
+function(ext_build_rpath)
- # TODO - need to check behavior when the BUILD_RPATH is longer than the
INSTALL_RPATH -
- # it should work, but the install rpath won't overwrite the extra chars
with : as is - we
- # may need to do that to make sure only the correct paths are present
- set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/${LSUFFIX}")
- string(LENGTH "${CMAKE_INSTALL_RPATH}" INSTALL_LEN)
- string(LENGTH "${CMAKE_BUILD_RPATH}" CURR_LEN)
- while("${CURR_LEN}" LESS "${INSTALL_LEN}")
- # This is the key to the process - the ":" characters appended to the
- # build time path result in a path string in the compile outputs that
- # has sufficient length to hold the install directory, while is what
- # allows CMake's file command to manipulate the paths. At the same time,
- # the colon lengthened paths do not break the functioning of the shorter
- # build path. Normally this is an internal CMake detail, but we need it
- # to supply to external build systems so their outputs can be manipulated
- # as if they were outputs of our own build.
- set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}:")
- string(LENGTH "${CMAKE_BUILD_RPATH}" CURR_LEN)
- endwhile("${CURR_LEN}" LESS "${INSTALL_LEN}")
+ # Microsoft platforms don't do RPATH
+ if (MSVC)
+ return()
+ endif (MSVC)
- # Done - let the parent know what the answers are
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" PARENT_SCOPE)
- set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" PARENT_SCOPE)
+ cmake_parse_arguments(R "" "SUFFIX" "" ${ARGN})
- endfunction(cmake_set_rpath)
+ if (R_SUFFIX)
+ longest_rpath(LLEN SUFFIX "${R_SUFFIX}")
+ else (R_SUFFIX)
+ longest_rpath(LLEN)
+ endif (R_SUFFIX)
-endif(NOT COMMAND cmake_set_rpath)
+ # If we're in multiconfig mode, we want to target the config subdir, not just
+ # the build dir itself.
+ if (CMAKE_CONFIGURATION_TYPES)
+ if (R_SUFFIX)
+ set(BUILD_RPATH "${CMAKE_BINARY_DIR}/$<CONFIG>/${LIB_DIR}/${R_SUFFIX}")
+ else (R_SUFFIX)
+ set(BUILD_RPATH "${CMAKE_BINARY_DIR}/$<CONFIG>/${LIB_DIR}")
+ endif (R_SUFFIX)
+ else (CMAKE_CONFIGURATION_TYPES)
+ if (R_SUFFIX)
+ set(BUILD_RPATH "${CMAKE_BINARY_DIR}/${LIB_DIR}/${R_SUFFIX}")
+ else (R_SUFFIX)
+ set(BUILD_RPATH "${CMAKE_BINARY_DIR}/${LIB_DIR}")
+ endif (R_SUFFIX)
+ endif (CMAKE_CONFIGURATION_TYPES)
+ # This is the key to the process - the ":" characters appended to the build
+ # time path result in a path string in the compile outputs that has
+ # sufficient length to hold the install directory, while is what allows
+ # CMake's file command to manipulate the paths. At the same time, the colon
+ # lengthened paths do not break the functioning of the shorter build path.
+ # Normally this is an internal CMake detail, but we need it to supply to
+ # external build systems so their outputs can be manipulated as if they were
+ # outputs of our own build.
+ string(LENGTH "${BUILD_RPATH}" CURR_LEN)
+ while("${CURR_LEN}" LESS "${LLEN}")
+ set(BUILD_RPATH "${BUILD_RPATH}:")
+ string(LENGTH "${BUILD_RPATH}" CURR_LEN)
+ endwhile("${CURR_LEN}" LESS "${LLEN}")
+
+ # Done - let the parent know what the answers are
+ set(CMAKE_BUILD_RPATH "${BUILD_RPATH}" PARENT_SCOPE)
+
+endfunction(ext_build_rpath)
+
# Local Variables:
# tab-width: 8
# mode: cmake
Modified: brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt
2020-10-08 18:27:01 UTC (rev 77369)
+++ brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt
2020-10-08 20:23:14 UTC (rev 77370)
@@ -30,6 +30,17 @@
cmake_minimum_required(VERSION 3.12)
+# Find the executable extension, if there is one
+get_filename_component(EXE_EXT "${CMAKE_COMMAND}" EXT)
+
+# If targets are built, we want to group them in build tools that support
+# doing so.
+function(SetTargetFolder targetname folder)
+ if(TARGET ${targetname})
+ set_target_properties(${targetname} PROPERTIES FOLDER "${folder}")
+ endif(TARGET ${targetname})
+endfunction(SetTargetFolder)
+
# If defined, get feature variables from parent
if (EXISTS ${CMAKE_BINARY_DIR}/brlcad_vars.cmake)
include(${CMAKE_BINARY_DIR}/brlcad_vars.cmake)
@@ -44,16 +55,52 @@
# and mess up the results...
set(CMAKE_SYSTEM_IGNORE_PATH "${CMAKE_INSTALL_PREFIX}")
+#---------------------------------------------------------------------
+# Define relative install locations and output directories. Don't set
+# these if they have already been set by some other means (like a
+# higher level CMakeLists.txt file including this one).
+# For output directories - where built library and executable
+# files will be placed after building but prior to install. The
+# necessary variables change between single and multi configuration
+# build systems, so it is necessary to handle both cases on a
+# conditional basis.
+
include(Path_Setup)
-# If targets are built, we want to group them in build tools that support
-# doing so.
-function(SetTargetFolder targetname folder)
- if(TARGET ${targetname})
- set_target_properties(${targetname} PROPERTIES FOLDER "${folder}")
- endif(TARGET ${targetname})
-endfunction(SetTargetFolder)
+#---------------------------------------------------------------------
+# RPath handling is what allows us to run binaries from the build
+# directory without having to set LD_LIBRARY_PATH, and what allows
+# for relocatable binary packages on Linux and similar platforms.
+# BRL-CAD's needs are rather complex when it comes to RPath, so we
+# define a series of functions:
+include(RPath_Setup)
+# We want the full RPATH set in the build tree so we can run programs without
+# needing to set LD_LIBRARY_PATH
+set(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+# We DON'T want the final install directory RPATH set in the build directory
+# - it should only be set to the installation value when actually installed.
+set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+# Add the automatically determined parts of the RPATH which point to
+# directories outside the build tree to the install RPATH
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+# Set RPATH value to use when installing. This should be set to always
+# prefer the version in the installed path when possible, but fall back on a
+# location relative to the loading file's path if the installed version is
+# not present. How to do so is platform specific.
+relative_rpath(RELPATH)
+set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}${RELPATH}")
+
+# 3rd party build outputs use a CMAKE_RPATH_BUILD setting that is different
+# from the "vanilla" management used with other BRL-CAD targets. The
+# function below encapsulates the setup needed for CMAKE_RPATH_BUILD
+ext_build_rpath()
+
+
+#---------------------------------------------------------------------
# By default, changes in src/superbuild files won't trigger a rebuild. Setting
# this to 1 changes that, but at the expense of running the build step every
# time. This may be fast if there is nothing to update in the project, but it
@@ -134,12 +181,6 @@
# hardcoded.
set(BRLCAD_DEPS)
-# It's not enough to simply generate the outputs - we'll also need to install
-# them, which means passing the relevant information back up to the parent
-# build. We do so with a file the parent build knows to look for:
-set(SUPERBUILD_OUT "${BRLCAD_BINARY_DIR}/superbuild.cmake")
-file(WRITE "${SUPERBUILD_OUT}" "\#superbuild outputs\n")
-
###############################################################################
# BRL-CAD and some of its dependencies require the lemon, re2c and perplex
# tools for compilation. They are not installed, but must be available. We
@@ -160,79 +201,79 @@
# zlib compression/decompression library
include(${CMAKE_CURRENT_SOURCE_DIR}/zlib.cmake)
-# libregex regular expression matching
-include(${CMAKE_CURRENT_SOURCE_DIR}/regex.cmake)
+## libregex regular expression matching
+#include(${CMAKE_CURRENT_SOURCE_DIR}/regex.cmake)
+#
+## netpbm library - support for pnm,ppm,pbm, etc. image files
+#include(${CMAKE_CURRENT_SOURCE_DIR}/netpbm.cmake)
+#
+## libpng - Portable Network Graphics image file support
+#include(${CMAKE_CURRENT_SOURCE_DIR}/png.cmake)
+#
+## STEPcode - support for reading and writing STEP files
+#include(${CMAKE_CURRENT_SOURCE_DIR}/stepcode.cmake)
+#
+## libbson - for binary attributes, always use this local version
+#include(${CMAKE_CURRENT_SOURCE_DIR}/bson.cmake)
+#
+## PROJ4 - generic coordinate transformation
+#include(${CMAKE_CURRENT_SOURCE_DIR}/proj4.cmake)
+#
+## GDAL - translator library for raster and vector geospatial data formats
+#include(${CMAKE_CURRENT_SOURCE_DIR}/gdal.cmake)
+#
+## TCL - scripting language
+#include(${CMAKE_CURRENT_SOURCE_DIR}/tcl.cmake)
+#include(${CMAKE_CURRENT_SOURCE_DIR}/tk.cmake)
+#include(${CMAKE_CURRENT_SOURCE_DIR}/itcl.cmake)
+#include(${CMAKE_CURRENT_SOURCE_DIR}/itk.cmake)
+#include(${CMAKE_CURRENT_SOURCE_DIR}/iwidgets.cmake)
+#
+## For anything we've built here, we need to let the parent build know
+## where to go looking for key components
+#if (TARGET PERPLEX_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(LEMON_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
+# file(APPEND "${SUPERBUILD_OUT}" "set(LEMON_TEMPLATE
${BRLCAD_BINARY_DIR}/${DATA_DIR}/lemon/lempar.c)\n")
+# file(APPEND "${SUPERBUILD_OUT}" "set(RE2C_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
+# file(APPEND "${SUPERBUILD_OUT}" "set(PERPLEX_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
+# file(APPEND "${SUPERBUILD_OUT}" "set(PERPLEX_TEMPLATE
${BRLCAD_BINARY_DIR}/${DATA_DIR}/perplex/perplex_template.c)\n")
+#else (TARGET PERPLEX_BLD)
+# message(FATAL_ERROR "Failed to build perplex\n")
+#endif (TARGET PERPLEX_BLD)
+#if (TARGET NETPBM_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(NETPBM_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
+#endif (TARGET NETPBM_BLD)
+#if (TARGET STEPCODE_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(STEPCODE_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
+#endif (TARGET STEPCODE_BLD)
+#if (TARGET BSON_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(BSON_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
+#endif (TARGET BSON_BLD)
+#if (TARGET PROJ4_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(PROJ4_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
+#endif (TARGET PROJ4_BLD)
+#if (TARGET GDAL_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(GDAL_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
+#endif (TARGET GDAL_BLD)
+#if (TARGET TCL_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(TCL_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
+#endif (TARGET TCL_BLD)
+#
+## (For REGEX, ZLIB and PNG we need to do a little extra work and supply our
+## custom library names so find_package knows about them.)
+#if (TARGET REGEX_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(REGEX_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
+# file(APPEND "${SUPERBUILD_OUT}" "set(REGEX_LIBRARY
\"${BRLCAD_BINARY_DIR}/${LIB_DIR}/${REGEX_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\")\n")
+#endif (TARGET REGEX_BLD)
+#if (TARGET ZLIB_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(ZLIB_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
+# file(APPEND "${SUPERBUILD_OUT}" "set(ZLIB_LIBRARY
\"${BRLCAD_BINARY_DIR}/${LIB_DIR}/${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\")\n")
+#endif (TARGET ZLIB_BLD)
+#if (TARGET PNG_BLD)
+# file(APPEND "${SUPERBUILD_OUT}" "set(PNG_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
+# file(APPEND "${SUPERBUILD_OUT}" "set(PNG_LIBRARY
\"${BRLCAD_BINARY_DIR}/${LIB_DIR}/${PNG_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\")\n")
+#endif (TARGET PNG_BLD)
-# netpbm library - support for pnm,ppm,pbm, etc. image files
-include(${CMAKE_CURRENT_SOURCE_DIR}/netpbm.cmake)
-
-# libpng - Portable Network Graphics image file support
-include(${CMAKE_CURRENT_SOURCE_DIR}/png.cmake)
-
-# STEPcode - support for reading and writing STEP files
-include(${CMAKE_CURRENT_SOURCE_DIR}/stepcode.cmake)
-
-# libbson - for binary attributes, always use this local version
-include(${CMAKE_CURRENT_SOURCE_DIR}/bson.cmake)
-
-# PROJ4 - generic coordinate transformation
-include(${CMAKE_CURRENT_SOURCE_DIR}/proj4.cmake)
-
-# GDAL - translator library for raster and vector geospatial data formats
-include(${CMAKE_CURRENT_SOURCE_DIR}/gdal.cmake)
-
-# TCL - scripting language
-include(${CMAKE_CURRENT_SOURCE_DIR}/tcl.cmake)
-include(${CMAKE_CURRENT_SOURCE_DIR}/tk.cmake)
-include(${CMAKE_CURRENT_SOURCE_DIR}/itcl.cmake)
-include(${CMAKE_CURRENT_SOURCE_DIR}/itk.cmake)
-include(${CMAKE_CURRENT_SOURCE_DIR}/iwidgets.cmake)
-
-# For anything we've built here, we need to let the parent build know
-# where to go looking for key components
-if (TARGET PERPLEX_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(LEMON_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
- file(APPEND "${SUPERBUILD_OUT}" "set(LEMON_TEMPLATE
${BRLCAD_BINARY_DIR}/${DATA_DIR}/lemon/lempar.c)\n")
- file(APPEND "${SUPERBUILD_OUT}" "set(RE2C_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
- file(APPEND "${SUPERBUILD_OUT}" "set(PERPLEX_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
- file(APPEND "${SUPERBUILD_OUT}" "set(PERPLEX_TEMPLATE
${BRLCAD_BINARY_DIR}/${DATA_DIR}/perplex/perplex_template.c)\n")
-else (TARGET PERPLEX_BLD)
- message(FATAL_ERROR "Failed to build perplex\n")
-endif (TARGET PERPLEX_BLD)
-if (TARGET NETPBM_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(NETPBM_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
-endif (TARGET NETPBM_BLD)
-if (TARGET STEPCODE_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(STEPCODE_ROOT
\"${BRLCAD_BINARY_DIR}\")\n")
-endif (TARGET STEPCODE_BLD)
-if (TARGET BSON_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(BSON_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
-endif (TARGET BSON_BLD)
-if (TARGET PROJ4_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(PROJ4_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
-endif (TARGET PROJ4_BLD)
-if (TARGET GDAL_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(GDAL_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
-endif (TARGET GDAL_BLD)
-if (TARGET TCL_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(TCL_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
-endif (TARGET TCL_BLD)
-
-# (For REGEX, ZLIB and PNG we need to do a little extra work and supply our
-# custom library names so find_package knows about them.)
-if (TARGET REGEX_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(REGEX_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
- file(APPEND "${SUPERBUILD_OUT}" "set(REGEX_LIBRARY
\"${BRLCAD_BINARY_DIR}/${LIB_DIR}/${REGEX_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\")\n")
-endif (TARGET REGEX_BLD)
-if (TARGET ZLIB_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(ZLIB_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
- file(APPEND "${SUPERBUILD_OUT}" "set(ZLIB_LIBRARY
\"${BRLCAD_BINARY_DIR}/${LIB_DIR}/${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\")\n")
-endif (TARGET ZLIB_BLD)
-if (TARGET PNG_BLD)
- file(APPEND "${SUPERBUILD_OUT}" "set(PNG_ROOT \"${BRLCAD_BINARY_DIR}\")\n")
- file(APPEND "${SUPERBUILD_OUT}" "set(PNG_LIBRARY
\"${BRLCAD_BINARY_DIR}/${LIB_DIR}/${PNG_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\")\n")
-endif (TARGET PNG_BLD)
-
# Local Variables:
# tab-width: 8
# mode: cmake
Modified: brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
2020-10-08 18:27:01 UTC (rev 77369)
+++ brlcad/branches/thirdparty_rework/src/superbuild/perplex.cmake
2020-10-08 20:23:14 UTC (rev 77370)
@@ -1,13 +1,40 @@
-ExternalProject_Add(PERPLEX_BLD
- SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/perplex"
- BUILD_ALWAYS ${EXTERNAL_BUILD_UPDATE} ${LOG_OPTS}
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DBIN_DIR=${BIN_DIR}
- -DCMAKE_INSTALL_RPATH=${CMAKE_BUILD_RPATH} -DDATA_DIR=${DATA_DIR}
- )
+if (BRLCAD_LEVEL2)
-set(LEMON_TEMPLATE ${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/lemon/lempar.c CACHE
STRING "Lemon template file" FORCE)
-set(PERPLEX_TEMPLATE
"${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/perplex/perplex_template.c" CACHE STRING
"Perplex template file" FORCE)
+ set(PERPLEX_BLD_ROOT ${CMAKE_BINARY_DIR}/superbuild/perplex)
+ ExternalProject_Add(PERPLEX_BLD
+ SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/perplex"
+ BUILD_ALWAYS ${EXTERNAL_BUILD_UPDATE} ${LOG_OPTS}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PERPLEX_BLD_ROOT} -DBIN_DIR=${BIN_DIR}
+ -DCMAKE_INSTALL_RPATH=${CMAKE_BUILD_RPATH} -DDATA_DIR=${DATA_DIR}
+ )
+
+ # Tell the parent about files and libraries
+ ExternalProject_Target(perplex_lemon PERPLEX_BLD ${PERPLEX_BLD_ROOT}
+ EXEC ${BIN_DIR}/lemon${EXE_EXT}
+ RPATH
+ )
+ ExternalProject_Target(perplex_re2c PERPLEX_BLD ${PERPLEX_BLD_ROOT}
+ EXEC ${BIN_DIR}/re2c${EXE_EXT}
+ RPATH
+ )
+ ExternalProject_Target(perplex PERPLEX_BLD ${PERPLEX_BLD_ROOT}
+ EXEC ${BIN_DIR}/perplex${EXE_EXT}
+ RPATH
+ )
+ ExternalProject_ByProducts(perplex PERPLEX_BLD ${PERPLEX_BLD_ROOT}
${DATA_DIR}/lemon ${DATA_DIR}/lemon
+ lempar.c
+ )
+ ExternalProject_ByProducts(perplex PERPLEX_BLD ${PERPLEX_BLD_ROOT}
${DATA_DIR}/perplex ${DATA_DIR}/perplex
+ perplex_template.c
+ )
+
+ set(LEMON_ROOT ${CMAKE_BUILD_RPATH})
+ set(RE2C_ROOT ${CMAKE_BUILD_RPATH})
+ set(PERPLEX_ROOT ${CMAKE_BUILD_RPATH})
+
+endif (BRLCAD_LEVEL2)
+
# Local Variables:
# tab-width: 8
# mode: cmake
Modified: brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake 2020-10-08
18:27:01 UTC (rev 77369)
+++ brlcad/branches/thirdparty_rework/src/superbuild/zlib.cmake 2020-10-08
20:23:14 UTC (rev 77370)
@@ -27,28 +27,24 @@
ExternalProject_Add(ZLIB_BLD
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib"
BUILD_ALWAYS ${EXTERNAL_BUILD_UPDATE} ${LOG_OPTS}
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DLIB_DIR=${LIB_DIR} -DBIN_DIR=${BIN_DIR}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/zlib
-DLIB_DIR=${LIB_DIR} -DBIN_DIR=${BIN_DIR}
-DCMAKE_INSTALL_RPATH=${CMAKE_BUILD_RPATH}
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DZ_PREFIX_STR=${Z_PREFIX_STR}
)
# Tell the parent build about files and libraries
- file(APPEND "${SUPERBUILD_OUT}" "
- ExternalProject_Target(zlib ZLIB_BLD
- OUTPUT_FILE ${ZLIB_BASENAME}${ZLIB_SUFFIX}
- STATIC_OUTPUT_FILE ${ZLIB_BASENAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
- SYMLINKS
\"${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX};${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.1\"
- LINK_TARGET \"${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\"
+ ExternalProject_Target(zlib ZLIB_BLD ${CMAKE_BINARY_DIR}/zlib
+ SHARED ${LIB_DIR}/${ZLIB_BASENAME}${ZLIB_SUFFIX}
+ STATIC ${LIB_DIR}/${ZLIB_BASENAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
+ SYMLINKS
"${LIB_DIR}/${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX};${LIB_DIR}/${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.1"
+ LINK_TARGET "${ZLIB_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
RPATH
)
- ExternalProject_ByProducts(ZLIB_BLD ${INCLUDE_DIR}
+ ExternalProject_ByProducts(zlib ZLIB_BLD ${CMAKE_BINARY_DIR}/zlib
${INCLUDE_DIR} ${INCLUDE_DIR}
zconf.h
zlib.h
)
- \n")
- list(APPEND BRLCAD_DEPS ZLIB_BLD)
-
set(ZLIB_LIBRARIES zlib CACHE STRING "Building bundled zlib" FORCE)
set(ZLIB_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INCLUDE_DIR}" CACHE STRING
"Directory containing zlib headers." FORCE)
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