Revision: 77249
          http://sourceforge.net/p/brlcad/code/77249
Author:   starseeker
Date:     2020-09-27 17:00:36 +0000 (Sun, 27 Sep 2020)
Log Message:
-----------
Get as far as building stepcode

Modified Paths:
--------------
    brlcad/branches/thirdparty_rework/misc/CMake/CMakeLists.txt
    brlcad/branches/thirdparty_rework/misc/CMake/ThirdParty.cmake
    brlcad/branches/thirdparty_rework/misc/tools/lemon/CMakeLists.txt
    brlcad/branches/thirdparty_rework/misc/tools/perplex/CMakeLists.txt
    brlcad/branches/thirdparty_rework/misc/tools/re2c/CMakeLists.txt
    brlcad/branches/thirdparty_rework/src/other/stepcode/CMakeLists.txt
    brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt

Added Paths:
-----------
    brlcad/branches/thirdparty_rework/misc/CMake/ThirdPartyExecutable.cmake

Modified: brlcad/branches/thirdparty_rework/misc/CMake/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/misc/CMake/CMakeLists.txt 2020-09-27 
15:27:03 UTC (rev 77248)
+++ brlcad/branches/thirdparty_rework/misc/CMake/CMakeLists.txt 2020-09-27 
17:00:36 UTC (rev 77249)
@@ -57,6 +57,7 @@
   ResetCache.cmake
   TCL_PKGINDEX.cmake
   ThirdParty.cmake
+  ThirdPartyExecutable.cmake
   ThirdParty_TCL.cmake
   compat/README
   compat/README.compat

Modified: brlcad/branches/thirdparty_rework/misc/CMake/ThirdParty.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/misc/CMake/ThirdParty.cmake       
2020-09-27 15:27:03 UTC (rev 77248)
+++ brlcad/branches/thirdparty_rework/misc/CMake/ThirdParty.cmake       
2020-09-27 17:00:36 UTC (rev 77249)
@@ -34,10 +34,6 @@
 #
 ###
 
-# TODO - remove this line after we require CMake 3.4 - it's built
-# in after that point.
-include(CMakeParseArguments)
-
 # Synopsis:
 #
 # THIRD_PARTY(dir

Added: brlcad/branches/thirdparty_rework/misc/CMake/ThirdPartyExecutable.cmake
===================================================================
--- brlcad/branches/thirdparty_rework/misc/CMake/ThirdPartyExecutable.cmake     
                        (rev 0)
+++ brlcad/branches/thirdparty_rework/misc/CMake/ThirdPartyExecutable.cmake     
2020-09-27 17:00:36 UTC (rev 77249)
@@ -0,0 +1,281 @@
+#      T H I R D P A R T Y E X E C U T A B L E . C M A K E
+# BRL-CAD
+#
+# Copyright (c) 2020 United States Government as represented by
+# the U.S. Army Research Laboratory.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# 3. The name of the author may not be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+###
+
+function(THIRD_PARTY_EXECUTABLE dir varname_root build_target)
+
+  # Parse extra arguments
+  CMAKE_PARSE_ARGUMENTS(TP "NOSYS" "" "REQUIRED_VARS;ALIASES;DESCRIPTION" 
${ARGN})
+
+  # If the exec variable has been explicitly set, get
+  # an normalized version of it for easier matching
+  set(local_opt)
+  if(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
+    set(local_opt "${${CMAKE_PROJECT_NAME}_${varname_root}}")
+  endif(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
+  VAL_NORMALIZE(local_opt ABS)
+
+  # Initialize some variables
+  set(TP_DISABLED 0)
+  set(TP_DISABLE_TEST 0)
+  set(TP_MET_CONDITION 0)
+
+  # 0.  Whether or not we're building the sources, we are tracking the files
+  # that are supposed to be in the directory
+  get_filename_component(DIR_NAME "${dir}" NAME)
+  #if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
+  #  message(FATAL_ERROR "Third party component ${DIR_NAME} does not have a 
dist file at \"${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist\"")
+  #endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
+  #include("${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
+  #CMAKEFILES_IN_DIR(${DIR_NAME}_ignore_files ${dir})
+
+  # 1.  For executables, it is a reasonable use case that the developer 
manually specifies
+  # the location for an executable.  It is tricky to distinguish this 
situation from
+  # a previously cached executable path resulting from a Find*.cmake script.  
The way
+  # we will proceed is to cache the value of ${varname_root}_EXECUTABLE if it 
is defined, and
+  # at the end check it against the results of running the THIRD_PARTY logic.  
If
+  # it matches neither pattern (Bundled or System) it is assumed that the 
value passed
+  # in is an intentional setting on the part of the developer.  This has one 
potential
+  # drawback in that the *removal* of a system executable between searches 
could result
+  # in a previously cached system search result being identified as a 
user-specified
+  # result - to prevent that, the cached path is only used to override other 
results
+  # if the file it specifies actually exists.  One additional wrinkle here - 
if the
+  # developer has hard-specified BUNDLED for this particular executable, even 
a user specified
+  # or cached value will be replaced with the local path.  A feature based 
disablement
+  # of the tool also applies to the cached version.
+  if(${varname_root}_EXECUTABLE)
+    IS_SUBPATH("${CMAKE_BINARY_DIR}" "${${varname_root}_EXECUTABLE}" 
SUBBUILD_TEST)
+    if("${SUBBUILD_TEST}" STREQUAL "0")
+      get_filename_component(FULL_PATH_EXEC ${${varname_root}_EXECUTABLE} 
ABSOLUTE)
+      if("${FULL_PATH_EXEC}" STREQUAL "${${varname_root}_EXECUTABLE}")
+       if(EXISTS ${FULL_PATH_EXEC})
+         set(EXEC_CACHED ${${varname_root}_EXECUTABLE})
+       else(EXISTS ${FULL_PATH_EXEC})
+         # This path not being present may indicate the user specified a path
+         # and made a mistake doing so - warn that this might be the case.
+         message(WARNING "File path ${${varname_root}_EXECUTABLE} specified 
for ${varname_root}_EXECUTABLE does not exist - this path will not override 
${build_target} executable search results.")
+       endif(EXISTS ${FULL_PATH_EXEC})
+      endif("${FULL_PATH_EXEC}" STREQUAL "${${varname_root}_EXECUTABLE}")
+    endif("${SUBBUILD_TEST}" STREQUAL "0")
+  endif(${varname_root}_EXECUTABLE)
+
+  # 2. If any of the required flags are off, this tool is a no-go.
+  set(DISABLE_STR "")
+  foreach(item ${TP_REQUIRED_VARS})
+    if(NOT ${item})
+      set(TP_DISABLED 1)
+      set(TP_DISABLE_TEST 1)
+      set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
+      if(NOT DISABLE_STR)
+       set(DISABLE_STR "${item}")
+      else(NOT DISABLE_STR)
+       set(DISABLE_STR "${DISABLE_STR},${item}")
+      endif(NOT DISABLE_STR)
+    endif(NOT ${item})
+  endforeach(item ${TP_REQUIRED_VARS})
+  if(DISABLE_STR)
+    set(${CMAKE_PROJECT_NAME}_${varname_root} "DISABLED ${DISABLE_STR}" CACHE 
STRING "DISABLED ${DISABLED_STR}" FORCE)
+    mark_as_advanced(FORCE ${CMAKE_PROJECT_NAME}_${varname_root})
+    set(${varname_root}_MET_CONDITION 1)
+    set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
+  else(DISABLE_STR)
+    # If we have a leftover disabled setting in the cache from earlier runs, 
clear it.
+    if("${local_opt}" MATCHES "DISABLED")
+      set(${CMAKE_PROJECT_NAME}_${varname_root} "" CACHE STRING "Clear 
DISABLED setting" FORCE)
+      mark_as_advanced(CLEAR ${CMAKE_PROJECT_NAME}_${varname_root})
+    endif("${local_opt}" MATCHES "DISABLED")
+  endif(DISABLE_STR)
+
+  # 3. Next - is the executable variable explicitly set to SYSTEM?  If it is, 
we are NOT building it.
+  if(local_opt)
+    if("${local_opt}" STREQUAL "SYSTEM")
+      set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
+      set(TP_MET_CONDITION 2)
+      if(TP_NOSYS)
+       message(WARNING "Compilation of ${build_target} was disabled, but local 
copy is modified - using a system version of ${build_target} may introduce 
problems or even fail to work!")
+      endif(TP_NOSYS)
+    endif("${local_opt}" STREQUAL "SYSTEM")
+  endif(local_opt)
+
+  # 4. If we have a NOSYS flag, ALWAYS* use the bundled version.  The NOSYS 
flag signifies that
+  # the BRL-CAD project requires modifications in the local src/other version 
of a library or
+  # tool that are not likely to be present in a system version.  These flags 
should be periodically
+  # reviewed to determine if they can be removed (i.e. system packages have 
appeared in modern
+  # OS distributions with the fixes needed by BRL-CAD...).
+  #
+  # * In the case of executables, we'll allow a cached value from the user to 
override the NOSYS
+  # flag, since that's a likely scenario for testing, but that shouldn't be 
done except for testing
+  # purposes with a NOSYS target.
+  if(NOT TP_MET_CONDITION AND TP_NOSYS)
+    set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED" CACHE STRING "NOSYS 
passed, using bundled ${build_target}" FORCE)
+    mark_as_advanced(${CMAKE_PROJECT_NAME}_${varname_root})
+    set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
+    set(TP_MET_CONDITION 3)
+    set(TP_DISABLE_TEST 1)
+  endif(NOT TP_MET_CONDITION AND TP_NOSYS)
+
+  # 5. If we have an explicit BUNDLE request for this particular executable,  
honor it as long as
+  # features are satisfied.  No point in testing if we know we're turning it 
on - set vars accordingly.
+  if(NOT TP_MET_CONDITION AND "${local_opt}" STREQUAL "BUNDLED")
+    set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
+    set(TP_DISABLE_TEST 1)
+    set(TP_MET_CONDITION 4)
+  endif(NOT TP_MET_CONDITION AND "${local_opt}" STREQUAL "BUNDLED")
+
+
+  # 5. If BRLCAD_BUNDLED_LIBS is exactly SYSTEM or exactly BUNDLED, and we 
haven't been overridden by
+  # one of the other conditions above, go with that.
+  if(NOT TP_MET_CONDITION)
+    if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" 
STREQUAL "BUNDLED")
+      set(${CMAKE_PROJECT_NAME}_${varname_root} "${BRLCAD_BUNDLED_LIBS} 
(AUTO)" CACHE STRING "BRLCAD_BUNDLED_LIBS: ${BRLCAD_BUNDLED_LIBS}" FORCE)
+      if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
+       set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
+       set(TP_MET_CONDITION 5)
+      elseif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
+       set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
+       set(TP_DISABLE_TEST 1)
+       set(TP_MET_CONDITION 5)
+      endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
+    endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR 
"${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
+  endif(NOT TP_MET_CONDITION)
+
+  # If we haven't been knocked out by any of the above conditions, do our 
testing and base the results on that.
+  if(NOT TP_DISABLE_TEST)
+    # Stash the previous results (if any) so we don't repeatedly call out the 
tests - only report
+    # if something actually changes in subsequent runs.
+    set(${varname_root}_FOUND_STATUS ${${varname_root}_FOUND})
+
+    # Initialize (or rather, uninitialize) variables in preparation for search
+    set(${varname_root}_FOUND "${varname_root}-NOTFOUND" CACHE STRING 
"${varname_root}_FOUND" FORCE)
+    mark_as_advanced(${varname_root}_FOUND)
+    set(${varname_root}_EXECUTABLE "${varname_root}-NOTFOUND" CACHE STRING 
"${varname_root}_EXECUTABLE" FORCE)
+
+    # Be quiet if we're doing this over
+    if("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
+      set(${varname_root}_FIND_QUIETLY TRUE)
+    endif("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
+
+    # Include the Find module for the executable in question
+    if(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
+      include(${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
+    else(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
+      include(${CMAKE_ROOT}/Modules/Find${varname_root}.cmake)
+    endif(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
+
+    # going to use system or bundled versions of deps
+    if(${varname_root}_FOUND)
+      set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
+      set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING 
"Found System version, using" FORCE)
+    else(${varname_root}_FOUND)
+      # If one of our previous conditions precludes building this library, 
we've got a problem unless the
+      # cached version is suitable - check that before we warn.
+      if(NOT "${local_opt}" STREQUAL "SYSTEM" AND NOT "${BRLCAD_BUNDLED_LIBS}" 
STREQUAL SYSTEM)
+       set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
+       set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED (AUTO)" CACHE STRING 
"System test failed, enabling local copy" FORCE)
+      endif(NOT "${local_opt}" STREQUAL "SYSTEM" AND NOT 
"${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
+    endif(${varname_root}_FOUND)
+
+  endif(NOT TP_DISABLE_TEST)
+
+  # Now that we've run the Find routine, see if we had a cached value 
different from any of our
+  # standard results
+  set(TP_USING_CACHED 0)
+  if(NOT "${TP_MET_CONDITION}" STREQUAL "1" AND NOT "${TP_MET_CONDITION}" 
STREQUAL "4")
+    if(EXEC_CACHED)
+      # Is it a build target?  If so, don't cache it.
+      get_filename_component(EXEC_CACHED_ABS_PATH ${EXEC_CACHED} ABSOLUTE)
+      IF ("${EXEC_CACHED_ABS_PATH}" STREQUAL "${PATH_ABS}")
+       # Is it the bundled path? (don't override if it is, the bundled option 
setting takes care of that)
+       if(NOT "${EXEC_CACHED}" STREQUAL 
"${CMAKE_BINARY_DIR}/${BIN_DIR}/${build_target}")
+         # Is it the same as the found results?
+         if(NOT "${EXEC_CACHED}" STREQUAL 
"${${varname_root}_EXECUTABLE_FOUND_RESULT}")
+           set(${varname_root}_EXECUTABLE ${EXEC_CACHED} CACHE STRING 
"Apparently a user specified path was supplied, use it" FORCE)
+           set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
+           set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE 
STRING "Apparently a user specified path was supplied, use it" FORCE)
+           set(TP_USING_CACHED 1)
+         endif(NOT "${EXEC_CACHED}" STREQUAL 
"${${varname_root}_EXECUTABLE_FOUND_RESULT}")
+       endif(NOT "${EXEC_CACHED}" STREQUAL 
"${CMAKE_BINARY_DIR}/${BIN_DIR}/${build_target}")
+      endif("${EXEC_CACHED_ABS_PATH}" STREQUAL "${PATH_ABS}")
+    endif(EXEC_CACHED)
+  endif(NOT "${TP_MET_CONDITION}" STREQUAL "1" AND NOT "${TP_MET_CONDITION}" 
STREQUAL "4")
+
+  # If the CACHED value doesn't look good, and we aren't overridden by any of 
the other conditions, set based
+  # on the test results
+  if(NOT TP_USING_CACHED AND NOT TP_DISABLE_TEST)
+    if(${varname_root}_FOUND)
+      set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
+      if(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
+       set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING 
"Found System version, using" FORCE)
+      endif(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
+    else(${varname_root}_FOUND)
+      # If one of our previous conditions precludes building this exec, we've 
got a problem.
+      if("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL 
SYSTEM)
+       set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
+       set(${CMAKE_PROJECT_NAME}_${varname_root}_NOTFOUND 1)
+       message(WARNING "Compilation of local version of ${build_target} was 
disabled, but system version not found!")
+       if(NOT "${local_opt}" STREQUAL "SYSTEM")
+         set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE 
STRING "BRLCAD_BUNDLED_LIBS forced to SYSTEM, but library not found!" FORCE)
+       else(NOT "${local_opt}" STREQUAL "SYSTEM")
+         set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM" CACHE STRING 
"Hard-set to SYSTEM by user, but library not found!" FORCE)
+       endif(NOT "${local_opt}" STREQUAL "SYSTEM")
+      else("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" 
STREQUAL SYSTEM)
+       set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
+       set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED (AUTO)" CACHE STRING 
"System test failed, enabling local copy" FORCE)
+      endif("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" 
STREQUAL SYSTEM)
+    endif(${varname_root}_FOUND)
+  endif(NOT TP_USING_CACHED AND NOT TP_DISABLE_TEST)
+
+  if (TP_ALIASES AND TP_DESCRIPTION)
+    BRLCAD_OPTION("${CMAKE_PROJECT_NAME}_${varname_root}" 
"${${CMAKE_PROJECT_NAME}_${varname_root}}"
+      TYPE ABS
+      ALIASES ${TP_ALIASES}
+      DESCRIPTION "${TP_DESCRIPTION}")
+  endif (TP_ALIASES AND TP_DESCRIPTION)
+
+  mark_as_advanced(${varname_root}_EXECUTABLE)
+  mark_as_advanced(${varname_root}_EXECUTABLE_TARGET)
+  mark_as_advanced(${varname_root}_FOUND)
+
+  # Tell the calling scope what the final result was
+  set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD 
${${CMAKE_PROJECT_NAME}_${varname_root}_BUILD} PARENT_SCOPE)
+
+endfunction(THIRD_PARTY_EXECUTABLE)
+
+# Local Variables:
+# tab-width: 8
+# mode: cmake
+# indent-tabs-mode: t
+# End:
+# ex: shiftwidth=2 tabstop=8


Property changes on: 
brlcad/branches/thirdparty_rework/misc/CMake/ThirdPartyExecutable.cmake
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: brlcad/branches/thirdparty_rework/misc/tools/lemon/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/misc/tools/lemon/CMakeLists.txt   
2020-09-27 15:27:03 UTC (rev 77248)
+++ brlcad/branches/thirdparty_rework/misc/tools/lemon/CMakeLists.txt   
2020-09-27 17:00:36 UTC (rev 77249)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1.3)
+cmake_minimum_required(VERSION 3.12)
 
 # set project name
 PROJECT(LEMON)

Modified: brlcad/branches/thirdparty_rework/misc/tools/perplex/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/misc/tools/perplex/CMakeLists.txt 
2020-09-27 15:27:03 UTC (rev 77248)
+++ brlcad/branches/thirdparty_rework/misc/tools/perplex/CMakeLists.txt 
2020-09-27 17:00:36 UTC (rev 77249)
@@ -34,7 +34,7 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 ###
-cmake_minimum_required(VERSION 3.1.3)
+cmake_minimum_required(VERSION 3.12)
 
 project(PERPLEX)
 

Modified: brlcad/branches/thirdparty_rework/misc/tools/re2c/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/misc/tools/re2c/CMakeLists.txt    
2020-09-27 15:27:03 UTC (rev 77248)
+++ brlcad/branches/thirdparty_rework/misc/tools/re2c/CMakeLists.txt    
2020-09-27 17:00:36 UTC (rev 77249)
@@ -1,5 +1,5 @@
 # Minimum required version of CMake
-cmake_minimum_required(VERSION 3.1.3)
+cmake_minimum_required(VERSION 3.12)
 
 # Set CMake project name
 project(RE2C)

Modified: brlcad/branches/thirdparty_rework/src/other/stepcode/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/src/other/stepcode/CMakeLists.txt 
2020-09-27 15:27:03 UTC (rev 77248)
+++ brlcad/branches/thirdparty_rework/src/other/stepcode/CMakeLists.txt 
2020-09-27 17:00:36 UTC (rev 77249)
@@ -55,7 +55,7 @@
 SET(SC_ABI_VERSION ${SC_ABI_SOVERSION}.0.0)
 
 # Minimum required version of CMake
-cmake_minimum_required(VERSION 3.1.3)
+cmake_minimum_required(VERSION 3.12)
 
 IF( NOT DEFINED INCLUDE_INSTALL_DIR )
   SET( INCLUDE_INSTALL_DIR include )

Modified: brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt
===================================================================
--- brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt     
2020-09-27 15:27:03 UTC (rev 77248)
+++ brlcad/branches/thirdparty_rework/src/superbuild/CMakeLists.txt     
2020-09-27 17:00:36 UTC (rev 77249)
@@ -1,3 +1,6 @@
+# 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)
@@ -18,6 +21,7 @@
 
 # Load some CMake macros to handle the special case of third party libraries.
 include(ThirdParty)
+include(ThirdPartyExecutable)
 
 
 # For now, turn everything on:
@@ -27,7 +31,128 @@
 
 set(BRLCAD_DEPS)
 
+
 ###############################################################################
+# 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
+# ensure they can be found by building them up front if not present on the
+# system.
+###############################################################################
+
+# For those wanting to use a system version of the LEMON parser
+# generator from sqlite, remember that the presence of /usr/bin/lemon
+# is not enough.  LEMON needs a template file, lempar.c, and by
+# default it needs it in the same directory as /usr/bin/lemon.  The
+# typical approach to avoiding that requirement is to patch lemon,
+# like this Gentoo ebuild:
+#
+# http://gentoo-overlays.zugaina.org/gentoo-zh/portage/dev-util/lemon/
+#
+# LEMON packages for other major Linux/BSD distros will do the same.
+# BRL-CAD's FindLEMON.cmake macros will look for the template file in
+# the executable directory first, and if not there will check in
+# /usr/share/lemon (the location used by several distributions.)  If
+# your distribution has a working lemon with the lempar.c template
+# file in a custom location, specify the full path to the template
+# with the variable LEMON_TEMPLATE - something like:
+#
+# cmake .. -DLEMON_TEMPLATE=/etc/lemon/lempar.c
+#
+# This is not to tell LEMON what template to use - that information is
+# usually hardcoded in LEMON itself - but to let FindLEMON.cmake know
+# there is a working LEMON installation.
+set(lemon_DESCRIPTION "
+Option for enabling and disabling compilation of the lemon parser
+provided with BRL-CAD's source distribution.  Default is AUTO,
+responsive to the toplevel BRLCAD_BUNDLED_LIBS option and testing
+first for a system version if BRLCAD_BUNDLED_LIBS is also AUTO.
+")
+THIRD_PARTY_EXECUTABLE(lemon LEMON lemon REQUIRED "BRLCAD_LEVEL2" ALIASES 
"ENABLE_LEMON" DESCRIPTION lemon_DESCRIPTION)
+if (${CMAKE_PROJECT_NAME}_LEMON_BUILD)
+
+  ExternalProject_Add(LEMON_BLD
+    SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../misc/tools/lemon"
+    BUILD_ALWAYS ${EXTERNAL_BUILD_UPDATE} ${LOG_OPTS}
+    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DBIN_DIR=${BIN_DIR}
+    -DCMAKE_INSTALL_RPATH=${CMAKE_BUILD_RPATH}
+    )
+
+  list(APPEND BRLCAD_DEPS LEMON_BLD)
+
+  set(LEMON_TEMPLATE "${CMAKE_SOURCE_DIR}/misc/tools/lemon/lempar.c" CACHE 
STRING "Lemon template file" FORCE)
+  SetTargetFolder(LEMON_BLD "Third Party Libraries")
+endif (${CMAKE_PROJECT_NAME}_LEMON_BUILD)
+
+set(re2c_DESCRIPTION "
+Option for enabling and disabling compilation of the re2c scanner
+utility provided with BRL-CAD's source distribution.  Default is AUTO,
+responsive to the toplevel BRLCAD_BUNDLED_LIBS option and testing
+first for a system version if BRLCAD_BUNDLED_LIBS is also AUTO.
+")
+THIRD_PARTY_EXECUTABLE(re2c RE2C re2c REQUIRED "BRLCAD_LEVEL2" ALIASES 
"ENABLE_RE2C" DESCRIPTION re2c_DESCRIPTION)
+if (${CMAKE_PROJECT_NAME}_RE2C_BUILD)
+
+  if (TARGET LEMON_BLD)
+    set(LEMON_TARGET LEMON_BLD)
+    list(APPEND RE2C_DEPS LEMON_BLD)
+  endif (TARGET LEMON_BLD)
+
+  ExternalProject_Add(RE2C_BLD
+    SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../misc/tools/re2c"
+    BUILD_ALWAYS ${EXTERNAL_BUILD_UPDATE} ${LOG_OPTS}
+    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DBIN_DIR=${BIN_DIR}
+    -DCMAKE_INSTALL_RPATH=${CMAKE_BUILD_RPATH}
+    -DLEMON_ROOT=$<$<BOOL:${LEMON_TARGET}>:${CMAKE_BINARY_DIR}> 
-DLEMON_TEMPLATE=$<$<BOOL:${LEMON_TARGET}>:${LEMON_TEMPLATE}>
+    DEPENDS ${RE2C_DEPS}
+    )
+
+  list(APPEND BRLCAD_DEPS RE2C_BLD)
+
+  SetTargetFolder(RE2C_BLD "Third Party Libraries")
+endif (${CMAKE_PROJECT_NAME}_RE2C_BUILD)
+
+set(perplex_DESCRIPTION "
+Option for enabling and disabling compilation of the perplex scanner
+generator provided with BRL-CAD's source distribution.  Default is
+AUTO, responsive to the toplevel BRLCAD_BUNDLED_LIBS option and
+testing first for a system version if BRLCAD_BUNDLED_LIBS is also
+AUTO.  perplex requires a working re2c.
+")
+THIRD_PARTY_EXECUTABLE(perplex PERPLEX perplex REQUIRED "BRLCAD_LEVEL2" 
ALIASES "ENABLE_PERPLEX" DESCRIPTION perplex_DESCRIPTION NOSYS)
+if (${CMAKE_PROJECT_NAME}_PERPLEX_BUILD)
+
+  if (TARGET LEMON_BLD)
+    set(LEMON_TARGET LEMON_BLD)
+    list(APPEND PERPLEX_DEPS LEMON_BLD)
+  endif (TARGET LEMON_BLD)
+
+  if (TARGET RE2C_BLD)
+    set(RE2C_TARGET RE2C_BLD)
+    list(APPEND PERPLEX_DEPS RE2C_BLD)
+  endif (TARGET RE2C_BLD)
+
+  ExternalProject_Add(PERPLEX_BLD
+    SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../misc/tools/perplex"
+    BUILD_ALWAYS ${EXTERNAL_BUILD_UPDATE} ${LOG_OPTS}
+    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DBIN_DIR=${BIN_DIR}
+    -DCMAKE_INSTALL_RPATH=${CMAKE_BUILD_RPATH}
+    -DLEMON_ROOT=$<$<BOOL:${LEMON_TARGET}>:${CMAKE_BINARY_DIR}> 
-DLEMON_TEMPLATE=$<$<BOOL:${LEMON_TARGET}>:${LEMON_TEMPLATE}>
+    -DRE2C_ROOT=$<$<BOOL:${RE2C_TARGET}>:${CMAKE_BINARY_DIR}>
+    DEPENDS ${PERPLEX_DEPS}
+    )
+
+  list(APPEND BRLCAD_DEPS PERPLEX_BLD)
+
+  SetTargetFolder(PERPLEX_BLD "Third Party Libraries")
+endif (${CMAKE_PROJECT_NAME}_PERPLEX_BUILD)
+
+
+
+# Make sure we load FindPERPLEX.cmake to be able to define PERPLEX targets.
+include(${BRLCAD_CMAKE_DIR}/FindPERPLEX.cmake)
+
+
+###############################################################################
 #                 zlib compression/decompression library
 ###############################################################################
 
@@ -592,6 +717,8 @@
 
 endif (${CMAKE_PROJECT_NAME}_SPSR_BUILD)
 
+
+
 ###############################################################################
 #       STEPcode - support for reading and writing STEP files
 ###############################################################################
@@ -604,7 +731,7 @@
 ")
 
 THIRD_PARTY(stepcode SC stepcode sc_DESCRIPTION
-  REQUIRED_VARS LEMON_EXECUTABLE PERPLEX_EXECUTABLE BRLCAD_LEVEL3
+  REQUIRED_VARS BRLCAD_LEVEL3
   ALIASES ${sc_ALIASES}
   RESET_VARS EXP2CXX_EXEC EXP2CXX_EXECUTABLE_TARGET
   FLAGS NOSYS)
@@ -627,14 +754,22 @@
 
 
   set(LEMON_TARGET)
-  if (TARGET lemon)
-    set(LEMON_TARGET lemon)
-  endif (TARGET lemon)
+  if (TARGET LEMON_BLD)
+    set(LEMON_TARGET LEMON_BLD)
+    list(APPEND SC_DEPS LEMON_BLD)
+  endif (TARGET LEMON_BLD)
 
+  set(RE2C_TARGET)
+  if (TARGET RE2C_BLD)
+    set(RE2C_TARGET RE2C_BLD)
+    list(APPEND SC_DEPS RE2C_BLD)
+  endif (TARGET RE2C_BLD)
+
   set(PERPLEX_TARGET)
-  if (TARGET lemon)
-    set(PERPLEX_TARGET lemon)
-  endif (TARGET lemon)
+  if (TARGET PERPLEX_BLD)
+    set(PERPLEX_TARGET PERPLEX_BLD)
+    list(APPEND SC_DEPS PERPLEX_BLD)
+  endif (TARGET PERPLEX_BLD)
 
   ExternalProject_Add(STEPCODE_BLD
     SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../other/stepcode"
@@ -641,12 +776,14 @@
     BUILD_ALWAYS ${EXTERNAL_BUILD_UPDATE} ${LOG_OPTS}
     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DLIB_DIR=${LIB_DIR} 
-DBIN_DIR=${BIN_DIR}
                -DCMAKE_INSTALL_RPATH=${CMAKE_BUILD_RPATH} 
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-               -DPERPLEX_ROOT=${CMAKE_BINARY_DIR} 
-DLEMON_ROOT=${CMAKE_BINARY_DIR}
-               -DLEMON_TEMPLATE=${CMAKE_BINARY_DIR}/share/lemon/lempar.c
-               -DSC_IS_SUBBUILD=ON -DSC_INSTALL_PREFIX=${CMAKE_BINARY_DIR} 
-DSC_PYTHON_GENERATOR=OFF
+              -DLEMON_ROOT=$<$<BOOL:${LEMON_TARGET}>:${CMAKE_BINARY_DIR}>
+              -DLEMON_TEMPLATE=$<$<BOOL:${LEMON_TARGET}>:${LEMON_TEMPLATE}>
+              -DRE2C_ROOT=$<$<BOOL:${RE2C_TARGET}>:${CMAKE_BINARY_DIR}>
+              -DPERPLEX_ROOT=$<$<BOOL:${PERPLEX_TARGET}>:${CMAKE_BINARY_DIR}>
+               -DSC_IS_SUBBUILD=ON -DSC_PYTHON_GENERATOR=OFF
                -DSC_ENABLE_TESTING=OFF -DSC_ENABLE_COVERAGE=OFF 
-DSC_BUILD_SCHEMAS=
-               -DINCLUDE_INSTALL_DIR=${INCLUDE_DIR} 
-DBIN_INSTALL_DIR=${BIN_DIR} -DLIB_INSTALL_DIR=${LIB_DIR}
-    DEPENDS ${LEMON_TARGET} ${PERPLEX_TARGET}
+               -DINCLUDE_INSTALL_DIR=${INCLUDE_DIR}
+    DEPENDS ${SC_DEPS}
     )
  set(STEPCODE_LIBS base express exppp stepcore stepeditor stepdai steputils)
   foreach(SCLIB ${STEPCODE_LIBS})

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

Reply via email to