Revision: 75102 http://sourceforge.net/p/brlcad/code/75102 Author: starseeker Date: 2020-03-25 19:15:25 +0000 (Wed, 25 Mar 2020) Log Message: ----------- One consequence of an ExternalProject_Add approach is that subbuilds will have to be properly stand-alone. Rework libregex build somewhat, and while we're at it introduce the same prefix trick that is being considered for zlib.
Modified Paths: -------------- brlcad/branches/thirdparty_rework/src/other/libregex/CMakeLists.txt Added Paths: ----------- brlcad/branches/thirdparty_rework/src/other/libregex/regex.h.in Removed Paths: ------------- brlcad/branches/thirdparty_rework/src/other/libregex/regex.h Modified: brlcad/branches/thirdparty_rework/src/other/libregex/CMakeLists.txt =================================================================== --- brlcad/branches/thirdparty_rework/src/other/libregex/CMakeLists.txt 2020-03-25 18:01:41 UTC (rev 75101) +++ brlcad/branches/thirdparty_rework/src/other/libregex/CMakeLists.txt 2020-03-25 19:15:25 UTC (rev 75102) @@ -1,12 +1,78 @@ +# C M A K E L I S T S . T X T +# 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. +# +# Build file for libregex (above license applies to only this file - +# libregex is convered by its own license.) +### +project(REGEX) + +cmake_minimum_required(VERSION 3.0.2) + include_directories( + ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} - ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/include) + ) -set(LIBREGEX_PUBLIC_HDRS - regex.h +if (NOT DEFINED BIN_DIR) + set (BIN_DIR bin) +endif (NOT DEFINED BIN_DIR) + +if (NOT DEFINED LIB_DIR) + set (LIB_DIR lib) +endif (NOT DEFINED LIB_DIR) + +if (NOT DEFINED INCLUDE_DIR) + set (INCLUDE_DIR include) +endif (NOT DEFINED INCLUDE_DIR) + +option (ENABLE_REGEX_PREFIX "Add regex_ prefix to all library functions." OFF) +if (DEFINED REGEX_PREFIX_STR) + set (ENABLE_REGEX_PREFIX ON CACHE BOOL "Ensure prefix is set" FORCE) +endif (DEFINED REGEX_PREFIX_STR) +if (ENABLE_REGEX_PREFIX) + set(REGEX_PREFIX 1) +endif (ENABLE_REGEX_PREFIX) +mark_as_advanced (ENABLE_REGEX_PREFIX) +mark_as_advanced (REGEX_PREFIX_STR) + +configure_file(regex.h.in ${CMAKE_CURRENT_BINARY_DIR}/regex.h @ONLY) + +set (REGEX_HDRS + ${CMAKE_CURRENT_BINARY_DIR}/regex.h ) -set(LIBREGEX_SOURCES +set (REGEX_SOURCES regcomp.c regerror.c regexec.c @@ -13,42 +79,36 @@ regfree.c ) -if(NOT DEFINED BIN_DIR) - set(BIN_DIR bin) -endif(NOT DEFINED BIN_DIR) - -if(NOT DEFINED LIB_DIR) - set(LIB_DIR lib) -endif(NOT DEFINED LIB_DIR) - -add_library(regex SHARED ${LIBREGEX_SOURCES}) -set_target_properties(regex PROPERTIES VERSION 1.0.4 SOVERSION 1) -if(MSVC) - set_property(TARGET regex APPEND PROPERTY COMPILE_DEFINITIONS "REGEX_EXPORT_DLL") - set_property(TARGET regex APPEND PROPERTY COMPILE_DEFINITIONS "BRLCAD_DLL") -endif(MSVC) -install(TARGETS regex +add_library (regex SHARED ${REGEX_SOURCES}) +set_target_properties (regex PROPERTIES VERSION 1.0.4 SOVERSION 1) +if (MSVC) + set_property (TARGET regex APPEND PROPERTY COMPILE_DEFINITIONS "REGEX_EXPORT_DLL") + set_property (TARGET regex APPEND PROPERTY COMPILE_DEFINITIONS "BRLCAD_DLL") +endif (MSVC) +install (TARGETS regex RUNTIME DESTINATION ${BIN_DIR} LIBRARY DESTINATION ${LIB_DIR} ARCHIVE DESTINATION ${LIB_DIR}) -if(BUILD_STATIC_LIBS) - add_library(regex-static STATIC ${LIBREGEX_SOURCES}) - if(MSVC) +if (BUILD_STATIC_LIBS) + add_library (regex-static STATIC ${REGEX_SOURCES}) + if (MSVC) # msvc does not append 'lib' - do it here to have consistent name set_target_properties(regex-static PROPERTIES PREFIX "lib") - else(MSVC) + else (MSVC) set_target_properties(regex-static PROPERTIES OUTPUT_NAME "regex") - endif(MSVC) - install(TARGETS regex-static + endif (MSVC) + install (TARGETS regex-static RUNTIME DESTINATION ${BIN_DIR} LIBRARY DESTINATION ${LIB_DIR} ARCHIVE DESTINATION ${LIB_DIR}) - if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(FILES ${LIBREGEX_PUBLIC_HDRS} DESTINATION include) - endif(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) -endif(BUILD_STATIC_LIBS) +endif (BUILD_STATIC_LIBS) +if (NOT SKIP_INSTALL_HDRS) + install (FILES ${REGEX_HDRS} DESTINATION ${INCLUDE_DIR}) +endif (NOT SKIP_INSTALL_HDRS) + + # Local Variables: # tab-width: 8 # mode: cmake Deleted: brlcad/branches/thirdparty_rework/src/other/libregex/regex.h =================================================================== --- brlcad/branches/thirdparty_rework/src/other/libregex/regex.h 2020-03-25 18:01:41 UTC (rev 75101) +++ brlcad/branches/thirdparty_rework/src/other/libregex/regex.h 2020-03-25 19:15:25 UTC (rev 75102) @@ -1,176 +0,0 @@ -/* Copyright (c) 1992 Henry Spencer. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Henry Spencer of the University of Toronto. - * - * 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - * - * @(#)regex.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _REGEX_H_ -#define _REGEX_H_ - -#if defined (_WIN32) -# include <BaseTsd.h> -#endif - -/* Pre VS2015, MSVC doesn't provide snprintf */ -#if defined(_MSC_VER) && _MSC_VER < 1900 -# define snprintf _snprintf -#endif - -#include <limits.h> -#include <stddef.h> - -#if !defined(ssize_t) - typedef ptrdiff_t ssize_t; -# define HAVE_SSIZE_T 1 -#endif - -#if defined(_WIN32) && !defined(_OFF_T_DEFINED) - typedef SSIZE_T off_t; -# define _OFF_T_DEFINED 1 -#endif - -/* On Windows 64bit, "off_t" is defined as a "long" - * within "sys/types.h" which breaks "libregex". To - * resolve this, we must define "off_t" before we - * include "sys/types.h". Defining "off_t" as - * "ssize_t" works for both Windows 32bit and 64bit. - */ - -#include <sys/types.h> - -#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__off_t_defined) && !defined(_OFF_T) && !defined(_OFF_T_DECLARED) - typedef ptrdiff_t off_t; -# define __off_t_defined 1 -# define _OFF_T_DECLARED 1 -#endif - -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <stdlib.h> - -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# ifndef __BEGIN_DECLS -# define __BEGIN_DECLS - #endif -# ifndef __END_DECLS -# define __END_DECLS -# endif -#endif - - -#ifndef REGEX_EXPORT -# if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL) -# ifdef REGEX_EXPORT_DLL -# define REGEX_EXPORT __declspec(dllexport) -# else -# define REGEX_EXPORT __declspec(dllimport) -# endif -# else -# define REGEX_EXPORT -# endif -#endif - -/* types */ - -typedef off_t regoff_t; - -typedef struct { - int re_magic; - size_t re_nsub; /* number of parenthesized subexpressions */ - const char *re_endp; /* end pointer for REG_PEND */ - struct re_guts *re_g; /* none of your business :-) */ -} regex_t; - -typedef struct { - regoff_t rm_so; /* start of match */ - regoff_t rm_eo; /* end of match */ -} regmatch_t; - -/* regcomp() flags */ -#define REG_BASIC 0000 -#define REG_EXTENDED 0001 -#define REG_ICASE 0002 -#define REG_NOSUB 0004 -#define REG_NEWLINE 0010 -#define REG_NOSPEC 0020 -#define REG_PEND 0040 -#define REG_DUMP 0200 - -/* regerror() flags */ -#define REG_NOMATCH 1 -#define REG_BADPAT 2 -#define REG_ECOLLATE 3 -#define REG_ECTYPE 4 -#define REG_EESCAPE 5 -#define REG_ESUBREG 6 -#define REG_EBRACK 7 -#define REG_EPAREN 8 -#define REG_EBRACE 9 -#define REG_BADBR 10 -#define REG_ERANGE 11 -#define REG_ESPACE 12 -#define REG_BADRPT 13 -#define REG_EMPTY 14 -#define REG_ASSERT 15 -#define REG_INVARG 16 -#define REG_ATOI 255 /* convert name to number (!) */ -#define REG_ITOA 0400 /* convert number to name (!) */ - -/* regexec() flags */ -#define REG_NOTBOL 00001 -#define REG_NOTEOL 00002 -#define REG_STARTEND 00004 -#define REG_TRACE 00400 /* tracing of execution */ -#define REG_LARGE 01000 /* force large representation */ -#define REG_BACKR 02000 /* force use of backref code */ - -__BEGIN_DECLS -REGEX_EXPORT int regcomp (regex_t *, const char *, int); -REGEX_EXPORT size_t regerror (int, const regex_t *, char *, size_t); -REGEX_EXPORT int regexec (const regex_t *, const char *, size_t, regmatch_t [], int); -REGEX_EXPORT void regfree (regex_t *); -__END_DECLS - -#endif /* !_REGEX_H_ */ - -/* - * Local Variables: - * mode: C - * tab-width: 8 - * indent-tabs-mode: t - * c-file-style: "stroustrup" - * End: - * ex: shiftwidth=4 tabstop=8 - */ Added: brlcad/branches/thirdparty_rework/src/other/libregex/regex.h.in =================================================================== --- brlcad/branches/thirdparty_rework/src/other/libregex/regex.h.in (rev 0) +++ brlcad/branches/thirdparty_rework/src/other/libregex/regex.h.in 2020-03-25 19:15:25 UTC (rev 75102) @@ -0,0 +1,193 @@ +/* Copyright (c) 1992 Henry Spencer. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * 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. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)regex.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +#if defined (_WIN32) +# include <BaseTsd.h> +#endif + +/* Pre VS2015, MSVC doesn't provide snprintf */ +#if defined(_MSC_VER) && _MSC_VER < 1900 +# define snprintf _snprintf +#endif + +#include <limits.h> +#include <stddef.h> + +#if !defined(ssize_t) + typedef ptrdiff_t ssize_t; +# define HAVE_SSIZE_T 1 +#endif + +#if defined(_WIN32) && !defined(_OFF_T_DEFINED) + typedef SSIZE_T off_t; +# define _OFF_T_DEFINED 1 +#endif + +/* On Windows 64bit, "off_t" is defined as a "long" + * within "sys/types.h" which breaks "libregex". To + * resolve this, we must define "off_t" before we + * include "sys/types.h". Defining "off_t" as + * "ssize_t" works for both Windows 32bit and 64bit. + */ + +#include <sys/types.h> + +#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__off_t_defined) && !defined(_OFF_T) && !defined(_OFF_T_DECLARED) + typedef ptrdiff_t off_t; +# define __off_t_defined 1 +# define _OFF_T_DECLARED 1 +#endif + +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <stdlib.h> + +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# ifndef __BEGIN_DECLS +# define __BEGIN_DECLS + #endif +# ifndef __END_DECLS +# define __END_DECLS +# endif +#endif + + +#ifndef REGEX_EXPORT +# if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL) +# ifdef REGEX_EXPORT_DLL +# define REGEX_EXPORT __declspec(dllexport) +# else +# define REGEX_EXPORT __declspec(dllimport) +# endif +# else +# define REGEX_EXPORT +# endif +#endif + +/* types */ + +typedef off_t regoff_t; + +typedef struct { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ +} regex_t; + +typedef struct { + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} regmatch_t; + +/* regcomp() flags */ +#define REG_BASIC 0000 +#define REG_EXTENDED 0001 +#define REG_ICASE 0002 +#define REG_NOSUB 0004 +#define REG_NEWLINE 0010 +#define REG_NOSPEC 0020 +#define REG_PEND 0040 +#define REG_DUMP 0200 + +/* regerror() flags */ +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 +#define REG_EMPTY 14 +#define REG_ASSERT 15 +#define REG_INVARG 16 +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ + +/* regexec() flags */ +#define REG_NOTBOL 00001 +#define REG_NOTEOL 00002 +#define REG_STARTEND 00004 +#define REG_TRACE 00400 /* tracing of execution */ +#define REG_LARGE 01000 /* force large representation */ +#define REG_BACKR 02000 /* force use of backref code */ + +#cmakedefine REGEX_PREFIX 1 +#cmakedefine REGEX_PREFIX_STR @REGEX_PREFIX_STR@ +#ifdef REGEX_PREFIX +/* Allow a user configurable prefix string, defaulting to "z_" */ +# if !defined(REGEX_PREFIX_STR) +# define REGEX_PREFIX_STR regex_ +# endif +# define REGEXLIB_CONCAT2(a, b) a ## b +# define REGEXLIB_CONCAT(a, b) REGEXLIB_CONCAT2(a,b) +# define REGEX_ADD_PREFIX(b) REGEXLIB_CONCAT(REGEX_PREFIX_STR,b) + +# define regcomp REGEX_ADD_PREFIX(regcomp) +# define regerror REGEX_ADD_PREFIX(regerror) +# define regexec REGEX_ADD_PREFIX(regexec) +# define regfree REGEX_ADD_PREFIX(regfree) +#endif + +__BEGIN_DECLS +REGEX_EXPORT int regcomp (regex_t *, const char *, int); +REGEX_EXPORT size_t regerror (int, const regex_t *, char *, size_t); +REGEX_EXPORT int regexec (const regex_t *, const char *, size_t, regmatch_t [], int); +REGEX_EXPORT void regfree (regex_t *); +__END_DECLS + +#endif /* !_REGEX_H_ */ + +/* + * Local Variables: + * mode: C + * tab-width: 8 + * indent-tabs-mode: t + * c-file-style: "stroustrup" + * End: + * ex: shiftwidth=4 tabstop=8 + */ Property changes on: brlcad/branches/thirdparty_rework/src/other/libregex/regex.h.in ___________________________________________________________________ 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits