Compare commits

...
36 Commits
Author SHA1 Message Date
Christopher Sean Morrison 6f5c60a5d0 for testing, this applies rudimentary hacked updates (not intended for merge to trunk) that get this branch compiling again.
svn:revision:76064
svn:branch:opencl
svn:account:brlcad
2020-06-08 08:12:36 +00:00
Vasco Alexandre da Silva Costa 11023d8fae Revert CMakeFile changes.
svn:revision:73935
svn:branch:opencl
svn:account:vasco_costa
2019-09-16 14:48:18 +00:00
Vasco Alexandre da Silva Costa b46c224ec3 Use trunk X11 detection routine so includes are detected on modern distros.
svn:revision:73934
svn:branch:opencl
svn:account:vasco_costa
2019-09-16 14:20:23 +00:00
Vasco Alexandre da Silva Costa b2f435f2e1 Rebased opencl branch to r70379 trunk.
svn:revision:73933
svn:branch:opencl
svn:account:vasco_costa
2019-09-16 13:39:22 +00:00
Vasco Alexandre da Silva Costa fedb19296a Remove outdated opencl branch.
(svn branch delete)

svn:revision:73932
svn:branch:opencl
svn:account:vasco_costa
2019-09-16 13:09:25 +00:00
Marco da Silva Domingues 625134177d removing unused case conditions from rt_pr_bit_tree(). These operations are internal to bool_eval() function and will never occur in the bit tree
svn:revision:70081
svn:branch:opencl
svn:account:mdtwenty
2017-08-15 14:05:24 +00:00
Marco da Silva Domingues 1ed45a086f passing first region index to overlap handler
svn:revision:70080
svn:branch:opencl
svn:account:mdtwenty
2017-08-15 13:42:51 +00:00
Vasco Alexandre da Silva Costa fb112992d2 Remove unused code.
svn:revision:70079
svn:branch:opencl
svn:account:vasco_costa
2017-08-14 19:17:24 +00:00
Vasco Alexandre da Silva Costa 09898fa192 Fix materials in 'a_no_booleans' OpenCL librt render mode.
svn:revision:70078
svn:branch:opencl
svn:account:vasco_costa
2017-08-14 19:16:24 +00:00
Vasco Alexandre da Silva Costa e67e8d322b Add option to disable boolean weaving in OpenCL librt.
svn:revision:70075
svn:branch:opencl
svn:account:vasco_costa
2017-08-14 18:40:10 +00:00
Marco da Silva Domingues 73ccb38402 bool_eval() function using new boolean tree representation, where each tree node is encoded in 32 bits
svn:revision:70074
svn:branch:opencl
svn:account:mdtwenty
2017-08-11 20:37:09 +00:00
Marco da Silva Domingues c4aff86f6e Removed next_evalpp field from cl_partition struct
svn:revision:70057
svn:branch:opencl
svn:account:mdtwenty
2017-08-08 13:19:21 +00:00
Marco da Silva Domingues 1fe3511218 Fix bug in partitions shading. Shading closest partition
svn:revision:70034
svn:branch:opencl
svn:account:mdtwenty
2017-08-01 13:33:56 +00:00
Marco da Silva Domingues 28c18f2fea skipping unevaluated partitions
svn:revision:70033
svn:branch:opencl
svn:account:mdtwenty
2017-08-01 00:16:31 +00:00
Marco da Silva Domingues e01866abd2 fixed some indentation and coding style issues
svn:revision:70032
svn:branch:opencl
svn:account:mdtwenty
2017-07-31 21:14:26 +00:00
Vasco Alexandre da Silva Costa d9e8d82039 Add note to code to split 'struct hit' to conserve memory.
svn:revision:70017
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 22:38:43 +00:00
Vasco Alexandre da Silva Costa dc12cef9db Cleanups.
svn:revision:70015
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 22:02:04 +00:00
Vasco Alexandre da Silva Costa 466eb4eafb Optimize regiontable construction. Patch by Marco Domingues.
svn:revision:70014
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 21:44:22 +00:00
Vasco Alexandre da Silva Costa 84487b75db Fix bugs in log function.
svn:revision:70011
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 06:16:10 +00:00
Vasco Alexandre da Silva Costa 7f631ab752 Use proper materials from regions. This fixes the materials selection issues.
svn:revision:70010
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 06:09:16 +00:00
Vasco Alexandre da Silva Costa 66c37fa169 Remove unused variables.
svn:revision:70009
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 04:00:52 +00:00
Vasco Alexandre da Silva Costa 788bfe4085 Use bool type instead of int for flip flag.
svn:revision:70008
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 03:50:45 +00:00
Vasco Alexandre da Silva Costa 94238825fb Use ternary selection operator ?: as shorthand for select().
svn:revision:70007
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 03:33:07 +00:00
Vasco Alexandre da Silva Costa e05550c55e Fix normals in inner regions. Patch by Marco Domingues.
svn:revision:70006
svn:branch:opencl
svn:account:vasco_costa
2017-07-28 03:08:12 +00:00
Vasco Alexandre da Silva Costa 98b8d98412 patch #472 by Marco Domingues: faster iteration over sparse bitarrays. fix memory pointer address bugs. fix render with 'e *' command. use one regiontable per ray instead of one per partition.
svn:revision:69981
svn:branch:opencl
svn:account:vasco_costa
2017-07-21 19:46:08 +00:00
Vasco Alexandre da Silva Costa bd35b711ef Forgot to add this file on my last commit.
svn:revision:69973
svn:branch:opencl
svn:account:vasco_costa
2017-07-19 21:29:09 +00:00
Vasco Alexandre da Silva Costa aa56640ee7 Fix some indentation and coding style issues.
svn:revision:69965
svn:branch:opencl
svn:account:vasco_costa
2017-07-18 12:45:59 +00:00
Vasco Alexandre da Silva Costa ac01d68fed Add OpenCL CSG operator patch #472 from Marco Domingues.
It still has some bugs on it. But it's getting large enough that it's better to use SVN to collaborate on it.

svn:revision:69964
svn:branch:opencl
svn:account:vasco_costa
2017-07-18 12:21:43 +00:00
Vasco Alexandre da Silva Costa 2815cbea97 Added #417 RPN booleval patch.
svn:revision:69924
svn:branch:opencl
svn:account:vasco_costa
2017-06-21 18:09:23 +00:00
Vasco Alexandre da Silva Costa fff4d55ae3 The new OpenCL CMake script uses different env variable names so we need to update that.
svn:revision:69923
svn:branch:opencl
svn:account:vasco_costa
2017-06-21 17:47:50 +00:00
Vasco Alexandre da Silva Costa 38e67c5c53 Use OpenCL CMake script from: https://github.com/Kitware/CMake/blob/master/Modules/FindOpenCL.cmake
svn:revision:69922
svn:branch:opencl
svn:account:vasco_costa
2017-06-21 17:21:36 +00:00
Vasco Alexandre da Silva Costa fcaf54c7f8 Rebased opencl branch to r69920 trunk.
svn:revision:69921
svn:branch:opencl
svn:account:vasco_costa
2017-06-21 17:11:31 +00:00
Clifford Yapp b58a84aef0 Sync with trunk thru 69860
svn:revision:69865
svn:branch:opencl
svn:account:starseeker
2017-05-31 17:22:28 +00:00
Clifford Yapp 51a5b0e4ee Sync with trunk thru r69558
svn:revision:69563
svn:branch:opencl
svn:account:starseeker
2017-03-23 23:40:25 +00:00
Clifford Yapp 68a5f85b25 Sync with trunk thru r68370
svn:revision:68375
svn:branch:opencl
svn:account:starseeker
2016-07-19 19:56:11 +00:00
Clifford Yapp 30569fb065 Sync with trunk thru r68300. src/librt/bool.c and src/librt/prep.h look fairly different from trunk - someone needs to check the status of those after merge and see if it came out right.
svn:revision:68308
svn:branch:opencl
svn:account:starseeker
2016-08-31 01:32:07 +00:00
4090 changed files with 1081598 additions and 163019 deletions
-3
View File
@@ -1,3 +0,0 @@
/bin
/lib
/build
+122 -106
View File
@@ -2,123 +2,138 @@
BRL-CAD Interface Change Policy
===============================
Included below are details of BRL-CAD public interface changes that
potentially impact external developers and users. Public interfaces
include developer application programming interface (API) calls as
well as user application command-line interface (CLI) and graphical
user interface (GUI) behaviors. Changes are characterized as:
1) those affecting a new interface,
2) being minimally impacting, or
3) requiring adherence to deprecation policy.
This policy is intentionally designed to balance developer agility,
helping accelerate development, with interface stability, helping
preserve application developer and user investments.
This policy describes formal rules for changing an interface that
potentially impacts developers or users. The scope is limited to
public interfaces including developer application programming
interfaces (APIs), user application command-line interfaces (CLIs),
and graphical user interfaces (GUIs). The policy aims to balance
developer agility with interface stability.
All changes to BRL-CAD are expected to conform to this change policy.
Changes MUST either be:
NEW INTERFACE
-------------
Changes to interfaces that have been recently introduced are often
subject to further change and should not yet be relied upon by
application developers or users until they stabilize. They are
allowed to change from release to release and are not subject to
change policy restrictions until they have been included in at least
TWO releases without any change.
A) MINIMALLY IMPACTING, or
B) FORMALLY DEPRECATED.
MINIMALLY IMPACTING
-------------------
If a change to an interface has a suitable and completely equivalent
alternative, the change is deemed to be "minimally impacting" and can
be made during any release. Examples of such changes include renaming
an interface, reordering parameters, adding optional parameters,
adding additional parameters for previously implicit behavior, and
removing unused parameters.
Changes deemed "minimally impacting" can be made at any time. For a
change to be considered as such, its effect must be strictly limited.
Most are itemized under MINIMALLY IMPACTING CHANGES. They MUST be:
Generally, the impact can usually be considered minimally impacting if
a static regular expression search-and-replace is all that is needed
to update calling code, and no manual intervention is required.
A.1) a relatively new interface
Interfaces introduced recently are often subject to rapid
development change. New interfaces are not subject to formal
deprecation rules until they have been included in at least
TWO releases without change.
A.2) an appreciably broken interface
Interfaces that have been unusable for at least TWO releases
may be fixed, changed, or removed without notice. A broken
interface is one that does not perform its intended function
and does not have secondary utility.
A.3) an elementary change
Simple changes that are trivially accommodated without
conditional logic or manual inspection can be made at will.
It includes mechanical changes that can be automatically
updated by a single static regular expression substitution.
Examples include renaming, reordering parameters, adding
optional parameters, eliminating a duplicate equivalent
interface, adding parameters for implicit behavior, and
removing unused parameters.
DEPRECATION POLICY
------------------
FORMALLY DEPRECATED
-------------------
If a change will intentionally alter, replace, or remove functionality
that has been documented and published in at least TWO releases, it
must first be announced as DEPRECATED. Otherwise, changes to
interfaces that have not been publicly announced or are not publicly
documented for at least two releases may be changed without notice.
Changes not minimally impacting must follow formal deprecation
process. This defers significant changes to major release points or
requires public notification in advance. Changes are documented in
this file first as DEPRECATED CHANGES then later as OBSOLETED CHANGES.
An interface may be changed:
The general practice is that public interface changes may go from
deprecated to obsolete, whereby previous behavior is removed or
changed, during one of the following events:
B.1) during a major release (e.g. from 7.*.* to 8.*.*)
a) during a major release (e.g. going from 7.*.* to 8.*.*)
Any change may be made without notice. Major version number
releases imply intrinsic incompatibility or interface change.
b) during a minor release provided the change was publicly announced
as deprecated beforehand AND sufficient deprecation warning was
given via i) TWO minor releases included the deprecation notice,
and ii) at least THREE months (90 days) have passed since the
deprecation was announced
B.2) during a minor release (e.g., from 7.26.* to 7.28.*)
c) during any release provided there still exists an EQUIVALENT
alternative interface that does not impose an undue burden on users
or developers (see "MINIMALLY IMPACTING")
The interface must be publicly deprecated beforehand with
advance notice given in at least TWO minor releases and after
at least 90 days elapsed since initial release announcement.
Public interfaces scheduled for removal should be visibly marked as
deprecated during compilation with the DEPRECATED keyword on function
declarations, with #warning "DEPRECATED ..." pre-processor statements,
and with @DEPRECATED in source code comments. Where users are not
adversely affected, a run-time DEPRECATION statement may be printed.
Public interfaces scheduled for change should be noted in this file
and visibly marked in the source code. This marking may be the
DEPRECATED keyword on function declarations, #warning "DEPRECATED ..."
pre-processor statements, @DEPRECATED source code comments, and
combinations thereof.
Whenever published functionality is finally removed, move its entry
from the DEPRECATED section below to the REMOVED section for the
version in which it was removed. Make sure the entry retains a
reference to the version in which the item was marked as deprecated.
Where usage is not adversely affected, a run-time statement may be
displayed (typically "DEPRECATION WARNING: ..."). All call references
and documentation should be updated prior to obsoleting.
EXAMPLES
--------
Example #1: Say we decided during 7.50.3 development to remove
rt_shootray() from the API without a replacement. That does NOT
qualify as "minimally impacting" because there's no replacement and
rt_shootray() has been published and documented in more than two
releases. We'd annotate the deprecation in the CHANGES file, mark the
function as DEPRECATED in the API header, and post the 7.50.4 release.
The soonest that function could be removed would be in the 7.54.0
release during 7.53 development. It could NOT be removed in 7.54.2
since it's a patch version, prior to the 7.54 release line, nor even
during 7.54.0 if less than 90 days had passed since 7.50.6 was posted.
Example #1: rt_shootray() removal
Example #2: Say we decide during 7.48.0 development to modify bu_log()
by adding a new additional enum parameter denoting a message type.
This change is considered minimally impacting because it can be
characterized by a simple regular expression (e.g.,
s/bu_log(/bu_log(PRINT, /g). Updates to calling codes are considered
trivial. The change would get documented in the CHANGES file and all
calls that can be updated must be updated at that time.
It's decided during 7.50.3 development to remove the rt_shootray()
function. That does NOT qualify as "minimally impacting" because
there's no equivalent replacement and rt_shootray() has been published
and documented in more than two releases. The function gets listed as
DEPRECATED in the CHANGES file, marked as DEPRECATED in the API
header, and is published via the 7.50.4 release.
The soonest that function could be removed / obsoleted would be in
7.54.0 during 7.53.* development provided more than 90 days had passed
since the intiial announcement. It could NOT be removed in 7.54.2 as
that's a patch version, prior to 7.54, nor during 7.54.0 if less than
90 days had passed since 7.50.6 was posted.
Example #2: bu_log() mod
It's decided during 7.48.1 development to modify bu_log() by adding an
additional optional enum parameter denoting a message type, e.g.,
bu_log(INFO, ...). This change is considered "minimally impacting"
because it can be characterized by a simple regular expression (e.g.,
"s/bu_log\(/bu_log(INFO, /g)" and calling codes are trivially
accommodated. All calls to bu_log() should be updated to the new form
prior to change announcement.
The function could be changed at any time so long as it's documented
under MINIMALLY IMPACTING CHANGES.
**************
* DEPRECATED *
**************
**********************************************************************
*** DEPRECATED CHANGES ***
**********************************************************************
(reverse chronological order)
The items listed below are interfaces that are deprecated. They are
categorized by the release in which the change was made. If the
change involved a removal of a command or function, both the original
and new names should be listed for reference. If an item is marked
with a "'" (single quote), that means it was not documented and may be
The interfaces announced below are scheduled to significantly change
or be removed. They are categorized by the release in which
deprecation was first announced. If the inteface change involved a
removal or transition, both the original and new interface names are
generally listed for reference.
Items marked with a "'" (single quote) are undocumented and may be
removed at any time.
7.28
----
include/vmath.h
VCOMB3, VCOMB3N, VJOIN4
Removed as inconsistent and unused API [deprecated 7.28]
MGED commands
?devel, ?lib, aproposdevel, aproposlib, %, animmate, db_glob,
debugbu, debugdir, debuglib, debugmem, debugnmg, expand,
@@ -167,7 +182,6 @@ signal analysis tools
Removed as part of distillation effort [deprecated 7.26]
infrared & shapefactor tools
all_sf', if-X, ifdisp, pictx, showterm, firpass, secpass, shapefact
ssamp-bw, ssampview', ssampview.tcl'
Removed as part of distillation effort [deprecated 7.26]
misc tools
fix_polysolids' : obsolete primitive
@@ -362,13 +376,16 @@ include/raytrace.h
struct hit.hit_normal -> RT_HIT_NORMAL [deprecated pre-7.0]
***********
* REMOVED *
***********
**********************************************************************
*** OBSOLETED CHANGES ***
**********************************************************************
(reverse chronological order)
Below are the interfaces that have followed deprecation policy or were
deemed minimally impacting and, regardless, are now no longer a part
of BRL-CAD.
7.28.0
------
libmultispectral, rttherm, ssamp-bw, ssampview, ssampview.tcl
removed, not working in testing [minimally impacting]
7.26.0
------
@@ -611,27 +628,26 @@ include/[library].h (several)
[library]_version -> [library]_version() [private]
***********************************
* MINIMALLY IMPACTING API CHANGES *
***********************************
**********************************************************************
*** MINIMALLY IMPACTING CHANGES ***
**********************************************************************
(forward chronological order)
Included in following are various minimally impacting API changes that
have been identified in chronological order. As expressions are not
extensively tested, use with caution.
Unless noted otherwise, expressions are shown using Perl syntax (i.e.,
the '(', ')', and '|' characters pertain to subexpression captures,
escape with '\' to match literally. Expressions should apply with:
All minimally impacting changes are listed by release as regular
expressions. Unless noted otherwise, expressions are shown using Perl
syntax (i.e., the '(', ')', and '|' characters pertain to
subexpression captures, escaping with '\' matches literally.
Expressions should apply via:
perl -0777 -pi -e 'EXPRESSION' FILE
To apply an expression to an entire SVN checkout, the following
pattern is useful:
To apply an expression to an entire source tree, the following pattern
may work:
find . -type f -not -path "*.svn/*" -regex '.*\(c\|cpp\|cxx\|h\|hpp\)$' -exec perl -0777 -pi -e 'EXPRESSION' {} \;
Our catalog of minimally impacting changes follows with the most
recent changes listed at the bottom.
Expressions are minimally tested, use with caution. Make a backup.
6.0 (sed lines)
---
+704 -415
View File
File diff suppressed because it is too large Load Diff
+4439 -43177
View File
File diff suppressed because it is too large Load Diff
+2 -7
View File
@@ -285,13 +285,6 @@ libfft: The Fast-Fourier Transform library is a signal processing
library for performing FFTs or inverse FFTs efficiently.
Depends on: libm
libmultispectral: The multispectral optics library is a separate
compilation mode of the optics library where support for additional
bands of energy are added. By providing a defined spectrum of energy,
the raytrace library will produce different signal analyses for a
given set of geometry.
Depends on: librt libbn libbu libtcl
liboptical: The optical library is the basis for BRL-CAD's shaders.
This includes shaders such as the Phong and Cook-Torrence lighting
models, as well as various visual effects such as texturing, marble,
@@ -1330,6 +1323,8 @@ Release steps are as follows:
#####################################################################
# 09: Sync RELEASE to STABLE branch:
# Update the NEWS release date for the current release to today's date
# NON-AUTO: Review the log and obtain the last merge revision
# number from comments.
svn log --stop-on-copy https://svn.code.sf.net/p/brlcad/code/brlcad/branches/STABLE | less
+18 -7
View File
@@ -773,15 +773,26 @@ AUTO.
Aliases: ENABLE_GDIAM
--- BRLCAD_BULLET ---
--- BRLCAD_PROJ4 ---
Option for enabling and disabling compilation of the Bullet Realtime
Physics Simulation Libraries 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.
Option for enabling and disabling compilation of the PROJ.4 geographic
projection library provided with BRL-CAD's source code. 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.
Aliases: ENABLE_BULLET
Aliases: ENABLE_PROJ4
--- BRLCAD_GDAL ---
Option for enabling and disabling compilation of the GDAL geographic
library provided with BRL-CAD's source code. 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.
Aliases: ENABLE_GDAL
+34 -1
View File
@@ -10,9 +10,42 @@ descriptive text that emphasizes or further describes significant
changes made. See document footer for additional details.
----------------------------------------------------------------------
--- 2016-07-XX Release 7.26.2 ---
--- 201X-XX-XX Release 7.28.0 ---
----------------------------------------------------------------------
* Remove libmultispectral, rttherm, and related code/docs - Cliff Yapp
----------------------------------------------------------------------
--- 2017-09-22 Release 7.26.4 ---
----------------------------------------------------------------------
This is a patch release, primary focused on updates to the build
system logic.
* fixed MGED bindings behavior for c, A, P, and S chars - Bob Parker
* fixed gdiff usage statement - Sean Morrison
* removed anim.txt, sun.txt, tube.txt and movie.txt - Cliff Yapp
----------------------------------------------------------------------
--- 2017-06-10 Release 7.26.2 ---
----------------------------------------------------------------------
Among a variety of bugs fixed, the patch corrects a critical error in
BoT triangle mesh ray tracing. For improved performance, it also
changes the default frame buffer display behavior to fully buffer ray
tracing images instead of displaying them incrementally. A variety of
MGED commands see improvements too with 'ls' now supporting listing
objects by their on-disk size and the 'simulate' command applying
forces on objects (e.g., gravity) with greater ease. Not yet
complete, there is a new interface being developed for resolving
overlaps more efficiently, currently under development and usability
testing with select users. Lastly, a number of dependencies were
upgraded, including Tcl/Tk, in order to patch security vulnerabilities
and address portability issues.
* upgraded Tcl/Tk from 8.5.9 to 8.5.19 - Sean Morrison
* fixed background color setting in MGED - Cliff Yapp
* upgraded libpng to version 1.6.29 - Cliff Yapp
* upgraded zlib to version 1.2.11 - Cliff Yapp
+1 -1
View File
@@ -1,5 +1,5 @@
BRL-CAD
Release 7.26.2
Release 7.28.0
http://brlcad.org/
BRL-CAD is a powerful cross-platform open source combinatorial
+55 -38
View File
@@ -18,18 +18,47 @@ tasks as they are completed.
THESE TASKS SHOULD HAPPEN BEFORE THE NEXT RELEASE
-------------------------------------------------
* figure out if active/inactive panes are switched around in MGED -
have user report that inactive bg color is being used for active
window and vice versa.
* user report of runtime failure on Windows. apparently need a build
flag to be portable:
https://blogs.msdn.microsoft.com/vcblog/2009/08/27/windows-sdk-v7-0v7-0a-incompatibility-workaround/
THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
-------------------------------------------------------
* move the rt_*_timer timing facilities to libbu and rework to allow
contexts, allowing for more than one timer to be active. Make sure
the old librt API can be obsoleted cleanly.
* check that dbconcat supports objects created with the bo cmd
* libgcv should add objects to an existing .g if one is specified
as the output target - right now it's overwriting the old file
* consolidate dbconcat, clone, make_name, and any other .g I/O
routines that need to autogenerate names to use the new
bu_vls_incr/bu_vls_simplify functions.
* Explicitly list the CMakeLists.txt files rather than adding
them automatically in the add_subdirectory override, now that
we are listing all files explicitly - preserve the new simplicity
* renamed zlib and libpng when building bundled to avoid conflicting
with system-installed libs. e.g., default to ENABLE_Z_PREFIX=ON
with name z_brlcad (perhaps as a post-compile rename custom command)
and png_brlcad respectively.
* investigate possibility of using simple, compact libs
like miniz and lodepng to replace the complexity of
managing zlib and libpng in src/other. These have been
a source of ongoing annoyance, particularly (but not
exclusively) on OSX.
* f_dbopen in MGED doesn't seem to be reporting failure
if a non-.g file is fed to opendb. That doesn't seem
right... shouldn't the open process completely fail
if the file isn't a valid .g?
* add regression test for BoT ray tracing
* add regression test for directional light sources
* update astyle
* bundle primary rays in rt front end into postage stamps, shoot via
rt_shootrays(), modify to pass all rays down through the spatial
partitioning simultaneously
@@ -50,12 +79,6 @@ THESE TASKS SHOULD HAPPEN BEFORE THE NEXT RELEASE
they want v2 (default) or previous v1 output format via a
command-line switch. see http://brlcad.svn.sf.net/viewvc/brlcad/brlcad/trunk/conv/g-vrml.c?view=diff&pathrev=22798&r1=16900&r2=16901
* reinstate 'stat' and search -size, see r67636 through r67646
THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
-------------------------------------------------------
* try to come up with a way we can report the number of times
the configuration step has been run and changed something
without triggering almost a full rebuild. Maybe have the
@@ -63,8 +86,6 @@ THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
* make sure TIE can raytrace all of the various BoT modes
* turn on Bullet code (simulate command) unconditionally
* metaball in command input needs sanity checks and better
validation.
@@ -93,6 +114,20 @@ THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
THESE ARE UNSCHEDULED BACKLOG TASKS
-----------------------------------
* mater command does not validate its arguments - fix that. Also
properly document using "." to skip specifying something - not in
the man page currently.
* bullet integration - need to expose restitution as an
object parameter so we can configure behavior:
http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=&f=&t=3248
* afl on libged/mged/rt/...
* moodycamel as libbu queue/list/ptbl implementation
* reinstate 'stat' and search -size, see r67636 through r67646
* update dem-g to not use full paths for dsp primitive data locations -
should default to embedding the data in the .g file as a binary object,
with an option for a relative path if the user explicitly requests
@@ -247,14 +282,10 @@ THESE ARE UNSCHEDULED BACKLOG TASKS
parallel. This would be a way to easily parallelize existing code
without needing to create wrapper functions for bu_parallel().
* Post 7.26.0 release, need to look at migrating CMake logic off of
the OLD behavior for policy 0026 (using LOCATION property.) Now
that Debian stable is using CMake >=3.0 we should be OK to require
the more modern CMake. Another TODO once we require the newer CMake
is retiring our custom time stamping code in favor of using
the CMake time stamp mechanism. Also get rid of the fallback in
src/libgcv/plugins/CMakeLists.txt (and any others that have crept
in over the years...)
* Now that we have >3.0 CMake required, look into replacing our custom
time stamping code in favor of using the CMake time stamp mechanism.
Also get rid of the fallback in src/libgcv/plugins/CMakeLists.txt
(and any others that have crept in over the years...)
* convert usages of Tcl_InitHashTable() and friends to libbu
containers (see src/conv/enf-g.c for example usage)
@@ -823,12 +854,6 @@ THESE ARE UNSCHEDULED BACKLOG TASKS
* clean up new rt -l8 heat graph lighting model so that it works in
parallel and with no "splotches"
* make rt_prep_timer() take or return a context that gets subsequently
passed to rt_get_timer() calls for returning the elapsed time. this
will allow multiple overlapping timers instead of just one global
timers. move the timing facilities to libbu as part of the process
so API can be obsoleted cleanly.
* separation of stderr from stdout within libbu, particularly for
MGED, so that there is a clean separation of result output from
diagnostic output. this is a fairly separate idea from having log
@@ -1132,11 +1157,6 @@ THESE ARE UNSCHEDULED BACKLOG TASKS
combinations of these primitives, provided their continuity at the
ends ensures continuity all along "seams" - something to consider.
* look into embedding both rgb[3] and complex[n] data types in a union
to allow unification of libmultispectral and liboptical APIs to a
single more general liboptical. Need to be careful about
performance and maintainability concerns.
* we need to define a libbu api for option handling that supports more
features than getopt:
@@ -1847,10 +1867,7 @@ pl-dm (possibly X11 specific)
pp-fb (TERMLIB)
remrt (remrt dir commented out for WIN32 in src/CMakeLists.txt)
rtsrv (remrt dir commented out for WIN32 in src/CMakeLists.txt)
rttherm (rttherm dir commented out for WIN32 in src/CMakeLists.txt)
scriptsort (lex)
ssamp-bw (rttherm dir commented out for WIN32 in src/CMakeLists.txt)
ssampview (rttherm dir commented out for WIN32 in src/CMakeLists.txt)
ttcp (not ported)
The MGED points support doesn't appear as an executable, but it is
Vendored
+8 -4
View File
@@ -10,9 +10,9 @@ while [ "$1" != "" ]
do
case $1
in
--enable-all) options="$options -DBRLCAD_BUNDLED_LIBS=ON";
--enable-all) options="$options -DBRLCAD_BUNDLED_LIBS=BUNDLED";
shift;;
--disable-all) options="$options -DBRLCAD_BUNDLED_LIBS=OFF";
--disable-all) options="$options -DBRLCAD_BUNDLED_LIBS=SYSTEM";
shift;;
--enable-opengl) options="$options -DBRLCAD_ENABLE_OPENGL=ON";
shift;;
@@ -218,9 +218,13 @@ do
shift;;
--disable-gdiam) options="$options -DBRLCAD_GDIAM=SYSTEM";
shift;;
--enable-bullet) options="$options -DBRLCAD_BULLET=BUNDLED";
--enable-proj4) options="$options -DBRLCAD_PROJ4=BUNDLED";
shift;;
--disable-bullet) options="$options -DBRLCAD_BULLET=SYSTEM";
--disable-proj4) options="$options -DBRLCAD_PROJ4=SYSTEM";
shift;;
--enable-gdal) options="$options -DBRLCAD_GDAL=BUNDLED";
shift;;
--disable-gdal) options="$options -DBRLCAD_GDAL=SYSTEM";
shift;;
--prefix=*) inputstr=$1;
options="$options -DCMAKE_INSTALL_PREFIX=${inputstr#--prefix=}";
+2 -1
View File
@@ -97,7 +97,8 @@ CMAKEFILES(
cornell.rt
cube.rt
db.php
include
include/ctype.inc
include/debug.inc
)
# Local Variables:
+70 -58
View File
@@ -11,77 +11,81 @@ set(NIST_SAMPLE_3DM_MODELS
NIST_MBE_PMI_7-10.3dm
)
macro(ADD_NIST_STEP_TARGET step_model folder)
function(ADD_NIST_STEP_TARGET step_model folder)
# Base output file name on input file
string(REGEX REPLACE "([0-9a-z]*).stp" "\\1" step_model_root "${step_model}")
set(output_file ${bin_root}/${DATA_DIR}/db/${step_model_root}.g)
# Define a relative output path - the quirks of CMake require this...
set(output_file ${DATA_DIR}/db/${step_model_root}.g)
# One log file per target
set(log_file ${CMAKE_CURRENT_BINARY_DIR}/${step_model_root}.log)
# Define the target
add_custom_command(
OUTPUT ${output_file}
COMMAND step-g -O ${output_file} ${CMAKE_CURRENT_SOURCE_DIR}/${step_model} > ${log_file} 2>&1
OUTPUT ${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file}
COMMAND step-g -O ${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file} ${CMAKE_CURRENT_SOURCE_DIR}/${step_model} > ${log_file} 2>&1
DEPENDS step-g ${CMAKE_CURRENT_SOURCE_DIR}/${step_model}
)
add_custom_target(${step_model_root}.g ALL DEPENDS ${output_file})
)
add_custom_target(${step_model_root}.g ALL DEPENDS ${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file})
# Assign a target folder for tools like Visual Studio
set_target_properties(${step_model_root}.g PROPERTIES FOLDER "${folder}")
# If we're installing geometry, set up the install rule
if(BRLCAD_INSTALL_EXAMPLE_GEOMETRY)
if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL "." AND CMAKE_CONFIGURATION_FILES)
string(REPLACE "${CMAKE_CFG_INTDIR}" "\${BUILD_TYPE}" output_file "${output_file}")
endif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL "." AND CMAKE_CONFIGURATION_FILES)
install(FILES ${output_file} DESTINATION ${DATA_DIR}/db)
install(FILES ${CMAKE_CURRENT_BUILD_DIR_INSTALL}/${output_file} DESTINATION ${DATA_DIR}/db)
endif(BRLCAD_INSTALL_EXAMPLE_GEOMETRY)
set(BUILT_MODELS "${BUILT_MODELS};${output_file}")
set(LOG_FILES "${LOG_FILES};${log_file}")
# Cleanup
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file};${log_file}")
DISTCLEAN(${log_file})
endmacro(ADD_NIST_STEP_TARGET step_model folder)
# Get our root path
if(CMAKE_CONFIGURATION_TYPES)
set(bin_root "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
else(CMAKE_CONFIGURATION_TYPES)
set(bin_root "${CMAKE_BINARY_DIR}")
endif(CMAKE_CONFIGURATION_TYPES)
endfunction(ADD_NIST_STEP_TARGET step_model folder)
# The general pattern of the BRL-CAD build is to use CMAKE_CFG_INTDIR when
# multi-configuration builds complicate the location of binaries. In this
# case, however, we are using a generated script with a different mechanism
# for handling this situation, and we need to update the executable paths
# accordingly if they are configuration dependent.
if(CMAKE_CONFIGURATION_TYPES)
string(REPLACE "${CMAKE_CFG_INTDIR}" "\${BUILD_TYPE}" rbin_root "${bin_root}")
else(CMAKE_CONFIGURATION_TYPES)
set(rbin_root "${bin_root}")
endif(CMAKE_CONFIGURATION_TYPES)
function(ADD_NIST_3DM_TARGET rhino_model folder)
# Use the CMake executable to figure out if we need an extension
get_filename_component(EXE_EXT "${CMAKE_COMMAND}" EXT)
macro(ADD_NIST_3DM_TARGET rhino_model folder)
set(CMD_EXEC ${rbin_root}/${BIN_DIR}/3dm-g${EXE_EXT})
# Base output file name on input file
string(REGEX REPLACE "([0-9a-z]*).3dm" "\\1" rhino_model_root "${rhino_model}")
set(output_file ${rbin_root}/${DATA_DIR}/db/${rhino_model_root}.g)
# Define a relative output path - the quirks of CMake require this...
set(output_file ${DATA_DIR}/db/${rhino_model_root}.g)
# Because we won't know the output directory in the script reliably until run time,
# we append CURRENT_BUILD_DIR as a string to the arguments - it is the script's
# responsibility to handle it correctly at run time.
set(CMD_ARGS "-o" "CURRENT_BUILD_DIR/${output_file}" "${CMAKE_CURRENT_SOURCE_DIR}/${rhino_model}")
# One log file per target - we capture both stdout and stderror here
set(log_file ${CMAKE_CURRENT_BINARY_DIR}/${rhino_model_root}.log)
set(STDOUT_LOG "${log_file}")
set(STDERR_LOG "${log_file}")
set(CMD_ARGS "-o \"${output_file}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${rhino_model}\"")
configure_file(${BRLCAD_CMAKE_DIR}/builddir_cmd.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/3dm-g.cmake @ONLY)
set(output_file ${bin_root}/${DATA_DIR}/db/${rhino_model_root}.g)
# Use the model name for the script as well, since the output file is specific to this input
set(script_file "${CMAKE_CURRENT_BINARY_DIR}/${rhino_model_root}.cmake")
# We know enough - write the script
generate_cmd_script(3dm-g "${script_file}" OLOG "${log_file}" ELOG "${log_file}" CARGS "${CMD_ARGS}")
# Define the target
add_custom_command(
OUTPUT ${output_file}
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/3dm-g.cmake
OUTPUT ${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file}
COMMAND ${CMAKE_COMMAND} -P "${script_file}"
DEPENDS 3dm-g ${CMAKE_CURRENT_SOURCE_DIR}/${rhino_model}
)
add_custom_target(${rhino_model_root}.g ALL DEPENDS ${output_file})
)
add_custom_target(${rhino_model_root}.g ALL DEPENDS ${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file})
# Assign a target folder for tools like Visual Studio
set_target_properties(${rhino_model_root}.g PROPERTIES FOLDER "${folder}")
# If we're installing geometry, set up the install rule
if(BRLCAD_INSTALL_EXAMPLE_GEOMETRY)
if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL "." AND CMAKE_CONFIGURATION_FILES)
string(REPLACE "${CMAKE_CFG_INTDIR}" "\${BUILD_TYPE}" output_file "${output_file}")
endif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL "." AND CMAKE_CONFIGURATION_FILES)
install(FILES ${output_file} DESTINATION ${DATA_DIR}/db)
install(FILES ${CMAKE_CURRENT_BUILD_DIR_INSTALL}/${output_file} DESTINATION ${DATA_DIR}/db)
endif(BRLCAD_INSTALL_EXAMPLE_GEOMETRY)
set(BUILT_MODELS "${BUILT_MODELS};${output_file}")
set(LOG_FILES "${LOG_FILES};${log_file}")
DISTCLEAN(${log_file})
endmacro(ADD_NIST_3DM_TARGET rhino_model folder)
# Cleanup
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file};${log_file}")
endfunction(ADD_NIST_3DM_TARGET rhino_model folder)
foreach(step_input ${NIST_SAMPLE_STEP_MODELS})
@@ -95,13 +99,21 @@ endforeach(rhino_input ${NIST_SAMPLE_3DM_MODELS})
CMAKEFILES(${NIST_SAMPLE_3DM_MODELS})
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${BUILT_MODELS}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LOG_FILES}")
CMAKEFILES(
README
pdf
)
pdf/1.pdf
pdf/2.pdf
pdf/3.pdf
pdf/4.pdf
pdf/5.pdf
pdf/6.pdf
pdf/7-10_assem.pdf
pdf/7.pdf
pdf/8.pdf
pdf/9.pdf
pdf/10.pdf
pdf/11.pdf
)
# Local Variables:
# tab-width: 8
+13
View File
@@ -2046,6 +2046,19 @@ eprint = {}
timestamp = {2015.12.01}
}
@TECHREPORT{Yapp17,
author = {Yapp, Clifford},
title = {Converting Geometry from Creo Parametric to BRL-CAD},
institution = {United States Army, Army Research Laboratory, Survivability/Lethality Analysis Directorate},
year = {2017},
month = {June},
number = {ARL-SR-0376},
address = {Army Research Laboratory, Aberdeen Proving Ground, MD 21005-5068},
note = {Approved for Public Release, distribution unlimited. Available online: http://www.arl.army.mil/arlreports/2017/ARL-SR-0376.pdf},
owner = {morrison},
timestamp = {2017.06.28}
}
@comment{jabref-meta: selector_journal:}
@comment{jabref-meta: selector_author:}
+14 -6
View File
@@ -1,13 +1,23 @@
if(BRLCAD_EXTRADOCS)
verbose_add_subdirectory(doc docbook)
else(BRLCAD_EXTRADOCS)
CMAKEFILES(docbook)
include(${CMAKE_CURRENT_SOURCE_DIR}/docbook_files.cmake)
CMAKEFILES_IN_DIR(docbook_files docbook)
endif(BRLCAD_EXTRADOCS)
verbose_add_subdirectory(doc html)
verbose_add_subdirectory(doc legal)
CMAKEFILES(parsers)
CMAKEFILES(
parsers/bison_to_lemon.txt
parsers/flex_to_re2c.txt
parsers/templates/CMakeLists.txt
parsers/templates/main.c
parsers/templates/main.h
parsers/templates/parser.lemon
parsers/templates/scanner.perplex
parsers/writing_perplex_lemon_parsers.txt
)
set(documentation_DATA
IDEAS
@@ -22,7 +32,6 @@ set(documentation_DATA
README.Windows
TODO.BREP
TODO.shaded_displays
anim.txt
archer_ack.txt
benchmark.tr
brep.txt
@@ -206,13 +215,10 @@ set(documentation_mged_old_DATA
mged/wm-prims.ps
mged/wm-tube.ps
mk.tr
movie.txt
old-mged.tr
pkg.tr
regions.txt
rounding.txt
sun.txt
tube.txt
tool_categories.txt
ecosystem.dot
)
@@ -226,7 +232,9 @@ CMAKEFILES(
STARTERS
STRATEGY
csv_to_comgeom.txt
docbook_files.cmake
implicit_constraints.txt
lcov.txt
pad_file.xml.in
trunk_hierarchy.org
)
+1 -2
View File
@@ -86,8 +86,7 @@ testing tool for TCP implementers via Network Working Group RFC 2398.
This product does not yet exist but is a long term goal. It's
basically several of the core libraries form BRL-CAD's geometry
modeling kernel including the present libbu, libbn, librt, libwdb,
liboptical, libmultispectral, and the ray-trace interface application
back-end.
liboptical, and the ray-trace interface application back-end.
This modeling kernel provides fundamental geometric representation,
ray-trace analysis, and geometric processing capabilities via a
+17
View File
@@ -42,3 +42,20 @@ compiled as libpng.so). If this happens, it likely indicates a problem
with the CMake build logic and should be reported as a bug - you may also
need to install a shared version of the library. Another possibility
would be to add -mipure-text to the linker flags.
OpenIndiana
-----------
To build with gcc and CMake on OpenIndiana, you need to install the
following packages:
pkg install pkg:/developer/gcc-7
pkg install pkg:/developer/build/cmake
pkg install pkg:/developer/versioning/subversion
pkg install pkg:/system/header
pkg install pkg:/developer/lexer/flex
(Note that gcc-7 building doesn't work as of 2017-08-23 - the above
install list is a starting point, but the repo currently doesn't
build and isn't close to building. It may be an older gcc would
have better luck...)
-145
View File
@@ -1,145 +0,0 @@
Date: Fri, 30 Oct 87 3:58:14 EST
From: Phil Dykstra <phil@BRL.ARPA>
Subject: Re: Animation querry.
I have been meaning to put a few notes together about animation in
BRL-CAD for some time now. Your message presses the point so here's
a really quick basic overview. Note that animation control is
still very early and experimental. Don't be surprised if much of
it changes in the future.
------
The earliest form of animation was just changing the viewpoint.
So that RT could ray trace the "current" MGED view, a -M flag was
added which tells RT to read the viewing matrix from stdin.
This matrix is written on six lines in the form:
viewsize
xpos ypos zpos
[4x4 rotation matrix, 4 elements per line]
Such data can be saved along with an RT shell script by the "saveview"
command in MGED. To get just this data (i.e. without the shell script),
the "savekey" command can be used. Thus one can save a string of
viewpoint keyframes via "savekey." ["Times" can also be added to
the keyframes for the purposes of some interpolation programs.]
Several tools were written (not in the distribution) which generate
sequences of such views, interpolate a set a keyframes, etc.
The "rmats" command was added to allow a file of these views to be
read in to MGED so you could watch the keyframes go by. Feeding the
same data to RT (via the -M flag) computes an image for each view.
The views either go to the frame buffer, or if an output filename
is given, they go into files with frame number suffixes.
Animation previews are typically made via low resolution ray traces,
composited into one large image via "pixtile," and viewed on a frame
buffer via "fbanim" (preferably one with hardware pan and zoom).
Later we wished to articulate the models themselves, so a command
script language was created for RT. These are also fed to RT
via the -M flag. RT figures out whether it is given the old form
above or a real script. An animation description script contains
transformation matrices to be applied to the model tree. A simple
one might look like:
start 42;
clean;
anim frob/nitz matrix rmul
1 0 0 1
0 1 0 2
0 0 1 0
0 0 0 0;
end;
etc.
start - says to start frame number 42.
clean - make RT clean up after itself (this may not be needed any more...).
anim - says to apply an matrix animation to the arc connecting frob to
nitz. The type of matrix operation is a right multiply (choices
include right or left multiply, replace, or reroot (i.e. world
coordinates)).
end - tells it to go ahead and shoot this frame.
Eventually there will be things besides "matrix" animations to allow
material properties etc. to be animated.
Various outboard tools generate motions, merge animation scripts
together, allow the previewing/editing of motions, etc. For the
most part these tools are sufficiently ad hoc and experimental
that we aren't giving any of them away yet. Next year some time....
-------
I didn't explain any of it in much detail, but hopefully it
gives you an overview. One of these days we will write some
more about it - like when we start including some motion tools.
==============================
Date: Fri, 30 Oct 87 16:42:14 EST
From: Phil Dykstra <phil@BRL.ARPA>
Subject: Re: Animation querry.
Here's a bit more about the matrix operations available in RT
animation scripts.
-----
RT Matrix Animation Operations:
==============================
In BRL-CAD, matrices are handled in their usual mathematical form
(the transpose of the Newman and Sproull "computer graphics form").
That is, a matrix looks like this:
r1 r2 r3 dx
r4 r5 r6 dy
r7 r8 r9 dz
0 0 0 1/s
Points are *column* vectors, so a point is transformed by:
newpoint = Matrix * oldpoint;
Thus the world coordinate system is on the "left" end of a stack of
matrix operations; the local coordinate system being that of the point
on the extreme right.
In walking a model tree (such as "prep'ing" the model for ray tracing),
each arc crossed from root to leaf normally gets its matrix multiplied on
the right side of the current matrix stack[1]. Rigid body articulations
of a model can then be described by changing or adding matrices at the
appropriate points in this stack.
The matrix animation operations currently recognized by RT are:
rstack replace the entire stack up to this point
rarc replace the matrix on the specified arc
rboth replace the entire stack and the arc matrix
rmul arc = arc * Matrix
lmul arc = Matrix * arc
The path specifying where in the model tree the operation is to
be applied can either be an absolute path, e.g.
/body/left/arm/hand
which would affect the arc between the left arm of body and the hand
(note that hand need not be a leaf), or it can be a "wildcard", e.g.
arm/hand
would mean the arc between arm and hand anywhere in the model tree, i.e.
it is not restricted to the left one as above. Finally a wildcard like
arm
means the arc before any node called arm.
-------------------------
[1] It is interesting to note that our "right multiply" operation
corresponds exactly to the SGI Iris multmatrix() command. The later
pre-multiplies the matrix stack, but the matrix stack post-multiplies
any points being transformed! In fact, if one looks at the Iris at the
geometry engine level, one finds that it works with matrices in the
usual mathematical form - the gl2 library transposes them in and out of
N&S form.
+2 -1
View File
@@ -47,10 +47,11 @@ add_subdirectory(articles)
add_subdirectory(books)
add_subdirectory(lessons)
add_subdirectory(presentations)
add_subdirectory(resources)
add_subdirectory(specifications)
add_subdirectory(system)
CMAKEFILES(README fop.xconf.in log4j.properties resources)
CMAKEFILES(README fop.xconf.in log4j.properties)
CMAKEFILES(README.DB_authors_notes)
CMAKEFILES(css/brlcad.css)
-10
View File
@@ -3881,11 +3881,6 @@
<link xlink:href="../../man1/en/rtshot.php">Rt shot</link>
</para>
</listitem>
<listitem>
<para>
<link xlink:href="../../man1/en/rttherm.php">Rt therm</link>
</para>
</listitem>
<listitem>
<para>
<link xlink:href="../../man1/en/rtwalk.php">Rt Walk</link>
@@ -3931,11 +3926,6 @@
<link xlink:href="../../man1/en/showtherm.php">Show Therm </link>
</para>
</listitem>
<listitem>
<para>
<link xlink:href="../../man1/en/ssamp-bw.php">Ssamp Bw</link>
</para>
</listitem>
<listitem>
<para>
<link xlink:href="../../man1/en/stl-g.php">Stl g</link>
-4
View File
@@ -138,10 +138,6 @@ eccetera.</para>
(fb), che gestisce l'apertura di una finestra di framebuffer sulla quale
effettuare il raytracing.</para>
<para>- <emphasis role="bold">libmultispectral</emphasis><emphasis role="bold">and liboptical</emphasis> &#xFFFD;
sono le librerie per lo shading ed il texturing utilizzate dal
raytracing.</para>
<para>- <emphasis role="bold">libpkg</emphasis> &#xFFFD; &#xFFFD; una libreria che inplementa il
meccanismo per il richiamo di una procedura remota (rpc). Questa libreria &#xFFFD;
un predecessore del sistema attuale rpc. Al contrario del tipico servizio
@@ -122,7 +122,7 @@
</listitem>
<listitem>
<para>
libmultispectral and liboptical - the shader and texturing libraries for the raytracer.
liboptical - the shader and texturing library for the raytracer.
</para>
</listitem>
<listitem>
+69
View File
@@ -0,0 +1,69 @@
set(dr_ignore_files
CMakeLists.txt
README
brlcad/brlcad-article-fo-stylesheet.xsl.in
brlcad/brlcad-article-xhtml-stylesheet.xsl.in
brlcad/brlcad-book-fo-stylesheet.xsl.in
brlcad/brlcad-book-xhtml-stylesheet.xsl.in
brlcad/brlcad-common.xsl.in
brlcad/brlcad-fo-stylesheet.xsl.in
brlcad/brlcad-fonts.xsl.in
brlcad/brlcad-gendata.xsl
brlcad/brlcad-lesson-fo-stylesheet.xsl.in
brlcad/brlcad-lesson-xhtml-stylesheet.xsl.in
brlcad/brlcad-man-fo-stylesheet.xsl.in
brlcad/brlcad-man-stylesheet.xsl.in
brlcad/brlcad-man-xhtml-stylesheet.xsl.in
brlcad/brlcad-presentation-fo-stylesheet.xsl.in
brlcad/brlcad-presentation-xhtml-stylesheet.xsl.in
brlcad/brlcad-specification-fo-stylesheet.xsl.in
brlcad/brlcad-specification-xhtml-stylesheet.xsl.in
brlcad/brlcad-xhtml-header-navigation.xsl
brlcad/brlcad-xhtml-stylesheet.xsl.in
brlcad/center-table-print.xsl
brlcad/images/brlcad-logo-669966.svg
brlcad/images/brlcad-logo-6699cc.svg
brlcad/images/brlcad-logo-blue.svg
brlcad/images/brlcad-logo-cc6666.svg
brlcad/images/brlcad-logo-cc9966.svg
brlcad/images/brlcad-logo-green.svg
brlcad/images/brlcad-logo-limegreen.svg
brlcad/images/brlcad-logo-red.svg
brlcad/images/logo-vm-gears.png
brlcad/images/logo-vm-gears.svg
brlcad/presentation.xsl.in
brlcad/tutorial-cover-template.xsl.in
brlcad/tutorial-template.xsl.in
brlcad/wordpress.xsl.in
other/README.schema
other/docbook-5.0.tar.bz2
other/docbook5xi.rnc
other/docbookxi.nvdl
other/expand.cmake
other/fonts/README
other/fonts/dejavu-lgc-fonts.tar.bz2
other/fonts/dejavu_COPYING.txt
other/fonts/stix-fonts.tar.bz2
other/fonts/stix_COPYING.txt
other/fonts/y14.5.tar.bz2
other/fonts/y14.5_COPYING.txt
other/offo/README.offo
other/offo/licenses.txt
other/offo/offo-2.0.tar.bz2
other/standard/README.svg
other/standard/README.xsl
other/standard/docbook-xsl-ns.tar.bz2
other/standard/met-fonts.xsl
other/standard/w3_svg_dtd.tar.bz2
)
CMAKEFILES(${dr_ignore_files})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-2
View File
@@ -219,7 +219,6 @@ set(man1_EN
rtregis.xml
rtscale.xml
rtshot.xml
rttherm.xml
rtwalk.xml
rtweight.xml
rtwizard.xml
@@ -229,7 +228,6 @@ set(man1_EN
shapefact.xml
showshot.xml
showtherm.xml
ssamp-bw.xml
stl-g.xml
sun-pix.xml
tabinterp.xml
-165
View File
@@ -1,165 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- lifted from troff+man by doclifter -->
<refentry xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en' xml:id='rttherm1'>
<refmeta>
<refentrytitle>RTTHERM
</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class='source'>BRL-CAD</refmiscinfo>
<refmiscinfo class='manual'>BRL-CAD</refmiscinfo>
</refmeta>
<refnamediv>
<refname>rttherm</refname>
<refpurpose>raytrace a hyper-spectral thermal image of an mged model</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv xml:id='synopsis'>
<cmdsynopsis>
<command>rttherm</command>
<arg choice='opt' rep='repeat'><replaceable>options</replaceable></arg>
<arg choice='plain'>-o <replaceable>output.ssamp</replaceable></arg>
<arg choice='plain'><replaceable>model.g</replaceable></arg>
<arg choice='plain' rep='repeat'><replaceable>objects</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 xml:id='description'><title>DESCRIPTION</title>
<para><citerefentry><refentrytitle>rttherm</refentrytitle><manvolnum>1</manvolnum></citerefentry>
is a member of the RTUIF family of programs,
and implements the same options as
<citerefentry><refentrytitle>rt</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
with the exception that the
<option>-F</option>
(framebuffer)
option is currently not implemented and reserved for future use.
<citerefentry><refentrytitle>rttherm</refentrytitle><manvolnum>1</manvolnum></citerefentry>
creates a hyper-spectral ray-trace into
the output file
specified with the
<option>-o</option>
option.
It also writes a second file (using bn_table_write) with
the suffix ".spect" which describes
the spectral sampling pattern used when creating the output file.</para>
</refsect1>
<refsect1 xml:id='specifying_temperatures'><title>SPECIFYING TEMPERATURES</title>
<para>Temperatures are always specified in degrees Kelvin ("Kelvins").</para>
<para>The background (ambient) temperature may be set from the command
line with the
<option>-c set bg_temp=degK</option>
command, or in the animation script with the command</para>
<literallayout remap='.nf'>
set bg_temp=293.0
</literallayout> <!-- .fi -->
<para>which is the default. (20 degrees C is 293 degrees Kelvin).</para>
<para>The spectral sampling density may be set from the command line
with the
<option>-c set spectrum=nsamp/lo_nm/hi_nm</option>
option, or in the animation script with the command</para>
<literallayout remap='.nf'>
set spectrum=nsamp/lo_nm/hi_nm
</literallayout> <!-- .fi -->
<para>The default setting is 100/380/12000,
which takes 100 samples equally spaced from 380nm (low end of the optical
band) to 12microns (upper end of the "Far-IR" band).</para>
<para><citerefentry><refentrytitle>rttherm</refentrytitle><manvolnum>1</manvolnum></citerefentry>
is built using
<citerefentry><refentrytitle>libmultispectral</refentrytitle><manvolnum>3</manvolnum></citerefentry>
rather than
<citerefentry><refentrytitle>liboptical</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
which provides a similar set of shaders.
Most notable is the "temp" shader,
which applies a two-dimensional temperature map to a region
in exactly the same way as the "texture" and "bwtexture" shaders apply
colors to the surface.</para>
<para>The temperature of a region may be modified by the
rt animation script which is read by
<citerefentry><refentrytitle>rttherm</refentrytitle><manvolnum>1</manvolnum></citerefentry>
when the
<option>-M</option>
flag is specified.
The syntax of the anim command is:</para>
<literallayout remap='.nf'>
anim path temp ## ;
</literallayout> <!-- .fi -->
<para>where
"anim" is a keyword,
"path" is the path specification for the affected combination(s),
"temp" is a keyword ("temperature" is also accepted), and
## is the new temperature for the combination(s) in Kelvins.</para>
<para>The Tcl interface to the database supports adjusting region temperatures.
The syntax of the anim command is:</para>
<literallayout remap='.nf'>
db put|adjust combname temp ##
</literallayout> <!-- .fi -->
<para>where
"db" is the name of the Tcl database object for the desired
database (typically "db" or ".inmem"),
"put" and "adjust" are keywords,
"combname" is the name of the combination,
"temp" is a keyword,
and
## is the new temperature for the combination in Kelvins.
Note that the BRL-CAD v4 database has no place for
storing region temperatures on disk,
so this command won't have any effect on v4 databases.</para>
</refsect1>
<refsect1 xml:id='post_processing'><title>POST PROCESSING</title>
<para><citerefentry><refentrytitle>ssampview</refentrytitle><manvolnum>1</manvolnum></citerefentry>
is a GUI tool for viewing
the multi-spectral output files created by
<citerefentry><refentrytitle>rttherm</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
In the works is a post-processing tool which will
extract a spectral window into a conventional
8-bit/pixel
<citerefentry><refentrytitle>bw</refentrytitle><manvolnum>5</manvolnum></citerefentry>
file, probably in two steps:
(1) extracting a representative power value per pixel
into a
<citerefentry><refentrytitle>dbw</refentrytitle><manvolnum>5</manvolnum></citerefentry>
(double-precision .bw file),
and then (2) using
<citerefentry><refentrytitle>cv</refentrytitle><manvolnum>1</manvolnum></citerefentry>
to perform a direct conversion, or using
<citerefentry><refentrytitle>dpix-pix</refentrytitle><manvolnum>1</manvolnum></citerefentry>
or similar tool to perform scaling and/or auto-ranging.</para>
</refsect1>
<refsect1 xml:id='see_also'><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>brlcad</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>mged</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>rt</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>librt</refentrytitle><manvolnum>3</manvolnum></citerefentry></para>
</refsect1>
<refsect1 xml:id='author'><title>AUTHOR</title>
<para>BRL-CAD Team</para>
</refsect1>
<refsect1 xml:id='copyright'><title>COPYRIGHT</title>
<para>This software is Copyright (c) 1999-2016 United States Government as
represented by the U.S. Army Research Laboratory.</para>
</refsect1>
<refsect1 xml:id='bug_reports'><title>BUG REPORTS</title>
<para>Reports of bugs or problems should be submitted via electronic
mail to &lt;devs@brlcad.org&gt;.</para>
</refsect1>
</refentry>
-119
View File
@@ -1,119 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- lifted from troff+man by doclifter -->
<refentry xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en' xml:id='ssampbw1'>
<refmeta>
<refentrytitle>SSAMP-BW
</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class='source'>BRL-CAD</refmiscinfo>
<refmiscinfo class='manual'>BRL-CAD</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ssamp-bw</refname>
<refpurpose>convert spectral sample data into a monochrome image</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv xml:id='synopsis'>
<cmdsynopsis>
<command>ssamp-bw</command>
<arg choice='opt'>-v </arg>
<arg choice='opt'>-s <replaceable>squarefilesize</replaceable></arg>
<arg choice='opt'>-w <replaceable>file_width</replaceable></arg>
<arg choice='opt'>-n <replaceable>file_height</replaceable></arg>
<arg choice='opt'>-l <replaceable>lower_wavelen</replaceable></arg>
<arg choice='opt'>-u <replaceable>upper_wavelen</replaceable></arg>
<arg choice='opt'>-m <replaceable>minval</replaceable></arg>
<arg choice='opt'>-M <replaceable>maxval</replaceable></arg>
<arg choice='plain'><replaceable>file.ssamp</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 xml:id='description'><title>DESCRIPTION</title>
<para><citerefentry><refentrytitle>ssamp-bw</refentrytitle><manvolnum>1</manvolnum></citerefentry>
reads a
<citerefentry><refentrytitle>ssamp</refentrytitle><manvolnum>5</manvolnum></citerefentry>
format file of spectral samples for the named file,
and produces a monochrome image in
<citerefentry><refentrytitle>bw</refentrytitle><manvolnum>5</manvolnum></citerefentry>
format.
The spectral definition is read from a second file named
file.ssamp.spect</para>
<para>Using the
<option>-l</option>
and
<option>-u</option>
parameters, a filter is constructed to select the energy collected
over a portion of the spectrum.
This filter is convolved with each pixel of the two-dimensional input
file and the power levels are summed into a two-dimensional array of
scalor results.</para>
<para>The scalor array is scanned to compute the maximum and minimum
power levels encountered in this image.
These are used to drive an "automatic gain control" algorithm
which maximizes the use of the limited 0..255 intensity output range.
Using the
<option>-m</option>
and
<option>-M</option>
options, either the minimum or maximum values (or both) may
be over-ridden from the command line.
This is particularly useful when processing a series of
<emphasis remap='I'>ssamp</emphasis>
files
(e.g. for an animation sequence)
and you don't want the gain control settings changing
from frame to frame.</para>
<para>The
<option>-v</option>
option sets "verbose" mode,
causing the spectral sampling definition and the filter kernel to be
printed on standard error.</para>
</refsect1>
<refsect1 xml:id='example'><title>EXAMPLE</title>
<para> ssamp-bw -s512 -M0.3 -l3000 -u5000 moss.ssamp | bw-fb -s512</para>
<para>This converts the energy received in the 3-5 micron ("mid-IR") band
into a monochrome image,
clamping any power greater than 0.3 to a value of 255 in the output,
and displays this monochrome image on the current framebuffer.</para>
</refsect1>
<refsect1 xml:id='see_also'><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>rttherm</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>bw-fb</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>dpix-pix</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>pix</refentrytitle><manvolnum>5</manvolnum></citerefentry></para>
</refsect1>
<refsect1 xml:id='diagnostics'><title>DIAGNOSTICS</title>
<para>If the
<emphasis remap='I'>pix</emphasis>
file is shorter than expected,
or the size parameters are given incorrectly,
an error is printed.</para>
<para>If the spectral range specified for the filter is outside the
spectral range sampled in the input file, the program aborts with an error.</para>
</refsect1>
<refsect1 xml:id='author'><title>AUTHOR</title>
<para>BRL-CAD Team</para>
</refsect1>
<refsect1 xml:id='copyright'><title>COPYRIGHT</title>
<para>This software is Copyright (c) 2000-2016 by the United States
Government as represented by U.S. Army Research Laboratory.</para>
</refsect1>
<refsect1 xml:id='bug_reports'><title>BUG REPORTS</title>
<para>Reports of bugs or problems should be submitted via electronic
mail to &lt;devs@brlcad.org&gt;.</para>
</refsect1>
</refentry>
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -336,10 +336,11 @@ ADD_DOC(relnotes_5_summary_HTML html/ReleaseNotes/Rel5.0/Summary)
ADD_DOC(ReleaseNotes/Rel6.0/index.html html/ReleaseNotes/Rel6.0)
add_subdirectory(manuals/mged/animmate)
set(html_ignore_files
ReleaseNotes/Rel6.0
manuals/mged/animmate
manuals/shaders
ReleaseNotes/Rel6.0/index.html
manuals/shaders/camo.html
manuals/small-eagleCAD.ico
)
CMAKEFILES(${html_ignore_files})
-1
View File
@@ -80,7 +80,6 @@ BRL-CAD<font size="-1">(tm)</font> Unleashed
<ol>
<li><H2>rt</h2>
<li><H2>remrt</h2>
<li><H2>rttherm</h2>
<li><H2><a HREF="shaders/index.html">Shaders and Material Properties</a></h2>
<li><H2>Animation</h2>
<ol>
@@ -0,0 +1,78 @@
set(anim_ignore_files
CMakeLists.txt
anim_cascade.html
anim_doc.html
anim_fly.html
anim_hardtrack.html
anim_keyread.html
anim_lookat.html
anim_man_pages.html
anim_offset.html
anim_orient.html
anim_script.html
anim_sort.html
anim_time.html
anim_track.html
anim_turn.html
anim_tut.html
animate.html
ceditor.gif
chan_mult.html
chan_permute.html
combine_doc.html
cscripts.gif
curve_doc.html
end_tut.html
etime.gif
fbanim.html
left.tcl
left_wheels.txt
mmenu.gif
object_tut.html
oscript.gif
oscript_doc.html
pixtile.html
prep_tut.html
right.tcl
right_wheels.txt
rt.html
rt_tut.html
scriptsort.html
show_doc.html
sscripts.gif
tabinterp.html
table_doc.html
tabsub.html
tank_path.txt
teditor.gif
track.txt
track_tut.html
tscript.gif
tscript_doc.html
tut.html
tut1.png
tut2.png
tut4.gif
tut5.gif
tut6.png
tut7.png
tut8.png
vcdwidget.gif
vceditor.gif
vcurve_doc.html
vdraw.html
view_tut.html
viewget.html
vscript_doc.html
)
CMAKEFILES(${anim_ignore_files})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+34
View File
@@ -0,0 +1,34 @@
Notes on using gcov/lcov with BRL-CAD
Build with the BRLCAD_ENABLE_CAPTURE option set to ON
If using only gcov, you need to cd to the directory where the object files were
built and specify the object file(s) in question fully, e.g. (from the build
directory):
$ cd src/libbu/CMakeFiles/libbu.dir/
$ gcov b64.c.o vls.c.o
File '/brlcad/src/libbu/b64.c'
Lines executed:88.10% of 126
/brlcad/src/libbu/b64.c:creating 'b64.c.gcov'
File '/brlcad/src/libbu/vls.c'
Lines executed:74.66% of 363
/brlcad/src/libbu/vls.c:creating 'vls.c.gcov'
When running lcov (from the build directory, assuming the
build directory itself is <source_dir>/build):
find . -name '*.gcda' -print0 | xargs -0 rm
make -j3 check
lcov --capture --directory . --output-file coverage.info
lcov -r coverage.info \*\/build\/\* > coverage-2.info
lcov -r coverage-2.info \*\/other\/\* > coverage-3.info
lcov -r coverage-3.info \/usr\/\* > coverage-4.info
lcov -r coverage-4.info \*\/misc\/\* > coverage-5.info
lcov -r coverage-5.info \*\/tests\/\* > coverage_cad.info
rm coverage-*.info
genhtml coverage_cad.info --output-directory lcov-output
-29
View File
@@ -1,29 +0,0 @@
DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
General Discussion about how to Make Animations using the BRL-CAD Package
There are several distinct aspects to producing an animation:
1) The creative insight.
2) Specification of the geometry.
3) Specification of the material properties, colors, textures.
4) Specification of the model motion and articulation (choreography),
plus specification of the camera motion and lighting details
(cinematography).
5) Previewing the animation sequence using wireframe tools.
6) Computation ("rendering") of the final sequence in very low
resolution, suitable for frame-buffer animation previews (see
fbanim(1)).
7) Computation ("rendering") of the final ray-traced images, storing
them in .pix files.
8) Viewing selected frames, to review them for quality.
9) Recording of the final images either on videotape or 16mm movie
film.
-27
View File
@@ -1,27 +0,0 @@
Some notes on using BRL-CAD on Sun Workstations (Release 3.0):
As of Release 3.0 MGED is much improved on the Suns. It now opens
its own window which can be resized, iconified, etc., like other
windows under SunTools.
While a generic replacement for knobs and buttons was not completed,
the function keys F1-F7 help somewhat. Pressing these keys attaches
certain "knob" functions to the mouse X or Y motions:
F# Function Mouse
1 Zoom y
2 Z Slew y
3 X Slew x
4 Y Slew y
5 X Rotate x
6 Y Rotate y
7 Z Rotate y
These keys can be used as "chords", e.g. pressing F3 and F4 together
will give you X and Y translates on the mouse.
Frame buffer support has also been greatly enhanced, but the released
version does not yet open its own window for display. Rather, it
covers the window a frame buffer command was invoked from with the
display. Panning and Zooming are now supported, as is shared memory.
"/dev/sunp" can be used to get private memory.
-3
View File
@@ -24,7 +24,6 @@ rtscale
rtshot
rtsil
rtsrv
rttherm
rtwalk
rtweight
rtwizard (GUI)
@@ -150,7 +149,6 @@ pix-yuv
png-bw
png-pix
rle-pix
ssamp-bw
sun-pix
u-a
u-bw
@@ -292,7 +290,6 @@ random
script-tab
scriptsort
smod
ssampview (GUI)
syn
tabinterp
tabsub
-17
View File
@@ -721,7 +721,6 @@
****** [[file:../doc/docbook/system/man1/en/png-bw.xml][png-bw.xml]]
****** [[file:../doc/docbook/system/man1/en/wdb_example.xml][wdb_example.xml]]
****** [[file:../doc/docbook/system/man1/en/bw-rle.xml][bw-rle.xml]]
****** [[file:../doc/docbook/system/man1/en/rttherm.xml][rttherm.xml]]
****** [[file:../doc/docbook/system/man1/en/pix-ppm.xml][pix-ppm.xml]]
****** [[file:../doc/docbook/system/man1/en/pixblend.xml][pixblend.xml]]
****** [[file:../doc/docbook/system/man1/en/fbed.xml][fbed.xml]]
@@ -906,7 +905,6 @@
****** [[file:../doc/docbook/system/man1/en/bwhisteq.xml][bwhisteq.xml]]
****** [[file:../doc/docbook/system/man1/en/fbanim.xml][fbanim.xml]]
****** [[file:../doc/docbook/system/man1/en/fb-bw.xml][fb-bw.xml]]
****** [[file:../doc/docbook/system/man1/en/ssamp-bw.xml][ssamp-bw.xml]]
****** [[file:../doc/docbook/system/man1/en/rt.xml][rt.xml]]
****** [[file:../doc/docbook/system/man1/en/hex.xml][hex.xml]]
****** [[file:../doc/docbook/system/man1/en/sun-pix.xml][sun-pix.xml]]
@@ -1796,9 +1794,6 @@
*** [[file:../src/anim/anim_sort.c][anim_sort.c]]
*** [[file:../src/anim/anim_track.c][anim_track.c]]
*** [[file:../src/anim/anim_turn.c][anim_turn.c]]
** [[file:../src/libmultispectral][libmultispectral]]
*** [[file:../src/libmultispectral/sh_temp.c][sh_temp.c]]
*** [[file:../src/libmultispectral/CMakeLists.txt][CMakeLists.txt]]
** [[file:../src/brlman][brlman]]
*** [[file:../src/brlman/brlman.sh.in][brlman.sh.in]]
*** [[file:../src/brlman/brlman.bat][brlman.bat]]
@@ -4638,16 +4633,6 @@
*** [[file:../src/sig/i-f.c][i-f.c]]
*** [[file:../src/sig/dauto2.c][dauto2.c]]
*** [[file:../src/sig/ddisp.c][ddisp.c]]
** [[file:../src/rttherm][rttherm]]
*** [[file:../src/rttherm/ssampview.c][ssampview.c]]
*** [[file:../src/rttherm/spectrum.c][spectrum.c]]
*** [[file:../src/rttherm/ssampview.tcl][ssampview.tcl]]
*** [[file:../src/rttherm/test.sh][test.sh]]
*** [[file:../src/rttherm/std_day_1km.dat][std_day_1km.dat]]
*** [[file:../src/rttherm/ssamp-bw.c][ssamp-bw.c]]
*** [[file:../src/rttherm/CMakeLists.txt][CMakeLists.txt]]
*** [[file:../src/rttherm/viewtherm.c][viewtherm.c]]
*** [[file:../src/rttherm/pixtest.c][pixtest.c]]
** [[file:../src/libwdb][libwdb]]
*** [[file:../src/libwdb/mater.c][mater.c]]
*** [[file:../src/libwdb/datum.c][datum.c]]
@@ -13686,7 +13671,6 @@
*** [[file:../misc/doxygen/libfft.dox][libfft.dox]]
*** [[file:../misc/doxygen/libtclcad.dox][libtclcad.dox]]
*** [[file:../misc/doxygen/libtermio.dox][libtermio.dox]]
*** [[file:../misc/doxygen/libmultispectral.dox][libmultispectral.dox]]
*** [[file:../misc/doxygen/libanalyze.dox][libanalyze.dox]]
*** [[file:../misc/doxygen/images][images]]
**** [[file:../misc/doxygen/images/README.txt][README.txt]]
@@ -13926,7 +13910,6 @@
** [[file:../misc/pkgconfig][pkgconfig]]
*** [[file:../misc/pkgconfig/libgm.pc.in][libgm.pc.in]]
*** [[file:../misc/pkgconfig/libicv.pc.in][libicv.pc.in]]
*** [[file:../misc/pkgconfig/libmultispectral.pc.in][libmultispectral.pc.in]]
*** [[file:../misc/pkgconfig/librt.pc.in][librt.pc.in]]
*** [[file:../misc/pkgconfig/libfft.pc.in][libfft.pc.in]]
*** [[file:../misc/pkgconfig/libpkg.pc.in][libpkg.pc.in]]
-158
View File
@@ -1,158 +0,0 @@
DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
Specific details about producing an animation of a gun tube,
using the BRL-CAD Package and various IBD simulation codes.
As things presently stand, the central part of this linkage is a program
called TUBE.C that takes two input files describing the motion of the
scene, and generates an MGED database containing a separate tree
(Directed Acyclic Graph [DAG]) for each frame. The name of combination
at the top of the tree is the letter "g" (for group) followed by the
frame number, so that the first frame of the animation is tree "g0", the
second frame is tree "g1", etc.
The current X displacement data for the gun tube center of mass points
is presently contained in the array dxtab[] compiled into the program.
The input file "pos.dat" contains the projectile position data. On each
input line, the time (in milliseconds) is listed first, followed by the
X displacement of the base of the projectile, offset from the projectile
starting position. The time values listed in this file do not have to
correspond to the time values listed for the articulation; the proper
time will be chosen by the program. If the file "tank.out" contains the
output from a normal run of IBHVG2, the file "pos.dat" can be created by
running this Shell script:
cat tank.out |
sed -n '/ TIME TRAV/,/ PROJECTILE EXIT/p' |
grep -v "[A-Z]" |
cut -c2-132 |
grep -v "^[ ]*$" |
awk '{printf "%10.2f %10.2f\n", $1, $2 }' > pos.dat
The mass displacement file is presented to the TUBE program on standard
input, where each time step has the following format: First a line with
the word "TIME" followed by a floating point number, in milliseconds.
Then, one input line for each of ``nmass'' (e.g., 12) mass points, in
ascending order of mass point number, starting with one, with one
integer and three floating point numbers on each line: the mass number,
the X, Y, and Z deviations (currently expected in inches, where +X is
towards the muzzle, +Y is in the vertical direction, and +Z is to the
right of the muzzle). There must be exactly one blank line after the
last mass point data line and before the next "TIME" line. Note that
mass point 1 corresponds to "m1" on the diagram, and mass point 12 is
"m12" on the diagram. The position of a two additional points (0 and
13) are guessed within the program, with mass point 0 being the outer
edge of the breach block, and mass point 13 being the muzzle end, but
these two points are not specified in the input file. E.g.,
TIME 0.02
1 0.01 0.00035 0.00000075
2 0.01 0.00040 0.00000900
(etc.)
12 1.01 0.0784 3.129
TIME 0.04
(etc.)
Therefore, assuming the mass displacement file is in "mass.dat",
and that the "pos.dat" file exists in the same directory,
and that the model for the projectile is in the file "projectile.g"
with main (top) combination named "ke",
the TUBE program is run as follows:
tube < mass.dat > anim.g
cat projectile.g >> anim.g
This MGED database can be examined with MGED. To see the first
frame, say:
mged anim.g
then respond to the "attach" question appropriately for the type of
graphics device being used, and then enter the command
B g0
This will display the geometry configuration for frame zero.
The "B" command in MGED stands for "Blast screen clear, then display
named object(s)". To view frame 42, enter the command
B g42
and so on. The MGED control dials can be used to translate, rotate,
and zoom the current viewpoint. When a desirable viewpoint has been
selected, it can saved in a file called "view1.sh" with the command
saveview view1.sh
This file is actually a Shell script that will render that one frame for
you, using RT, and store it in a file. However, in this case, a text
editor is used to extract just the viewsize, eye point, and homogeneous
transform matrix (20 numbers in all) and store them in another file, say
"view1.mat".
To preview the whole animation in wireframe format, assuming that there
are 300 frames running 0 to 299, this Shell script (called, say,
"preview.sh") is used:
rm -f temp.sh
cat << END > temp.sh
mged anim.g
attach ir (for SGI 3-D, or "sgi" for SGI 4-D)
B g0
rmats view1.mat
END
for frame in `loop 0 299`
do
echo "B g${frame}" >> temp.sh
done
sh temp.sh
rm -f temp.sh
Assuming that this animation sequence and viewpoint are satisfactory,
and that the desired "graph paper" background file is stored in a
128x128 .pix file called "movie128bw.pix" in the current directory,
the animation can be rendered the Shell script given below (called, say,
"render.sh"):
for frame in `loop 0 299`
do
rt -s512 -M -o out.pix.${frame} \
anim.g g${frame} < view1.mat >>& render.log
done
The "-s512" parameter specifies that the desired image is to be square,
and 512x512 pixels in size. This is typically the desired resolution
for videotape. The "-M" parameter specifies that the view matrix is to
be obtained from stdin. The "-o out.pix.${frame}" says that the output
picture is to be stored in a file called "out.pix.123" where "123"
represents the current frame number. (The backslash at the end of the
line continues the command to the next line). Specifying "anim.g"
names the input MGED database, and "g${frame}" specifies the treetop
appropriate for the current frame.
Because this procedure is likely to take a significant amount of time,
the shell script should be submitted as a batch job. On the minicomputers,
the MDQS command
batch render.sh
should be used. On both of the UNICOS Cray systems, the NQS command
qsub render.sh
should be used.
To view one of these files, the Shell environment variable FB_FILE
should be set to indicate the appropriate framebuffer on the network
to use, and the program "pix-fb" is used to transfer the picture to
the framebuffer. For more details on the variable FB_FILE, consult
the brlcad(1) manual page; for more details on the program "pix-fb",
consult the pix-fb(1) manual page; for more details on the framebuffer
library, consult libfb(3) manual page. This can be done on BRL-IBD
with these commands:
man brlcad
man pix-fb
man libfb
+5 -2
View File
@@ -42,7 +42,6 @@ set(public_hdrs
photonmap.h
pc.h
pkg.h
spectrum.h
vmath.h
wdb.h
)
@@ -81,7 +80,11 @@ CMAKEFILES(${noinst_HEADERS})
set(include_misc
brlcad_ident.h.in
conf
conf/BrlcadConfig.tmpl
conf/MAJOR
conf/MINOR
conf/PATCH
conf/make.vbs
config_win.h.in
)
CMAKEFILES(${include_misc})
+56 -30
View File
@@ -75,23 +75,24 @@ struct bn_vlist {
/* should these be enum? -Erik */
/* Values for cmd[] */
#define BN_VLIST_LINE_MOVE 0
#define BN_VLIST_LINE_DRAW 1
#define BN_VLIST_POLY_START 2 /**< @brief pt[] has surface normal */
#define BN_VLIST_POLY_MOVE 3 /**< @brief move to first poly vertex */
#define BN_VLIST_POLY_DRAW 4 /**< @brief subsequent poly vertex */
#define BN_VLIST_POLY_END 5 /**< @brief last vert (repeats 1st), draw poly */
#define BN_VLIST_POLY_VERTNORM 6 /**< @brief per-vertex normal, for interpolation */
#define BN_VLIST_TRI_START 7 /**< @brief pt[] has surface normal */
#define BN_VLIST_TRI_MOVE 8 /**< @brief move to first triangle vertex */
#define BN_VLIST_TRI_DRAW 9 /**< @brief subsequent triangle vertex */
#define BN_VLIST_TRI_END 10 /**< @brief last vert (repeats 1st), draw poly */
#define BN_VLIST_TRI_VERTNORM 11 /**< @brief per-vertex normal, for interpolation */
#define BN_VLIST_POINT_DRAW 12 /**< @brief Draw a single point */
#define BN_VLIST_POINT_SIZE 13 /**< @brief specify point pixel size */
#define BN_VLIST_LINE_WIDTH 14 /**< @brief specify line pixel width */
#define BN_VLIST_CMD_MAX 14 /**< @brief Max command number */
#define BN_VLIST_LINE_MOVE 0 /**< @brief specify new line */
#define BN_VLIST_LINE_DRAW 1 /**< @brief subsequent line vertex */
#define BN_VLIST_POLY_START 2 /**< @brief pt[] has surface normal */
#define BN_VLIST_POLY_MOVE 3 /**< @brief move to first poly vertex */
#define BN_VLIST_POLY_DRAW 4 /**< @brief subsequent poly vertex */
#define BN_VLIST_POLY_END 5 /**< @brief last vert (repeats 1st), draw poly */
#define BN_VLIST_POLY_VERTNORM 6 /**< @brief per-vertex normal, for interpolation */
#define BN_VLIST_TRI_START 7 /**< @brief pt[] has surface normal */
#define BN_VLIST_TRI_MOVE 8 /**< @brief move to first triangle vertex */
#define BN_VLIST_TRI_DRAW 9 /**< @brief subsequent triangle vertex */
#define BN_VLIST_TRI_END 10 /**< @brief last vert (repeats 1st), draw poly */
#define BN_VLIST_TRI_VERTNORM 11 /**< @brief per-vertex normal, for interpolation */
#define BN_VLIST_POINT_DRAW 12 /**< @brief Draw a single point */
#define BN_VLIST_POINT_SIZE 13 /**< @brief specify point pixel size */
#define BN_VLIST_LINE_WIDTH 14 /**< @brief specify line pixel width */
#define BN_VLIST_DISPLAY_MAT 15 /**< @brief specify the model matrix */
#define BN_VLIST_MODEL_MAT 16 /**< @brief specify the display matrix */
#define BN_VLIST_CMD_MAX 16 /**< @brief Max command number */
/**
* Applications that are going to use BN_ADD_VLIST and BN_GET_VLIST
* are required to execute this macro once, on their _free_hd:
@@ -128,6 +129,31 @@ struct bn_vlist {
_vp->cmd[_vp->nused++] = (draw); \
}
/** Change the transformation matrix to display */
#define BN_VLIST_SET_DISP_MAT(_free_hd, _dest_hd, _ref_pt) { \
struct bn_vlist *_vp; \
BU_CK_LIST_HEAD(_dest_hd); \
_vp = BU_LIST_LAST(bn_vlist, (_dest_hd)); \
if (BU_LIST_IS_HEAD(_vp, (_dest_hd)) || _vp->nused >= BN_VLIST_CHUNK) { \
BN_GET_VLIST(_free_hd, _vp); \
BU_LIST_INSERT((_dest_hd), &(_vp->l)); \
} \
VMOVE(_vp->pt[_vp->nused], (_ref_pt)); \
_vp->cmd[_vp->nused++] = BN_VLIST_DISPLAY_MAT; \
}
/** Change the transformation matrix to model */
#define BN_VLIST_SET_MODEL_MAT(_free_hd, _dest_hd) { \
struct bn_vlist *_vp; \
BU_CK_LIST_HEAD(_dest_hd); \
_vp = BU_LIST_LAST(bn_vlist, (_dest_hd)); \
if (BU_LIST_IS_HEAD(_vp, (_dest_hd)) || _vp->nused >= BN_VLIST_CHUNK) { \
BN_GET_VLIST(_free_hd, _vp); \
BU_LIST_INSERT((_dest_hd), &(_vp->l)); \
} \
_vp->cmd[_vp->nused++] = BN_VLIST_MODEL_MAT; \
}
/** Set a point size to apply to the vlist elements that follow. */
#define BN_VLIST_SET_POINT_SIZE(_free_hd, _dest_hd, _size) { \
struct bn_vlist *_vp; \
@@ -239,8 +265,8 @@ BN_EXPORT extern int bn_ck_vlist(const struct bu_list *vhead);
* densely packed than the source.
*/
BN_EXPORT extern void bn_vlist_copy(struct bu_list *vlists,
struct bu_list *dest,
const struct bu_list *src);
struct bu_list *dest,
const struct bu_list *src);
/**
@@ -251,8 +277,8 @@ BN_EXPORT extern void bn_vlist_copy(struct bu_list *vlists,
* length are available conveniently.
*/
BN_EXPORT extern void bn_vlist_export(struct bu_vls *vls,
struct bu_list *hp,
const char *name);
struct bu_list *hp,
const char *name);
/**
@@ -260,21 +286,21 @@ BN_EXPORT extern void bn_vlist_export(struct bu_vls *vls,
* vls_vlist() and received from another machine, into a vlist chain.
*/
BN_EXPORT extern void bn_vlist_import(struct bu_list *vlists,
struct bu_list *hp,
struct bu_vls *namevls,
const unsigned char *buf);
struct bu_list *hp,
struct bu_vls *namevls,
const unsigned char *buf);
BN_EXPORT extern void bn_vlist_cleanup(struct bu_list *hd);
BN_EXPORT extern struct bn_vlblock *bn_vlblock_init(struct bu_list *free_vlist_hd, /* where to get/put free vlists */
int max_ent);
int max_ent);
BN_EXPORT extern void bn_vlblock_free(struct bn_vlblock *vbp);
BN_EXPORT extern struct bu_list *bn_vlblock_find(struct bn_vlblock *vbp,
int r,
int g,
int b);
int r,
int g,
int b);
BN_EXPORT void bn_vlist_rpp(struct bu_list *vlists, struct bu_list *hd, const point_t minn, const point_t maxx);
@@ -284,7 +310,7 @@ BN_EXPORT void bn_vlist_rpp(struct bu_list *vlists, struct bu_list *hd, const po
* color.
*/
BN_EXPORT extern void bn_plot_vlblock(FILE *fp,
const struct bn_vlblock *vbp);
const struct bn_vlblock *vbp);
/**
* Output a vlist as an extended 3-D floating point UNIX-Plot file.
@@ -292,7 +318,7 @@ BN_EXPORT extern void bn_plot_vlblock(FILE *fp,
* UNIX-Plot output.
*/
BN_EXPORT extern void bn_vlist_to_uplot(FILE *fp,
const struct bu_list *vhead);
const struct bu_list *vhead);
/** @} */
+12 -12
View File
@@ -215,23 +215,23 @@ extern "C++" {
inline void
BBNode::GetBBox(float *min, float *max) const
{
min[0] = m_node.m_min[0];
min[1] = m_node.m_min[1];
min[2] = m_node.m_min[2];
max[0] = m_node.m_max[0];
max[1] = m_node.m_max[1];
max[2] = m_node.m_max[2];
min[0] = (float)m_node.m_min.x;
min[1] = (float)m_node.m_min.y;
min[2] = (float)m_node.m_min.z;
max[0] = (float)m_node.m_max.x;
max[1] = (float)m_node.m_max.y;
max[2] = (float)m_node.m_max.z;
}
inline void
BBNode::GetBBox(double *min, double *max) const
{
min[0] = m_node.m_min[0];
min[1] = m_node.m_min[1];
min[2] = m_node.m_min[2];
max[0] = m_node.m_max[0];
max[1] = m_node.m_max[1];
max[2] = m_node.m_max[2];
min[0] = m_node.m_min.x;
min[1] = m_node.m_min.y;
min[2] = m_node.m_min.z;
max[0] = m_node.m_max.x;
max[1] = m_node.m_max.y;
max[2] = m_node.m_max.z;
}
-1
View File
@@ -81,7 +81,6 @@
#include "./bu/malloc.h"
#include "./bu/mapped_file.h"
#include "./bu/mime.h"
#include "./bu/namegen.h"
#include "./bu/observer.h"
#include "./bu/opt.h"
#include "./bu/parallel.h"
-1
View File
@@ -19,7 +19,6 @@ set(bu_headers
magic.h
malloc.h
mapped_file.h
namegen.h
observer.h
opt.h
parallel.h
+2
View File
@@ -23,6 +23,8 @@
#include "common.h"
#include <limits.h> /* for CHAR_BIT */
#include "bu/defines.h"
#include "bu/magic.h"
#include "bu/list.h"
-1
View File
@@ -24,7 +24,6 @@
#include "common.h"
#include <stddef.h> /* for size_t */
#include <limits.h> /* for CHAR_MAX */
#include "bu/defines.h"
+3 -2
View File
@@ -122,8 +122,8 @@ __BEGIN_DECLS
#define RT_TGC_INTERNAL_MAGIC 0xaabbdd87 /**< ???? */
#define RT_TOR_INTERNAL_MAGIC 0x9bffed87 /**< ???? */
#define RT_VOL_INTERNAL_MAGIC 0x987ba1d0 /**< ?{?? */
#define RT_PNTS_INTERNAL_MAGIC 0x706e7473 /**< pnts */
#define RT_ANNOTATION_INTERNAL_MAGIC 0x616e6e6f /**< anno */
#define RT_PNTS_INTERNAL_MAGIC 0x706e7473 /**< pnts */
#define RT_ANNOT_INTERNAL_MAGIC 0x616e6e6f /**< anno */
#define RT_HRT_INTERNAL_MAGIC 0x6872743f /**< hrt? */
/* n-manifold geometry */
@@ -210,6 +210,7 @@ __BEGIN_DECLS
#define CURVE_CARC_MAGIC 0x63617263 /**< carc */
#define CURVE_LSEG_MAGIC 0x6c736567 /**< lseg */
#define CURVE_NURB_MAGIC 0x6e757262 /**< nurb */
#define ANN_TSEG_MAGIC 0x74736567 /**< tseg */
#define DB5_RAW_INTERNAL_MAGIC 0x64357269 /**< d5ri */
#define DBI_MAGIC 0x57204381 /**< W C? */
#define DB_FULL_PATH_MAGIC 0x64626670 /**< dbfp */
+3 -2
View File
@@ -45,8 +45,9 @@ __BEGIN_DECLS
/** @{ */
/** @file bu/malloc.h */
BU_EXPORT extern long bu_n_malloc;
BU_EXPORT extern long bu_n_realloc;
BU_EXPORT extern size_t bu_n_malloc;
BU_EXPORT extern size_t bu_n_realloc;
BU_EXPORT extern size_t bu_n_free;
/**
* This routine only returns on successful allocation. We promise
-102
View File
@@ -1,102 +0,0 @@
/* N A M E G E N . H
* BRL-CAD
*
* Copyright (c) 2015-2016 United States Government as represented by
* the U.S. Army Research Laboratory.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this file; see the file named COPYING for more
* information.
*/
#ifndef BU_NAMEGEN_H
#define BU_NAMEGEN_H
#include "common.h"
#include "bu/defines.h"
#include "bu/ptbl.h"
#include "bu/vls.h"
__BEGIN_DECLS
/** @addtogroup bu_namegen
* @brief
* Sequential name generation.
*
* A problem frequently encountered when generating names is generating names
* that are in some sense structured but avoid colliding. For example, given a
* geometry object named:
*
* engine_part.s
*
* an application wanting to make multiple copies of engine_part.s
* automatically might want to produce a list of names such as:
*
* engine_part.s-1 engine_part.s-2 engine_part.s-3 ...
*
* However, it is equally plausible that the desired pattern might be:
*
* engine_part_001.s engine_part_002.s engine_part_003.s ...
*
* This module implements an engine for generating the "next" name in a
* sequence, given a pattern and a state definition. The state definition is
* opaque to the user and is used internally to define a notion of current and
* next names in the sequence.
*
* TODO - describe how to specify regex expressions for matching - will use ()
* subexpressions.
*
* The caller may optionally specify incrementation behavior with an incrementer
* specification string, which has the following form:
*
* minwidth:init:max:step[:left_sepchar:right_sepchar]
*
* In the case of spacing, init, min, max, and step a '0' always indicates default
* unspecified behavior. So, an incrementer specified as 0:0:0:0 would behave
* as follows:
*
* spacing: standard printf handling of number value
* init: from initial name string
* max: LONG_MAX
* step: 1
*
* The last two separator chars are optional - they may be specified
* if the user wants to guarantee a separation between the active incremented
* substring and its surroundings. For example, the following would prefix the
* incrementer output with an underscore and add a suffix with a dash:
*
* 2:1:50:5:_:-
*
* If no specifier is passed in, bu_namegen will analyze the string to
* determine the minimum width of the incrementer string. So, for example,
* engine_part-001.s would by default be incremented to engine_part-002.s.
*/
/** @{ */
/** @file bu/namegen.h */
BU_EXPORT extern int bu_namegen(struct bu_vls *name, const char *regex_str, const char *incr_spec);
/** @} */
__END_DECLS
#endif /* BU_NAMEGEN_H */
/*
* Local Variables:
* mode: C
* tab-width: 8
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+194
View File
@@ -461,6 +461,200 @@ BU_EXPORT extern const char *bu_vls_encode(struct bu_vls *vp, const char *str);
*/
BU_EXPORT extern const char *bu_vls_decode(struct bu_vls *vp, const char *str);
/**
@brief
Automatic string generation routines.
There are many situations where a calling program, given an input string,
needs to produce automatically derived output strings that satisfy some
criteria (incremented, special characters removed, etc.) The functions
below perform this type of work.
*/
/**
* A problem frequently encountered when working with strings in BRL-CAD
* is the presence of special characters, characters active in the scripting
* language being applied, or other problematic contents that interfere with
* processing or readability of strings. This function takes a vls as an
* input and simplifies it as follows:
*
* 1) Reduce characters present to alpha-numeric characters and those
* characters supplied to the routine in the "keep" string. Substitute
* is performed as follows:
*
* * Skip any character in the "keep" string
*
* * Replace diacritic characters(code >= 192) from the extended ASCII set
* with a specific mapping from the standard ASCII set. See discussion at:
* http://stackoverflow.com/questions/14094621/ for more about this.
*
* * Replace any non-keep characters that aren't replaced by other
* approaches with the '_' underscore character
*
* 2) Collapses duplicate characters in the "de_dup" string.
*
* 3) Remove leading and trailing characters in the "trim' string.
*
* Returns 0 if string was not altered, 1 otherwise.
*/
BU_EXPORT extern int bu_vls_simplify(struct bu_vls *vp, const char *keep, const char *de_dup, const char *trim);
/**
* callback type for bu_vls_incr()
*/
typedef int (*bu_vls_uniq_t)(struct bu_vls *v, void *data);
/**
A problem frequently encountered when generating names is generating names
that are in some sense structured but avoid colliding. For example, given a
geometry object named:
@verbatim
engine_part.s
@endverbatim
an application wanting to make multiple copies of engine_part.s
automatically might want to produce a list of names such as:
@verbatim
engine_part.s-1, engine_part.s-2, engine_part.s-3, ...
@endverbatim
However, it is equally plausible that the desired pattern might be:
@verbatim
engine_part_0010.s, engine_part_0020.s, engine_part_0030.s, ...
@endverbatim
This function implements an engine for generating the "next" name in a
sequence, given an initial name supplied by the caller and (optionally)
information to identify the incrementor in the string and the incrementing
behavior desired. bu_vls_incr does not track any "state" for individual
strings - all information is contained either in the current state of the
input string itself or the incrementation specifier (more details on the
latter can be found below.)
@param[in,out] name Contains the "seed" string for the name generation. Upon return the old string is cleared and the new one resides in name
@param[in] regex_str Optional - user supplied regular expression for locating the incrementer substring.
@param[in] incr_spec Optional - string of colon separated parameters defining function behavior.
\section bu_vls_incr_regexp Incrementer Substring Identification
bu_vls_incr uses regular expressions to identify the numerical part of a
supplied string. By default, if no regular expression is supplied by the
caller, bu_vls_incr will use a numerical sequence at the end of the string
(more precisely, it will use the last sequence of numbers if and only if
there are no non-numerical characters between that sequence and the end of
the string.) If no appropriate match is found, the incrementer will be
appended to the end of the string.
When no pre-existing number is found to start the sequence, the default behavior
is to treat the existing string as the "0"-th item in the sequence. In such cases
bu_vls_incr will thus return one, not zero, as the first incremented name in the
sequence.
If the caller wishes to be more sophisticated about where incrementers are
found in strings, they may supply their own regular expression that uses
parenthesis bounded matchers to identify numerical identifiers. For example,
the regular expression:
@verbatim
([-_:]*[0-9]+[-_:]*)[^0-9]*$
@endverbatim
will instruct bu_vls_incr to define not just the last number but the last
number and any immediately surrounding separator characters as the subset of
the string to process. Combined with a custom incrementation specifier,
this option allows calling programs to exercise broad flexibility in how
they process strings.
\section bu_vls_incr_inc Specifying Incrementor Behavior
The caller may optionally specify incrementation behavior with an incrementer
specification string, which has the following form: "minwidth:init:max:step[:left_sepchar:right_sepchar]"
The table below explains the individual elements.
<table>
<tr><th colspan="2">"minwidth:init:max:step[:left_sepchar:right_sepchar]"</th></tr>
<tr><td>minwidth</td> <td>specifies the minimum number of digits used when printing the incrementer substring</td>
<tr><td>init</td> <td>specifies the initial minimum value to use when returning an incremented string. Overrides the string-based value if that value is less than the init value.</td>
<tr><td>max</td> <td>specifies the maximum value of the incrementer - if the step takes the value past this number, the counter "rolls over" to the init value.</td>
<tr><td>step</td> <td>value by which the incrementor value is increased</td>
<tr><td>left_sepchar</td> <td>optional - specify a character to insert to the left of the numerical substring</td>
<tr><td>right_sepchar</td><td>optional - specify a character to insert to the right of the numerical substring</td>
</table>
In the case of minwidth, init, max, and step a '0' always indicates
unspecified (i.e. "default") behavior. So, an incrementer specified as
0:0:0:0 would behave as follows:
minwidth: width found in string, or standard printf handling if nothing useful is found. For example, engine_part-001.s would by default be incremented to engine_part-002.s, preserving the prefix zeros.
init: from initial name string, or 0 if not found
max: LONG_MAX
step: 1
The last two separator chars are optional - they are useful if the caller
wants to guarantee a separation between the active incremented substring and
its surroundings. For example, the following would prefix the incrementer
output with an underscore and add a suffix with a dash:
@verbatim
0:0:0:0:_:-
@endverbatim
\section bu_vls_incr_ex Examples
So, we return to our engine_part.s example cases. To generate the initial pattern:
@verbatim
engine_part.s-1, engine_part.s-2, engine_part.s-3, ...
@endverbatim
the code is actually quite simple:
@code
int i = 0;
const char *estr = "engine_part.s"
struct bu_vls name = BU_VLS_INIT_ZERO;
bu_vls_sprintf(&name, "%s", estr);
while (i < 10) {
(void)bu_vls_incr(&name, NULL, "0:0:0:0:-", NULL, NULL);
bu_log("%s\n", bu_vls_addr(&name));
}
bu_vls_free(&name);
@endcode
The second case gets a bit more interesting, since there is no number
present in the original string, we want the number *before* the .s suffix,
we're incrementing by more than 1, we want four numerical digits in the
string, and we want an underscore prefix spacer before the number:
@verbatim
engine_part_0010.s, engine_part_0020.s, engine_part_0030.s, ...
@endverbatim
To set this up correctly we take advantage of the bu_path_component function
and construct an initial "seed" string with a zero incrementer where we
need it:
@code
int i = 0;
const char *estr = "engine_part.s"
struct bu_vls name = BU_VLS_INIT_ZERO;
bu_vls_sprintf(&name, "%s0.%s", bu_path_component(estr,BU_PATH_EXTLESS),bu_path_component(estr,BU_PATH_EXT));
while (i < 10) {
(void)bu_vls_incr(&name, NULL, "4:10:0:10:_", NULL, NULL);
bu_log("%s\n", bu_vls_addr(&name));
}
bu_vls_free(&name);
@endcode
*/
BU_EXPORT extern int bu_vls_incr(struct bu_vls *name, const char *regex_str, const char *incr_spec, bu_vls_uniq_t uniq_test, void *data);
__END_DECLS
/** @} */
+3 -1
View File
@@ -42,8 +42,10 @@
#if defined(BRLCADBUILD) && defined(HAVE_CONFIG_H)
# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# include "config_win.h"
# include "brlcad_config.h"
# /* Put this after brlcad_config.h, since some of the tests
in here require defines from brlcad_config.h */
# include "config_win.h"
# else
# include "brlcad_config.h"
# endif /* _WIN32 */
+1 -1
View File
@@ -1 +1 @@
26
27
+1 -1
View File
@@ -1 +1 @@
1
0
+13 -1
View File
@@ -136,9 +136,21 @@ struct gcv_filter {
/* operation type */
const enum gcv_filter_type filter_type;
/* MIME_MODEL_UNKNOWN if 'filter_type' is GCV_FILTER_FILTER */
/* If we have a definite type this converter is known to handle, call
* it out here.
* MIME_MODEL_UNKNOWN if 'filter_type' is GCV_FILTER_FILTER or
* if the plugin is a multi-format I/O plugin */
const bu_mime_model_t mime_type;
/* For plugins supporting multiple file types, call this to
* process them.
*
* Return 1 if the input data can be processed by this filter.
* (for example: is the file readable by this plugin? Return
* 1 if yes, 0 if no. Later we should incorporate some notion
* of quality of support into this return value...) */
int (* const data_supported)(const char *data);
/**
* PRIVATE
*
+5
View File
@@ -480,6 +480,11 @@ GED_EXPORT extern int ged_cpi(struct ged *gedp, int argc, const char *argv[]);
*/
GED_EXPORT extern int ged_delete_pipept(struct ged *gedp, int argc, const char *argv[]);
/**
* DSP utility command
*/
GED_EXPORT extern int ged_dsp(struct ged *gedp, int argc, const char *argv[]);
/**
* Arb specific edits.
*/
-15
View File
@@ -39,21 +39,6 @@ __BEGIN_DECLS
#include "optical/shadework.h"
#include "optical/shadefuncs.h"
/* for libmultispectral */
/* FIXME: these should not need to be declared for libmultispectral.
* breaks encapsulation/modularity of shaders if we have to list them
* in more than one place. maybe give multispectral arrays their own
* suffix so as not to conflict.
*/
OPTICAL_EXPORT extern struct mfuncs camo_mfuncs[];
OPTICAL_EXPORT extern struct mfuncs light_mfuncs[];
OPTICAL_EXPORT extern struct mfuncs stk_mfuncs[];
OPTICAL_EXPORT extern struct mfuncs phg_mfuncs[];
OPTICAL_EXPORT extern struct mfuncs noise_mfuncs[];
OPTICAL_EXPORT extern struct bn_table *spectrum;
/**
* this function sets the provided mfuncs head pointer to the list of
* available shaders. the provided mfuncs head pointer should point
-4
View File
@@ -52,11 +52,7 @@ __BEGIN_DECLS
/* for liboptical */
OPTICAL_EXPORT extern double AmbientIntensity;
#ifdef RT_MULTISPECTRAL
OPTICAL_EXPORT extern struct bn_tabdata *background;
#else
OPTICAL_EXPORT extern vect_t background;
#endif
/* defined in sh_text.c */
OPTICAL_EXPORT extern struct region env_region; /* environment map region */
-4
View File
@@ -61,11 +61,7 @@ struct light_specific {
int lt_exaim; /**< @brief !0 if explicit aim in lt_target */
fastf_t lt_obscure; /**< @brief percentage obscuration of light */
/* Internal fields */
#ifdef RT_MULTISPECTRAL
struct bn_tabdata *lt_spectrum; /**< @brief Units? mw*sr ? */
#else
vect_t lt_color; /**< @brief RGB, as 0..1 */
#endif
fastf_t lt_radius; /**< @brief approximate radius of spherical light */
fastf_t lt_cosangle; /**< @brief cos of lt_angle */
vect_t lt_pos; /**< @brief location in space of light */
-9
View File
@@ -43,20 +43,11 @@ struct shadework {
fastf_t sw_extinction; /**< @brief extinction coeff, mm^-1 */
fastf_t sw_refrac_index;
fastf_t sw_temperature;
#ifdef RT_MULTISPECTRAL
struct bn_tabdata *msw_color;
struct bn_tabdata *msw_basecolor;
#else
fastf_t sw_color[3]; /**< @brief shaded color */
fastf_t sw_basecolor[3]; /**< @brief base color */
#endif
struct hit sw_hit; /**< @brief ray hit (dist, point, normal) */
struct uvcoord sw_uv;
#ifdef RT_MULTISPECTRAL
struct bn_tabdata * msw_intensity[SW_NLIGHTS];
#else
fastf_t sw_intensity[3*SW_NLIGHTS]; /**< @brief light intensities */
#endif
fastf_t sw_tolight[3*SW_NLIGHTS]; /**< @brief light directions */
struct light_specific *sw_visible[SW_NLIGHTS]; /**< @brief visibility flags/ptrs */
fastf_t sw_lightfract[SW_NLIGHTS];/**< @brief % light visible */
+1
View File
@@ -154,6 +154,7 @@ __BEGIN_DECLS
#include "./rt/primitives/ell.h"
#include "./rt/primitives/tgc.h"
#include "./rt/primitives/sketch.h"
#include "./rt/primitives/annot.h"
#include "./rt/primitives/bot.h"
#include "./rt/primitives/brep.h"
#include "./rt/primitives/tor.h"
+15
View File
@@ -271,6 +271,7 @@ struct ars_rec {
char a_id; /* ID_ARS_A */
char a_type; /* primitive type */
char a_name[NAMESIZE]; /* unique name */
/* these cannot be size_t due to v4 compatibility */
short a_m; /* # of curves */
short a_n; /* # of points per curve */
short a_curlen; /* # of granules per curve */
@@ -373,6 +374,16 @@ struct sketch_rec {
unsigned char skt_count[4]; /* number of additional granules */
}; /* struct sketch_rec */
struct annot_rec {
char ant_id; /*DBID_ANNOT */
char ant_pad;
char ant_name[NAMESIZE];
unsigned char ant_V[8*3]; /* orgin map */
unsigned char ant_vert_count[4]; /* number of vertices in annotation */
unsigned char ant_seg_count[4]; /* number of segments in annotation */
unsigned char ant_count[4]; /* number of additional granules */
}; /* struct annot_rec */
struct cline_rec {
char cli_id; /* DBID_CLINE */
char cli_pad;
@@ -422,6 +433,7 @@ union record {
#define DBID_PARTICLE 'p' /* a particle (lozenge) */
#define DBID_NMG 'N' /* NMG solid */
#define DBID_SKETCH 'd' /* 2D sketch */
#define DBID_ANNOT 'a' /* 2D annotations */
#define DBID_EXTR 'e' /* solid of extrusion */
#define DBID_CLINE 'c' /* FASTGEN4 CLINE solid */
#define DBID_BOT 't' /* Bag o' triangles */
@@ -463,6 +475,9 @@ union record {
/* sketch */
struct sketch_rec skt;
/* annotation */
struct annot_rec ant;
/* FASTGEN4 CLINE element */
struct cline_rec cli;
+1 -1
View File
@@ -169,7 +169,7 @@ struct db5_ondisk_header {
#define DB5_MINORTYPE_BRLCAD_REVOLVE 40
#define DB5_MINORTYPE_BRLCAD_PNTS 41
#define DB5_MINORTYPE_BRLCAD_ANNOTATION 42
#define DB5_MINORTYPE_BRLCAD_ANNOT 42
#define DB5_MINORTYPE_BRLCAD_HRT 43
#define DB5_MINORTYPE_BRLCAD_DATUM 44
+35 -4
View File
@@ -636,10 +636,6 @@ RT_EXPORT extern int db_version(struct db_i *dbip);
RT_EXPORT extern int rt_db_flip_endian(struct db_i *dbip);
/* extrude.c */
RT_EXPORT extern int rt_extrude_import5(struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip, struct resource *resp);
/**
* "open" an in-memory-only database instance. this initializes a
* dbip for use, creating an inmem dbi_wdbp as the means to add
@@ -647,6 +643,7 @@ RT_EXPORT extern int rt_extrude_import5(struct rt_db_internal *ip, const struct
*/
RT_EXPORT extern struct db_i * db_open_inmem(void);
/**
* creates an in-memory-only database. this is very similar to
* db_open_inmem() with the exception that the this routine adds a
@@ -733,6 +730,40 @@ RT_EXPORT extern struct directory *db_lookup(const struct db_i *,
const char *name,
int noisy);
/**
* @brief
* Unique, legal database object name generation.
*
* When automatically creating names for objects in a database, the most common
* constraints are:
*
* 1) the name must not use any characters that are invalid or problematic for
* database processing
*
* 2) the name must not collide with any existing object in the database
*
* 3) in the event of a collision, return instead the "next" name in some
* logical sequence given a pre-existing name as input.
*
* The responsibility for actual name incrementing lies with the libbu
* bu_vls_incr function - see documentation for bu_vls_incr to understand the
* format of the incr_spec argument.
*
* Note: db_get_name does not "reserve" a name in the database once it is
* generated. If the caller's intent is to pre-generate a series of names,
* they need to set the force_incr parameter to 1. Otherwise, the decision for
* whether to increment the string will be based on whether the "cleaned up"
* version of the supplied string conflicts with an existing object name.
* Remember that names generated with force_incr set will still be checked
* against the database for potential conflicts.
*
* Note that an empty vls string supplied to name will not generate any new
* strings - there will be no content on which the routine can act, and an
* error will be returned.
*/
RT_EXPORT extern int db_get_name(struct bu_vls *name, struct db_i *dbip, int force_incr, const char *regex_str, const char *incr_spec);
/* add entry to directory */
/**
+1 -1
View File
@@ -125,7 +125,7 @@
#define ID_HYP 38 /**< @brief Hyperboloid of one sheet */
#define ID_REVOLVE 40 /**< @brief Solid of Revolution */
#define ID_PNTS 41 /**< @brief Collection of Points */
#define ID_ANNOTATION 42 /**< @brief Annotation */
#define ID_ANNOT 42 /**< @brief Annotation */
#define ID_HRT 43 /**< @brief Heart */
#define ID_DATUM 44 /**< @brief Datum references */
+46 -21
View File
@@ -25,7 +25,7 @@
* These structures are what the struct rt_db_internal generic pointer
* idb_ptr points at, based on idb_type indicating a solid id ID_xxx,
* such as ID_TGC.
*
*
*/
/** @{ */
/** @file rt/geom.h */
@@ -281,9 +281,7 @@ struct rt_nurb_internal {
uint32_t magic;
int nsrf; /**< @brief number of surfaces */
struct face_g_snurb **srfs; /**< @brief The surfaces themselves */
#ifdef CONVERT_TO_BREP
ON_Brep *brep;
#endif
};
@@ -569,7 +567,7 @@ struct rt_dsp_internal{
mat_t dsp_mtos; /**< @brief model to solid space */
/* END OF USER SETTABLE VARIABLES, BEGIN INTERNAL STUFF */
mat_t dsp_stom; /**< @brief solid to model space
* computed from dsp_mtos */
* computed from dsp_mtos */
unsigned short *dsp_buf; /**< @brief actual data */
struct bu_mapped_file *dsp_mp; /**< @brief mapped file for data */
struct rt_db_internal *dsp_bip; /**< @brief db object for data */
@@ -601,7 +599,7 @@ struct rt_curve {
/**
* used by the sketch and solid of extrusion
* used by the sketch, solid of extrusion and the annotation primitive
*/
struct line_seg /**< @brief line segment */
{
@@ -923,33 +921,60 @@ struct rt_pnts_internal {
#define RT_PNTS_CK_MAGIC(_p) BU_CKMAG(_p, RT_PNTS_INTERNAL_MAGIC, "rt_pnts_internal")
/** @} */
/** @addtogroup rt_annotation */
/** @addtogroup rt_anno */
/** @{ */
/*
* ID_ANNOTATION
* ID_ANNO
*
* Annotations are used to provide labels in-scene when viewing geometry. Leaders connect labels
* Annotations are used to provide labels in-scene when viewing geometry. Leaders connect labels
* to geometry objects or fixed points in space.
*
* container for the annotation primitive
*/
struct rt_annotation_internal
{
uint32_t magic;
point_t V; /**< @brief vertex, start and end point of loop to be extruded */
vect_t h; /**< @brief extrusion vector, may not be in (u_vec X v_vec) plane */
vect_t u_vec; /**< @brief vector in U parameter direction */
vect_t v_vec; /**< @brief vector in V parameter direction */
int view_aligned;
struct bu_vls label; /**< @brief either user supplied labels, format strings, or empty */
struct rt_sketch_internal *skt; /**< @brief pointer to sketch holding label decoration (if any) - same plane as text plane */
struct rt_ant {
size_t count; /**< @brief number of segments in the annotation */
int *reverse; /**< array of boolean flags indicating if the
* segment should be reversed */
void **segments; /**< @brief array of annotation segment pointer */
};
/**
* Note that the u_vec and v_vec are not unit vectors, their magnitude
* and direction are used for scaling and rotation.
* used by the annotation primitive
*/
#define RT_ANNOTATION_CK_MAGIC(_p) BU_CKMAG(_p, RT_ANNOTATION_INTERNAL_MAGIC, "rt_annotation_internal")
struct txt_seg {
uint32_t magic;
int ref_pt; /** reference point */
int pt_rel_pos; /** flag describing the position relative to the ref_point */
struct bu_vls label;
};
struct rt_annot_internal
{
uint32_t magic;
point_t V; /**< @brief vertex, maps to the origin in the 2D system */
size_t vert_count; /**< @brief number of vertices */
point2d_t *verts; /**< @brief array of vertices that serve as control points */
struct rt_ant ant; /**< @brief segments in the annotation */
};
/**
* placement flags
*/
#define RT_ANNOT_POS_BL 1
#define RT_ANNOT_POS_BC 2
#define RT_ANNOT_POS_BR 3
#define RT_ANNOT_POS_ML 4
#define RT_ANNOT_POS_MC 5
#define RT_ANNOT_POS_MR 6
#define RT_ANNOT_POS_TL 7
#define RT_ANNOT_POS_TC 8
#define RT_ANNOT_POS_TR 9
#define RT_ANNOT_CK_MAGIC(_p) BU_CKMAG(_p, RT_ANNOT_INTERNAL_MAGIC, "rt_annot_internal")
/** @} */
/*
+6
View File
@@ -64,6 +64,12 @@ RT_EXPORT extern struct rt_g RTG;
#define RT_ADD_VLIST(hd, pnt, draw) BN_ADD_VLIST(&RTG.rtg_vlfree, hd, pnt, draw)
/** set the transformation matrix to display matrix */
#define RT_VLIST_SET_DISP_MAT(_dest_hd, _ref_pt) BN_VLIST_SET_DISP_MAT(&RTG.rtg_vlfree, _dest_hd, _ref_pt)
/** set the transformation matrix to model matrix */
#define RT_VLIST_SET_MODEL_MAT(_dest_hd) BN_VLIST_SET_MODEL_MAT(&RTG.rtg_vlfree, _dest_hd)
/** Set a point size to apply to the vlist elements that follow. */
#define RT_VLIST_SET_POINT_SIZE(hd, size) BN_VLIST_SET_POINT_SIZE(&RTG.rtg_vlfree, hd, size)
+1
View File
@@ -1,5 +1,6 @@
set(primitives_headers
arb8.h
annot.h
bot.h
brep.h
cline.h
+67
View File
@@ -0,0 +1,67 @@
/* A N N O T . H
* BRL-CAD
*
* Copyright (c) 2017 United States Government as represented by
* the U.S. Army Research Laboratory.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this file; see the file named COPYING for more
* information.
*/
/** @addtogroup rt_annot */
/** @{ */
/** @file rt/primitives/annot.h */
#ifndef RT_PRIMITIVES_ANNOT_H
#define RT_PRIMITIVES_ANNOT_H
#include "common.h"
#include "vmath.h"
#include "bu/list.h"
#include "bu/vls.h"
#include "bn/tol.h"
#include "rt/defines.h"
__BEGIN_DECLS
RT_EXPORT int rt_pos_flag(int *pos_flag, int p_hor, int p_ver);
RT_EXPORT int rt_check_pos(const struct txt_seg *tsg, char **rel_pos);
RT_EXPORT extern int rt_check_ant(const struct rt_ant *ant,
const struct rt_annot_internal *annot_ip,
int noisy);
RT_EXPORT extern void rt_copy_ant(struct rt_ant *ant_out,
const struct rt_ant *ant_in);
RT_EXPORT extern void rt_ant_free(struct rt_ant *ant);
RT_EXPORT extern struct rt_annot_internal *rt_copy_annot(const struct rt_annot_internal *annot_ip);
RT_EXPORT extern int ant_to_tcl_list(struct bu_vls *vls,
struct rt_ant *ant);
__END_DECLS
/** @} */
#endif /* RT_PRIMITIVES_ANNOT_H */
/*
* Local Variables:
* tab-width: 8
* mode: C
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+34
View File
@@ -65,6 +65,40 @@ struct region {
#define REGION_NULL ((struct region *)0)
#define RT_CK_REGION(_p) BU_CKMAG(_p, RT_REGION_MAGIC, "struct region")
#ifdef USE_OPENCL
struct cl_bool_region {
cl_uint btree_offset; /**< @brief index to the start of the bit tree */
cl_int reg_aircode; /**< @brief Region ID AIR code */
cl_int reg_bit; /**< @brief constant index into Regions[] */
cl_short reg_all_unions; /**< @brief 1=boolean tree is all unions */
};
/*
* Values for Shader Function ID.
*/
#define SH_NONE 0
#define SH_PHONG 1
struct cl_phong_specific {
cl_double wgt_specular;
cl_double wgt_diffuse;
cl_int shine;
};
/**
* The region structure.
*/
struct cl_region {
cl_float color[3]; /**< @brief explicit color: 0..1 */
cl_int mf_id;
union {
struct cl_phong_specific phg_spec;
}udata;
};
#endif
/* Print a region */
RT_EXPORT extern void rt_pr_region(const struct region *rp);
+6
View File
@@ -359,6 +359,12 @@ clt_db_store(size_t count, struct soltab *solids[]);
RT_EXPORT extern void
clt_db_store_bvh(size_t count, struct clt_linear_bvh_node *nodes);
RT_EXPORT extern void
clt_db_store_regions(size_t sz_btree_array, struct bit_tree *btp, size_t nregions, struct cl_bool_region *regions, struct cl_region *mtls);
RT_EXPORT extern void
clt_db_store_regions_table(cl_uint *regions_table, size_t regions_table_size);
RT_EXPORT extern void clt_db_release(void);
+13 -1
View File
@@ -176,12 +176,24 @@ struct cl_seg {
cl_uint seg_sti;
};
struct cl_partition {
struct cl_hit inhit;
struct cl_hit outhit;
cl_uint inseg;
cl_uint outseg;
cl_uint forw_pp; /* index to the next partition */
cl_uint back_pp; /* index to the previous partition */
cl_uint region_id; /* id of the "owning" region */
cl_char inflip; /* flip inhit->hit_normal */
cl_char outflip; /* flip outhit->hit_normal */
};
RT_EXPORT extern void
clt_frame(void *pixels, uint8_t o[3], int cur_pixel, int last_pixel,
int width, int ibackground[3], int inonbackground[3],
double airdensity, double haze[3], fastf_t gamma,
mat_t view2model, fastf_t cell_width, fastf_t cell_height,
fastf_t aspect, int lightmodel);
fastf_t aspect, int lightmodel, int a_no_booleans);
#endif
+43
View File
@@ -254,6 +254,49 @@ struct rt_tree_array
#define TREE_LIST_NULL ((struct tree_list *)0)
#ifdef USE_OPENCL
/**
* Flattened version of the infix union tree.
*/
#define UOP_UNION 1 /**< @brief Binary: L union R */
#define UOP_INTERSECT 2 /**< @brief Binary: L intersect R */
#define UOP_SUBTRACT 3 /**< @brief Binary: L subtract R */
#define UOP_XOR 4 /**< @brief Binary: L xor R, not both*/
#define UOP_NOT 5 /**< @brief Unary: not L */
#define UOP_GUARD 6 /**< @brief Unary: not L, or else! */
#define UOP_XNOP 7 /**< @brief Unary: L, mark region */
#define UOP_SOLID 0 /**< @brief Leaf: tr_stp -> solid */
/**
* bit expr tree representation
*
* node:
* uint uop : 3
* uint right_child : 29
*
* leaf:
* uint uop : 3
* uint st_bit : 29
*/
struct bit_tree {
uint val;
};
struct cl_tree_bit {
cl_uint val;
};
/* Print a bit expr tree */
RT_EXPORT extern void rt_pr_bit_tree(const struct bit_tree *btp,
int idx,
int lvl);
RT_EXPORT extern void rt_bit_tree(struct bit_tree *btp,
const union tree *tp,
size_t *len);
#endif
/* Print an expr tree */
RT_EXPORT extern void rt_pr_tree(const union tree *tp,
int lvl);
-133
View File
@@ -1,133 +0,0 @@
/* S P E C T R U M . H
* BRL-CAD
*
* Copyright (c) 2004-2016 United States Government as represented by
* the U.S. Army Research Laboratory.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this file; see the file named COPYING for more
* information.
*/
/** @addtogroup libmultispectral
*
* @brief
* libmultispectral is mostly a result of applying different compilation flags
* to liboptical.
*
* spectrum.h contains data structures to assist with recording spectral data.
* The overall notion is that each spectral sample should be as compact as
* possible (typically just an array of power levels), with all the context
* stored in one place.
*
* The context is kept in an 'bn_table' structure, and
* the data for one particular sample are kept in an 'bn_tabdata'
* structure.
* tabdata.h provides the data structures,
* librt/tabdata.c provides the routines.
*
* The contents of the spectral sample in val[j] are interpreted
* in the interval (wavel[j]..wavel[j+1]).
* This value could be power, albedo, absorption, refractive index,
* or any other wavelength-specific parameter.
*
* For example, if the val[] array contains power values, then
* val[j] contains the integral of the power from wavel[j] to wavel[j+1]
*
* As an example, assume nwave=2, wavel[0]=500, wavel[1]=600, wavel[2]=700.
* Then val[0] would contain data for the 500 to 600nm interval,
* and val[1] would contain data for the 600 to 700nm interval.
* There would be no storage allocated for val[2] -- don't use it!
* There are several interpretations of this:
* 1) val[j] stores the total (integral, area) value for the interval, or
* 2) val[j] stores the average value across the interval.
*
* The intervals need not be uniformly spaced; it is acceptable to
* increase wavelength sampling density around "important" frequencies.
* This will undoubtedly complicate certain functions.
*
* By convention, wavelength is stored in nanometers as an integer,
* and power is stored in Watts.
*
* Wavelength Units -
* cm = 10** -2 m centimeters
* mm = 10** -3 m millimeters
* um = 10** -6 m micrometers, or microns
* nm = 10** -9 m nanometers
*
* The Spectrum in nm -
* < 10 nm X-Rays
* 10 to 390 Ultraviolet
* 390 to 770 Visible
* 770 to 1500 Near IR
* 1500 to 6, 000 Middle IR (includes 3-5 um band)
* 6, 000 to 40, 000 Far IR (includes 8-12 um band)
* 40, 000 to 1, 000, 000 Extreme IR
* > 10**6 nm Microwaves (300 GHz to 300 MHz)
* > 10**9 nm Radio waves (300 MHz and down)
*
* It is tempting to store the wavelength in nanometers as an integer,
* but that might preclude very narrow-band calculations, such as might
* be required to study a single spectral line,
* and it might also preclude future extensions to X-rays.
* Because there are likely to be very few bn_table structures
* in use, the extra storage isn't a likely problem.
* The worst effect of this decision will be floating-point grunge
* when printing wavelengths, e.g. 650nm might print as 649.99nm.
* On the other hand, non-integer values might make it difficult to
* determine if two wavelengths from different curves were the "same",
* without introducing a wavelength "tolerance" notion. Ugh.
*
*/
/** @{ */
/** @file spectrum.h */
#ifndef SPECTRUM_H
#define SPECTRUM_H
#include "common.h"
#include "bn.h"
#include "raytrace.h"
__BEGIN_DECLS
/*
* Routines
*/
RT_EXPORT extern void rt_spect_make_CIE_XYZ(struct bn_tabdata **x,
struct bn_tabdata **y,
struct bn_tabdata **z,
const struct bn_table *tabp);
RT_EXPORT extern void rt_spect_black_body(struct bn_tabdata *data,
double temp,
unsigned int n);
RT_EXPORT extern void rt_spect_black_body_fast(struct bn_tabdata *data,
double temp);
RT_EXPORT extern void rt_spect_reflectance_rgb(struct bn_tabdata *curve,
const float rgb[3]);
__END_DECLS
#endif /* SPECTRUM_H */
/** @} */
/*
* Local Variables:
* mode: C
* tab-width: 8
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+425 -321
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -505,6 +505,14 @@ WDB_EXPORT int mk_sketch(
const char *name,
const struct rt_sketch_internal *skt );
/**
* Make a annotation
*/
WDB_EXPORT int mk_annot(
struct rt_wdb *fp,
const char *name,
const struct rt_annot_internal *ann );
/**
* Make an extrusion solid
*/
-167
View File
@@ -1,167 +0,0 @@
# B R L C A D _ C M A K E F I L E S . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2016 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.
#
# Define a macro for building lists of files. Distcheck needs to know
# what files are "supposed" to be present in order to make sure the
# source tree is clean prior to building a distribution tarball, hence
# this macro stores its results in files and not variables It's a
# no-op in a SUBBUILD.
#
# For this macro to work correctly, it is important that any target
# definitions or explicit calls to this macro supply relative paths for
# files present in the source tree. Generated files fed into
# compilation targets are not one of the things that should be in lists
# generated by this macro, and the only way to reliably recognize them
# is to reject files specified using their full path. Such files must
# use their full path in the build logic in order for out-of-src-dir
# builds to function, so as long as no full paths are used for files
# actually IN the source tree this method is reliable. The macro will
# try to catch improperly specified files, but if the build directory
# and the source directory are one and the same this will not be
# possible.
define_property(GLOBAL PROPERTY CMAKE_IGNORE_FILES BRIEF_DOCS "distcheck ignore files" FULL_DOCS "List of files known to CMake")
define_property(GLOBAL PROPERTY CMAKE_IGNORE_DIRS BRIEF_DOCS "distcheck ignore dirs" FULL_DOCS "List of directories marked as fully known to CMake")
macro(CMAKEFILES)
if(NOT BRLCAD_IS_SUBBUILD)
foreach(ITEM ${ARGN})
set(CMAKEFILES_DO_TEST 1)
# The build targets will use certain keywords for arguments -
# before we proceed to do any ignoring based on those names,
# make sure the file is there. Normally attempting to ignore
# a non-existent file is a fatal error, but these keywords
# don't necessarily refer to files.
set(TARGET_FLAGS SHARED STATIC OBJECT WIN32 UNKNOWN IMPORTED MODULE INTERFACE)
foreach(TARGET_FLAG ${TARGET_FLAGS})
if("${TARGET_FLAG}" STREQUAL "${ITEM}")
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
set(CMAKEFILES_DO_TEST 0)
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
endif("${TARGET_FLAG}" STREQUAL "${ITEM}")
endforeach(TARGET_FLAG ${TARGET_FLAGS})
set(FUZZY_TARGET_FLAGS TARGET_OBJECTS)
foreach(TARGET_FLAG ${FUZZY_TARGET_FLAGS})
if("${ITEM}" MATCHES "${TARGET_FLAG}")
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
set(CMAKEFILES_DO_TEST 0)
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
endif("${ITEM}" MATCHES "${TARGET_FLAG}")
endforeach(TARGET_FLAG ${FUZZY_TARGET_FLAGS})
# Handled target flags, proceeding with tests.
if(CMAKEFILES_DO_TEST)
get_filename_component(ITEM_PATH "${ITEM}" PATH)
get_filename_component(ITEM_NAME "${ITEM}" NAME)
if(NOT "${ITEM_PATH}" STREQUAL "")
# If the build directory is not the same as the source
# directory, we can enforce the convention that only
# generated files be specified with their full name.
# If this becomes a problem with the third party build
# systems at some point in the future, we may have to
# exclude src/other paths from this check.
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
IS_SUBPATH("${CMAKE_BINARY_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
if("${SUBPATH_TEST}" STREQUAL "0")
IS_SUBPATH("${CMAKE_SOURCE_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
if("${SUBPATH_TEST}" STREQUAL "1")
message(FATAL_ERROR "${ITEM} is listed in \"${CMAKE_CURRENT_SOURCE_DIR}\" using its absolute path. Please specify the location of this file using a relative path.")
endif("${SUBPATH_TEST}" STREQUAL "1")
endif("${SUBPATH_TEST}" STREQUAL "0")
endif(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# Ignore files specified using full paths, since they
# should be generated files and are not part of the
# source code repository.
get_filename_component(ITEM_ABS_PATH "${ITEM_PATH}" ABSOLUTE)
if(NOT "${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
message(FATAL_ERROR "Attempting to ignore non-existent file ${ITEM}, in directory \"${CMAKE_CURRENT_SOURCE_DIR}\"")
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
# Append files and directories to their respective lists.
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_DIRS "${ITEM_ABS_PATH}/${ITEM_NAME}")
else(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${ITEM_ABS_PATH}/${ITEM_NAME}")
endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${ITEM_ABS_PATH}")
# Add the parent directories of the specified file or directory as well -
# the convention is that once at least one file or directory in a path is recorded
# by the build logic, the parent directories along that path have also been recorded.
while(NOT "${ITEM_PATH}" STREQUAL "")
get_filename_component(ITEM_NAME "${ITEM_PATH}" NAME)
get_filename_component(ITEM_PATH "${ITEM_PATH}" PATH)
if(NOT "${ITEM_PATH}" STREQUAL "")
get_filename_component(ITEM_ABS_PATH "${ITEM_PATH}" ABSOLUTE)
if(NOT "${ITEM_NAME}" STREQUAL "..")
set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${ITEM_ABS_PATH}")
endif(NOT "${ITEM_NAME}" STREQUAL "..")
endif(NOT "${ITEM_PATH}" STREQUAL "")
endwhile(NOT "${ITEM_PATH}" STREQUAL "")
endif(NOT "${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
else(NOT "${ITEM_PATH}" STREQUAL "")
# The easy case - no path specified, so assume the current source directory.
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
message(FATAL_ERROR "Attempting to ignore non-existent file ${ITEM}, in directory \"${CMAKE_CURRENT_SOURCE_DIR}\"")
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM_NAME}")
else(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM_NAME}")
endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
endif(NOT "${ITEM_PATH}" STREQUAL "")
endif(CMAKEFILES_DO_TEST)
endforeach(ITEM ${ARGN})
endif(NOT BRLCAD_IS_SUBBUILD)
endmacro(CMAKEFILES FILESLIST)
# Routine to tell distcheck to ignore a series of items in a directory. Items may themselves
# be directories. Primarily useful when working with src/other dist lists.
macro(CMAKEFILES_IN_DIR filestoignore targetdir)
if(NOT BRLCAD_IS_SUBBUILD)
set(CMAKE_IGNORE_LIST "")
foreach(filepath ${${filestoignore}})
set(CMAKE_IGNORE_LIST ${CMAKE_IGNORE_LIST} "${targetdir}/${filepath}")
endforeach(filepath ${filestoignore})
CMAKEFILES(${CMAKE_IGNORE_LIST})
endif(NOT BRLCAD_IS_SUBBUILD)
endmacro(CMAKEFILES_IN_DIR)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+67 -24
View File
@@ -274,19 +274,12 @@ macro(BRLCAD_CHECK_LIBRARY targetname lname func)
endmacro(BRLCAD_CHECK_LIBRARY lname func)
# Special purpose macros
# Load local variation on CHECK_C_SOURCE_RUNS that will accept a
# C file as well as the actual C code - some tests are easier to
# define in separate files. This feature has been submitted back
# to the CMake project, but as of CMake 2.8.7 is not part of the
# default CHECK_C_SOURCE_RUNS functionality.
include(CheckCSourceRuns)
# Special purpose functions
###
# Undocumented.
###
macro(BRLCAD_CHECK_BASENAME)
function(BRLCAD_CHECK_BASENAME)
set(CMAKE_C_FLAGS_TMP "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "")
set(BASENAME_SRC "
@@ -302,12 +295,12 @@ return 0;
CONFIG_H_APPEND(BRLCAD "#define HAVE_BASENAME 1\n")
endif(HAVE_BASENAME)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_TMP}")
endmacro(BRLCAD_CHECK_BASENAME var)
endfunction(BRLCAD_CHECK_BASENAME var)
###
# Undocumented.
###
macro(BRLCAD_CHECK_DIRNAME)
function(BRLCAD_CHECK_DIRNAME)
set(CMAKE_C_FLAGS_TMP "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "")
set(DIRNAME_SRC "
@@ -323,33 +316,84 @@ return 0;
CONFIG_H_APPEND(BRLCAD "#define HAVE_DIRNAME 1\n")
endif(HAVE_DIRNAME)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_TMP}")
endmacro(BRLCAD_CHECK_DIRNAME var)
endfunction(BRLCAD_CHECK_DIRNAME var)
###
# Undocumented.
# Based on AC_HEADER_SYS_WAIT
###
macro(BRLCAD_HEADER_SYS_WAIT)
function(BRLCAD_HEADER_SYS_WAIT)
set(CMAKE_C_FLAGS_TMP "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "")
set(SYS_WAIT_SRC "
#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif
int main() {
int s;
wait(&s);
s = WIFEXITED(s) ? WEXITSTATUS(s) : 1;
return 0;
}")
if(NOT DEFINED WORKING_SYS_WAIT)
CHECK_C_SOURCE_RUNS("${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/sys_wait_test.c" WORKING_SYS_WAIT)
CHECK_C_SOURCE_RUNS("${SYS_WAIT_SRC}" WORKING_SYS_WAIT)
endif(NOT DEFINED WORKING_SYS_WAIT)
if(WORKING_SYS_WAIT)
CONFIG_H_APPEND(BRLCAD "#define HAVE_SYS_WAIT_H 1\n")
endif(WORKING_SYS_WAIT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_TMP}")
endmacro(BRLCAD_HEADER_SYS_WAIT)
endfunction(BRLCAD_HEADER_SYS_WAIT)
###
# Undocumented.
# Based on AC_FUNC_ALLOCA
###
macro(BRLCAD_ALLOCA)
function(BRLCAD_ALLOCA)
set(CMAKE_C_FLAGS_TMP "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "")
set(ALLOCA_HEADER_SRC "
#include <alloca.h>
int main() {
char *p = (char *) alloca (2 * sizeof (int));
if (p) return 0;
;
return 0;
}")
set(ALLOCA_TEST_SRC "
#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# ifdef _MSC_VER
# include <malloc.h>
# define alloca _alloca
# else
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
# endif
#endif
int main() {
char *p = (char *) alloca (1);
if (p) return 0;
;
return 0;
}")
if(WORKING_ALLOC_H STREQUAL "")
CHECK_C_SOURCE_RUNS("${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/alloca_header_test.c" WORKING_ALLOCA_H)
CHECK_C_SOURCE_RUNS("${ALLOCA_HEADER_SRC}" WORKING_ALLOCA_H)
set(WORKING_ALLOCA_H ${WORKING_ALLOCA_H} CACHE INTERNAL "alloca_h test")
endif(WORKING_ALLOC_H STREQUAL "")
if(WORKING_ALLOCA_H)
@@ -357,20 +401,19 @@ macro(BRLCAD_ALLOCA)
set(FILE_RUN_DEFINITIONS "-DHAVE_ALLOCA_H")
endif(WORKING_ALLOCA_H)
if(NOT DEFINED WORKING_ALLOCA)
CHECK_C_SOURCE_RUNS("${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/alloca_test.c" WORKING_ALLOCA)
CHECK_C_SOURCE_RUNS("${ALLOCA_TEST_SRC}" WORKING_ALLOCA)
endif(NOT DEFINED WORKING_ALLOCA)
if(WORKING_ALLOCA)
CONFIG_H_APPEND(BRLCAD "#define HAVE_ALLOCA 1\n")
endif(WORKING_ALLOCA)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_TMP}")
endmacro(BRLCAD_ALLOCA)
endfunction(BRLCAD_ALLOCA)
###
# See if the compiler supports the C99 %z print specifier for size_t.
# Sets -DHAVE_STDINT_H=1 as global preprocessor flag if found.
###
macro(BRLCAD_CHECK_C99_FORMAT_SPECIFIERS)
function(BRLCAD_CHECK_C99_FORMAT_SPECIFIERS)
set(CMAKE_C_FLAGS_TMP "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "")
set(CMAKE_REQUIRED_DEFINITIONS_BAK ${CMAKE_REQUIRED_DEFINITIONS})
@@ -402,10 +445,10 @@ int main(int ac, char *av[])
endif(HAVE_C99_FORMAT_SPECIFIERS)
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS_BAK})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_TMP}")
endmacro(BRLCAD_CHECK_C99_FORMAT_SPECIFIERS)
endfunction(BRLCAD_CHECK_C99_FORMAT_SPECIFIERS)
macro(BRLCAD_CHECK_STATIC_ARRAYS)
function(BRLCAD_CHECK_STATIC_ARRAYS)
set(CHECK_STATIC_ARRAYS_SRC "
#include <stdio.h>
#include <string.h>
@@ -430,7 +473,7 @@ int main(int ac, char *av[])
if(HAVE_STATIC_ARRAYS)
CONFIG_H_APPEND(BRLCAD "#define HAVE_STATIC_ARRAYS 1\n")
endif(HAVE_STATIC_ARRAYS)
endmacro(BRLCAD_CHECK_STATIC_ARRAYS)
endfunction(BRLCAD_CHECK_STATIC_ARRAYS)
# Local Variables:
# tab-width: 8
-258
View File
@@ -1,258 +0,0 @@
# B R L C A D _ C O M P I L E R F L A G S . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2016 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.
#
###
# -fast provokes a stack corruption in the shadow computations because
# of strict aliasing getting enabled. we _require_
# -fno-strict-aliasing until someone changes how lists are managed.
# -fast-math results in non-IEEE floating point math among a handful
# of other optimizations that cause substantial error in ray tracing
# and tessellation (and probably more).
CHECK_C_FLAG(O3 GROUPS OPTIMIZE_C_FLAGS)
CHECK_C_FLAG(fstrength-reduce GROUPS OPTIMIZE_C_FLAGS)
CHECK_C_FLAG(fexpensive-optimizations GROUPS OPTIMIZE_C_FLAGS)
CHECK_C_FLAG(finline-functions GROUPS OPTIMIZE_C_FLAGS)
CHECK_C_FLAG("finline-limit=10000 --param inline-unit-growth=300 --param large-function-growth=300" GROUPS OPTIMIZE_C_FLAGS)
CHECK_CXX_FLAG(O3 GROUPS OPTIMIZE_CXX_FLAGS)
CHECK_CXX_FLAG(fstrength-reduce GROUPS OPTIMIZE_CXX_FLAGS)
CHECK_CXX_FLAG(fexpensive-optimizations GROUPS OPTIMIZE_CXX_FLAGS)
CHECK_CXX_FLAG(finline-functions GROUPS OPTIMIZE_CXX_FLAGS)
CHECK_CXX_FLAG("finline-limit=10000 --param inline-unit-growth=300 --param large-function-growth=300" GROUPS OPTIMIZE_CXX_FLAGS)
if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON")
if(NOT BRLCAD_ENABLE_PROFILING AND NOT BRLCAD_FLAGS_DEBUG)
CHECK_C_FLAG(fomit-frame-pointer GROUPS OPTIMIZE_C_FLAGS)
CHECK_CXX_FLAG(fomit-frame-pointer GROUPS OPTIMIZE_CXX_FLAGS)
else(NOT BRLCAD_ENABLE_PROFILING AND NOT BRLCAD_FLAGS_DEBUG)
CHECK_C_FLAG(fno-omit-frame-pointer GROUPS OPTIMIZE_C_FLAGS)
CHECK_CXX_FLAG(fno-omit-frame-pointer GROUPS OPTIMIZE_CXX_FLAGS)
endif(NOT BRLCAD_ENABLE_PROFILING AND NOT BRLCAD_FLAGS_DEBUG)
endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON")
if(${BRLCAD_FLAGS_OPTIMIZATION} MATCHES "AUTO")
if(CMAKE_CONFIGURATION_TYPES)
set(opt_conf_list "Release")
else(CMAKE_CONFIGURATION_TYPES)
if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON")
set(opt_conf_list "ALL")
endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON")
endif(CMAKE_CONFIGURATION_TYPES)
else(${BRLCAD_FLAGS_OPTIMIZATION} MATCHES "AUTO")
if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON")
set(opt_conf_list "ALL")
endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON")
endif(${BRLCAD_FLAGS_OPTIMIZATION} MATCHES "AUTO")
if(opt_conf_list)
ADD_NEW_FLAG(C OPTIMIZE_C_FLAGS "${opt_conf_list}")
ADD_NEW_FLAG(CXX OPTIMIZE_CXX_FLAGS "${opt_conf_list}")
endif(opt_conf_list)
# enable stack protection for unoptimized debug builds. this is
# intended to help make it easier to identify problematic code but
# only when compiling unoptimized (because the extra barrier checks
# can affect the memory footprint and runtime performance.
if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG)
CHECK_C_FLAG(fstack-protector-all)
CHECK_CXX_FLAG(fstack-protector-all)
# checking both in case compiling c/c++ with different compilers
CHECK_C_FLAG(qstackprotect)
CHECK_CXX_FLAG(qstackprotect)
endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG)
# enable memory error detector AddressSanitizer (see
# https://code.google.com/p/address-sanitizer/ for more info.)
if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG AND BRLCAD_ADDRESS_SANITIZER)
CHECK_C_FLAG(fsanitize=address)
CHECK_C_FLAG(fno-omit-frame-pointer)
CHECK_CXX_FLAG(fsanitize=address)
CHECK_CXX_FLAG(fno-omit-frame-pointer)
endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG AND BRLCAD_ADDRESS_SANITIZER)
# enable data race detector ThreadSanitizer (see
# https://code.google.com/p/thread-sanitizer/ for more info.)
if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG AND BRLCAD_THREAD_SANITIZER)
CHECK_C_FLAG(fsanitize=thread)
CHECK_CXX_FLAG(fsanitize=thread)
endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG AND BRLCAD_THREAD_SANITIZER)
# verbose warning flags. we intentionally try to turn on as many as
# possible. adding more is encouraged (as long as all issues are
# fixed first).
if(BRLCAD_ENABLE_COMPILER_WARNINGS OR BRLCAD_ENABLE_STRICT)
# also of interest:
# -Wunreachable-code -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -ansi
# -Wformat=2 (after bu_fopen_uniq() is obsolete)
CHECK_C_FLAG(pedantic)
CHECK_CXX_FLAG(pedantic)
#Added to make llvm happy on FreeBSD, but a good idea anyway
CHECK_C_FLAG(pedantic-errors)
#CHECK_CXX_FLAG(pedantic-errors) #This line makes poissonrecon break, so disable for now
# this catches a lot, it's good
CHECK_C_FLAG(Wall)
CHECK_CXX_FLAG(Wall)
# this catches a lot more, also good
CHECK_C_FLAG(Wextra)
CHECK_CXX_FLAG(Wextra)
# make sure our preprocessor logic references defined symbol names
CHECK_C_FLAG(Wundef)
CHECK_CXX_FLAG(Wundef)
# this makes sure we don't try to compare floating point exactly
CHECK_C_FLAG(Wfloat-equal)
CHECK_CXX_FLAG(Wfloat-equal)
# make sure we're using unambiguous symbol names, no shadowing
CHECK_C_FLAG(Wshadow)
CHECK_CXX_FLAG(Wshadow)
# make sure we're not dangerously casting return types. C-only for
# gcc, but maybe not for clang or others.
CHECK_C_FLAG(Wbad-function-cast)
CHECK_CXX_FLAG(Wbad-function-cast)
# this makes sure we don't declare variables mid-scope, helps build on Windows
CHECK_C_FLAG(Wdeclaration-after-statement)
CHECK_CXX_FLAG(Wdeclaration-after-statement)
# C-only: this makes sure C sources will compile as C++ code
CHECK_C_FLAG(Wc++-compat)
# FIXME: this one is a lot of work, a work-in-progress, but good to have eventually
# this makes sure prototypes are properly declared, no k&r and no assuming () means (void)
# CHECK_C_FLAG(Wstrict-prototypes)
# FIXME: shouldn't be throwing away const, should be using it more. ton of work.
# this reports where we throw away const
# CHECK_C_FLAG(Wcast-qual)
# CHECK_CXX_FLAG(Wcast-qual)
# check for redundant declarations
# CHECK_C_FLAG(Wredundant-decls)
# CHECK_CXX_FLAG(Wredundant-decls)
# want C inline warnings, but not for c++. versions of g++ (circa
# 4.7) spew unquellable bogus warnings on default constructors that
# we don't have access to (e.g., in opennurbs and boost), so turn
# them off
CHECK_C_FLAG(Winline)
CHECK_CXX_FLAG(Wno-inline)
# this makes sure we don't warn about using long long. really, it's okay.
CHECK_C_FLAG(Wno-long-long)
CHECK_CXX_FLAG(Wno-long-long)
# this is for X11 headers, they use variadic macros
CHECK_C_FLAG(Wno-variadic-macros)
CHECK_CXX_FLAG(Wno-variadic-macros)
# this is used to check Doxygen comment syntax
CHECK_C_FLAG(Wdocumentation)
CHECK_CXX_FLAG(Wdocumentation)
endif(BRLCAD_ENABLE_COMPILER_WARNINGS OR BRLCAD_ENABLE_STRICT)
if(BRLCAD_ENABLE_COVERAGE)
CHECK_C_FLAG(ftest-coverage)
CHECK_CXX_FLAG(ftest-coverage)
if(FTEST_COVERAGE_C_FLAG_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage -fprofile-arcs")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage -fprofile-arcs")
else(FTEST_COVERAGE_C_FLAG_FOUND)
message(SEND_ERROR "Building with coverage is not supported by BRL-CAD on this platform.")
endif(FTEST_COVERAGE_C_FLAG_FOUND)
endif(BRLCAD_ENABLE_COVERAGE)
if(BRLCAD_ENABLE_STRICT)
# If we're going strict, suppress C11 warnings about isnan due to
# clang issue: https://llvm.org/bugs/show_bug.cgi?id=17788
CHECK_C_FLAG(Wno-c11-extensions)
CHECK_CXX_FLAG(Wno-c11-extensions)
# Add the flag that actually turns warnings into errors
CHECK_C_FLAG(Werror)
CHECK_CXX_FLAG(Werror)
endif(BRLCAD_ENABLE_STRICT)
# End detection of flags intended for BRL-CAD use. Make sure all variables have
# their appropriate values written to the cache - otherwise, DiffCache will see
# differences and update the COUNT file.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "C Compiler flags used by all targets" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "C++ Compiler flags used by all targets" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" CACHE STRING "Linker flags used by all shared library targets" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Linker flags used by all exe targets" FORCE)
mark_as_advanced(CMAKE_C_FLAGS)
mark_as_advanced(CMAKE_CXX_FLAGS)
mark_as_advanced(CMAKE_SHARED_LINKER_FLAGS)
mark_as_advanced(CMAKE_EXE_LINKER_FLAGS)
if(CMAKE_BUILD_TYPE)
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_UPPER)
set(CMAKE_C_FLAGS_${BUILD_TYPE_UPPER} "${CMAKE_C_FLAGS_${BUILD_TYPE_UPPER}}" CACHE STRING "C Compiler flags used for ${CMAKE_BUILD_TYPE} builds" FORCE)
set(CMAKE_CXX_FLAGS_${BUILD_TYPE_UPPER} "${CMAKE_CXX_FLAGS_${BUILD_TYPE_UPPER}}" CACHE STRING "C++ Compiler flags used for ${CMAKE_BUILD_TYPE} builds" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE_UPPER} "${CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE_UPPER}}" CACHE STRING "Linker flags used for ${CMAKE_BUILD_TYPE} builds" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE_UPPER} "${CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE_UPPER}}" CACHE STRING "Exe linker flags used for ${CMAKE_BUILD_TYPE} builds" FORCE)
mark_as_advanced(CMAKE_C_FLAGS_${BUILD_TYPE_UPPER})
mark_as_advanced(CMAKE_CXX_FLAGS_${BUILD_TYPE_UPPER})
mark_as_advanced(CMAKE_SHARED_LINKER_FLAGS_${BUILD_TYPE_UPPER})
mark_as_advanced(CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE_UPPER})
endif(CMAKE_BUILD_TYPE)
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
set(CMAKE_C_FLAGS_${CFG_TYPE_UPPER} "${CMAKE_C_FLAGS_${CFG_TYPE_UPPER}}" CACHE STRING "C Compiler flags used for ${CFG_TYPE} builds" FORCE)
set(CMAKE_CXX_FLAGS_${CFG_TYPE_UPPER} "${CMAKE_CXX_FLAGS_${CFG_TYPE_UPPER}}" CACHE STRING "C++ Compiler flags used for ${CFG_TYPE} builds" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_${CFG_TYPE_UPPER} "${CMAKE_SHARED_LINKER_FLAGS_${CFG_TYPE_UPPER}}" CACHE STRING "Linker flags used for ${CFG_TYPE} builds" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_${CFG_TYPE_UPPER} "${CMAKE_EXE_LINKER_FLAGS_${CFG_TYPE_UPPER}}" CACHE STRING "Exe linker flags used for ${CFG_TYPE} builds" FORCE)
mark_as_advanced(CMAKE_C_FLAGS_${CFG_TYPE_UPPER})
mark_as_advanced(CMAKE_CXX_FLAGS_${CFG_TYPE_UPPER})
mark_as_advanced(CMAKE_SHARED_LINKER_FLAGS_${CFG_TYPE_UPPER})
mark_as_advanced(CMAKE_EXE_LINKER_FLAGS_${CFG_TYPE_UPPER})
endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
# TODO - figure out if this should be integrated above
CHECK_COMPILER_FLAG(C "-Wunused-const-variable" HAVE_C_WUNUSED_CONST_VARIABLE)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+179 -123
View File
@@ -31,57 +31,6 @@
# 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 Type aware option
macro(AUTO_OPTION username varname debug_state release_state)
string(LENGTH "${${username}}" ${username}_SET)
if(NOT ${username}_SET)
set(${username} "AUTO" CACHE STRING "auto option" FORCE)
endif(NOT ${username}_SET)
set_property(CACHE ${username} PROPERTY STRINGS AUTO "ON" "OFF")
string(TOUPPER "${${username}}" username_upper)
set(${username} ${username_upper})
if(NOT ${${username}} MATCHES "AUTO" AND NOT ${${username}} MATCHES "ON" AND NOT ${${username}} MATCHES "OFF")
message(WARNING "Unknown value ${${username}} supplied for ${username} - defaulting to AUTO.\nValid options are AUTO, ON and OFF")
set(${username} "AUTO" CACHE STRING "auto option" FORCE)
endif(NOT ${${username}} MATCHES "AUTO" AND NOT ${${username}} MATCHES "ON" AND NOT ${${username}} MATCHES "OFF")
# If the "parent" setting isn't AUTO, do what it says
if(NOT ${${username}} MATCHES "AUTO")
set(${varname} ${${username}})
endif(NOT ${${username}} MATCHES "AUTO")
# If we don't understand the build type and have an AUTO setting,
# varname is not set.
if(CMAKE_BUILD_TYPE AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug")
if(NOT ${${username}} MATCHES "AUTO")
set(${varname} ${${username}})
endif(NOT ${${username}} MATCHES "AUTO")
endif(CMAKE_BUILD_TYPE AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug")
# If we DO understand the build type and have AUTO, be smart
if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND ${${username}} MATCHES "AUTO")
set(${varname} ${release_state})
set(${username} "${release_state} (AUTO)" CACHE STRING "auto option" FORCE)
endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND ${${username}} MATCHES "AUTO")
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND ${${username}} MATCHES "AUTO")
set(${varname} ${debug_state})
set(${username} "${debug_state} (AUTO)" CACHE STRING "auto option" FORCE)
endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND ${${username}} MATCHES "AUTO")
if(NOT CMAKE_BUILD_TYPE AND ${${username}} MATCHES "AUTO")
set(${varname} ${debug_state})
set(${username} "${debug_state} (AUTO)" CACHE STRING "auto option" FORCE)
endif(NOT CMAKE_BUILD_TYPE AND ${${username}} MATCHES "AUTO")
endmacro(AUTO_OPTION varname release_state debug_state)
#-----------------------------------------------------------------------------
# For "top-level" BRL-CAD options, some extra work is in order - descriptions and
@@ -97,70 +46,105 @@ endmacro(AUTO_OPTION varname release_state debug_state)
# configure style option syntax and CMake's variables, and append that to
# the generated configure.new file.
function(WRITE_CONFIG_YN opt opt_ALIASES onval offval)
set(ofile "${CMAKE_BINARY_DIR}/configure.new")
foreach(item ${opt_ALIASES})
string(TOLOWER ${item} alias_str)
string(REPLACE "_" "-" alias_str "${alias_str}")
string(REPLACE "enable" "disable" disable_str "${alias_str}")
file(APPEND "${ofile}" " --${alias_str}) options=\"$options -D${opt}=${onval}\";\n")
file(APPEND "${ofile}" " shift;;\n")
file(APPEND "${ofile}" " --${disable_str}) options=\"$options -D${opt}=${offval}\";\n")
file(APPEND "${ofile}" " shift;;\n")
endforeach(item ${opt_ALIASES})
endfunction(WRITE_CONFIG_YN)
function(WRITE_CONFIG_STR opt opt_ALIASES)
foreach(item ${opt_ALIASES})
string(TOLOWER ${item} alias_str)
file(APPEND "${ofile}" " --${alias_str}=*) inputstr=$1;\n")
file(APPEND "${ofile}" " options=\"$options -D${opt}=\${inputstr#--${alias_str}=}\";\n")
file(APPEND "${ofile}" " shift;;\n")
endforeach(item ${opt_ALIASES})
endfunction(WRITE_CONFIG_STR)
function(WRITE_CONFIG_OPTS opt opt_ALIASES style)
set(ofile "${CMAKE_BINARY_DIR}/configure.new")
if("${style}" STREQUAL "STRING")
# If we've got a string type, we don't need inverse logic.
WRITE_CONFIG_STR("${opt}" "${opt_ALIASES}")
return()
endif("${style}" STREQUAL "STRING")
# handle BUNDLE/SYSTEM options
if("${style}" STREQUAL "ABS")
WRITE_CONFIG_YN("${opt}" "${opt_ALIASES}" BUNDLED SYSTEM)
endif("${style}" STREQUAL "ABS")
# handle Boolean options
if("${style}" STREQUAL "BOOL")
WRITE_CONFIG_YN("${opt}" "${opt_ALIASES}" "ON" "OFF")
endif("${style}" STREQUAL "BOOL")
endfunction(WRITE_CONFIG_OPTS)
# Handle aliases for BRL-CAD options
macro(OPTION_ALIASES opt opt_ALIASES style)
if(${opt_ALIASES})
foreach(item ${${opt_ALIASES}})
string(REPLACE "ENABLE_" "DISABLE_" inverse_item ${item})
set(inverse_aliases ${inverse_aliases} ${inverse_item})
endforeach(item ${${opt_ALIASES}})
foreach(item ${${opt_ALIASES}})
if(NOT "${item}" STREQUAL "${opt}")
if(NOT "${${item}}" STREQUAL "")
set(${opt} ${${item}} CACHE STRING "setting ${opt} via alias ${item}" FORCE)
set(${item} "" CACHE STRING "set ${opt} via this variable" FORCE)
mark_as_advanced(${item})
endif(NOT "${${item}}" STREQUAL "")
endif(NOT "${item}" STREQUAL "${opt}")
endforeach(item ${${opt_ALIASES}})
# handle DISABLE forms of options
foreach(item ${inverse_aliases})
if(NOT "${item}" STREQUAL "${opt}")
if(NOT "${${item}}" STREQUAL "")
set(invert_item ${${item}})
if("${${item}}" STREQUAL "ON")
set(invert_item "OFF")
elseif("${invert_item}" STREQUAL "OFF")
set(invert_item "ON")
endif("${${item}}" STREQUAL "ON")
set(${opt} ${invert_item} CACHE STRING "setting ${opt} via alias ${item}" FORCE)
set(${item} "" CACHE STRING "set ${opt} via this variable" FORCE)
mark_as_advanced(${item})
endif(NOT "${${item}}" STREQUAL "")
endif(NOT "${item}" STREQUAL "${opt}")
endforeach(item ${inverse_aliases})
foreach(item ${${opt_ALIASES}})
string(TOLOWER ${item} alias_str)
string(REPLACE "_" "-" alias_str "${alias_str}")
string(REPLACE "enable" "disable" disable_str "${alias_str}")
if("${style}" STREQUAL "ABS")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " --${alias_str}) options=\"$options -D${opt}=BUNDLED\";\n")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " shift;;\n")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " --${disable_str}) options=\"$options -D${opt}=SYSTEM\";\n")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " shift;;\n")
endif("${style}" STREQUAL "ABS")
if("${style}" STREQUAL "BOOL")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " --${alias_str}) options=\"$options -D${opt}=ON\";\n")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " shift;;\n")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " --${disable_str}) options=\"$options -D${opt}=OFF\";\n")
file(APPEND "${CMAKE_BINARY_DIR}/configure.new" " shift;;\n")
endif("${style}" STREQUAL "BOOL")
endforeach(item ${${opt_ALIASES}})
endif(${opt_ALIASES})
endmacro(OPTION_ALIASES)
function(OPTION_RESOLVE_ALIASES ropt opt opt_ALIASES style)
set(lopt ${${ropt}})
foreach(item ${opt_ALIASES})
if(NOT "${item}" STREQUAL "${opt}" AND NOT "${${item}}" STREQUAL "")
set(lopt ${${item}})
set(${item} "" CACHE STRING "set ${opt} via this variable" FORCE)
mark_as_advanced(${item})
endif(NOT "${item}" STREQUAL "${opt}" AND NOT "${${item}}" STREQUAL "")
endforeach(item ${opt_ALIASES})
# String types don't have inverses
if("${style}" STREQUAL "STRING")
set(${ropt} ${lopt} PARENT_SCOPE)
return()
endif("${style}" STREQUAL "STRING")
# Generate inverse aliases for all "ENABLE" options
foreach(item ${opt_ALIASES})
string(REPLACE "ENABLE_" "DISABLE_" inverse_item ${item})
set(inverse_aliases ${inverse_aliases} ${inverse_item})
endforeach(item ${opt_ALIASES})
# Check the inverse options for a set value
foreach(item ${opt_ALIASES})
if(NOT "${${item}}" STREQUAL "")
set(lopt ${${item}})
set(${item} "" CACHE STRING "set ${opt} via this variable" FORCE)
mark_as_advanced(${item})
endif(NOT "${${item}}" STREQUAL "")
endforeach(item ${opt_ALIASES})
# Let the parent scope know the result
set(${ropt} ${lopt} PARENT_SCOPE)
endfunction(OPTION_RESOLVE_ALIASES)
# Write documentation description for BRL-CAD options
macro(OPTION_DESCRIPTION opt opt_ALIASES opt_DESCRIPTION)
file(APPEND "${CMAKE_BINARY_DIR}/OPTIONS" "\n--- ${opt} ---\n")
file(APPEND "${CMAKE_BINARY_DIR}/OPTIONS" "${${opt_DESCRIPTION}}")
function(WRITE_OPTION_DESCRIPTION opt opt_ALIASES opt_DESCRIPTION)
set(ofile "${CMAKE_BINARY_DIR}/OPTIONS")
file(APPEND "${ofile}" "\n--- ${opt} ---\n")
file(APPEND "${ofile}" "${${opt_DESCRIPTION}}")
set(ALIASES_LIST "\nAliases: ")
foreach(item ${${opt_ALIASES}})
foreach(item ${opt_ALIASES})
set(ALIASES_LIST_TEST "${ALIASES_LIST}, ${item}")
string(LENGTH ${ALIASES_LIST_TEST} LL)
if(${LL} GREATER 80)
file(APPEND "${CMAKE_BINARY_DIR}/OPTIONS" "${ALIASES_LIST}\n")
file(APPEND "${ofile}" "${ALIASES_LIST}\n")
set(ALIASES_LIST " ${item}")
else(${LL} GREATER 80)
if(NOT ${ALIASES_LIST} MATCHES "\nAliases")
@@ -173,33 +157,105 @@ macro(OPTION_DESCRIPTION opt opt_ALIASES opt_DESCRIPTION)
endif(NOT ${ALIASES_LIST} STREQUAL "\nAliases: ")
endif(NOT ${ALIASES_LIST} MATCHES "\nAliases")
endif(${LL} GREATER 80)
endforeach(item ${${opt_ALIASES}})
endforeach(item ${opt_ALIASES})
if(ALIASES_LIST)
string(STRIP ALIASES_LIST ${ALIASES_LIST})
if(ALIASES_LIST)
file(APPEND "${CMAKE_BINARY_DIR}/OPTIONS" "${ALIASES_LIST}")
file(APPEND "${ofile}" "${ALIASES_LIST}")
endif(ALIASES_LIST)
endif(ALIASES_LIST)
file(APPEND "${CMAKE_BINARY_DIR}/OPTIONS" "\n\n")
endmacro(OPTION_DESCRIPTION)
file(APPEND "${ofile}" "\n\n")
endfunction(WRITE_OPTION_DESCRIPTION)
function(VAL_NORMALIZE val optype)
string(TOUPPER "${${val}}" uval)
if("${uval}" STREQUAL "YES")
set(uval "ON")
endif("${uval}" STREQUAL "YES")
if("${uval}" STREQUAL "NO")
set(uval "OFF")
endif("${uval}" STREQUAL "NO")
if("${optype}" STREQUAL "ABS")
if("${uval}" STREQUAL "ON")
set(uval "BUNDLED")
endif("${uval}" STREQUAL "ON")
if("${uval}" STREQUAL "OFF")
set(uval "SYSTEM")
endif("${uval}" STREQUAL "OFF")
endif("${optype}" STREQUAL "ABS")
set(${val} "${uval}" PARENT_SCOPE)
endfunction(VAL_NORMALIZE)
function(OPT_NORMALIZE ropt default optype)
# We need something for a default
if("${default}" STREQUAL "")
message(FATAL_ERROR "Error - empty default value supplied for ${opt}")
endif("${default}" STREQUAL "")
# If we need to use the default, do so.
if("${${ropt}}" STREQUAL "")
set(local_opt "${default}")
else("${${ropt}}" STREQUAL "")
set(local_opt ${${ropt}})
endif("${${ropt}}" STREQUAL "")
# We should be done with logic that will change the setting - normalize
VAL_NORMALIZE(local_opt ${optype})
# Let the parent know what the normalized result is
set(${ropt} ${local_opt} PARENT_SCOPE)
endfunction(OPT_NORMALIZE)
# Standard option with BRL-CAD aliases and description
macro(BRLCAD_OPTION default opt opt_ALIASES opt_DESCRIPTION)
if(NOT DEFINED ${opt} OR "${${opt}}" STREQUAL "")
if("${default}" STREQUAL "ON" OR "${default}" STREQUAL "YES")
set(${opt} ON CACHE BOOL "define ${opt}" FORCE)
elseif("${default}" STREQUAL "OFF" OR "${default}" STREQUAL "NO")
set(${opt} OFF CACHE BOOL "define ${opt}" FORCE)
else("${default}" STREQUAL "ON" OR "${default}" STREQUAL "YES")
set(${opt} ${default} CACHE STRING "define ${opt}" FORCE)
endif("${default}" STREQUAL "ON" OR "${default}" STREQUAL "YES")
endif(NOT DEFINED ${opt} OR "${${opt}}" STREQUAL "")
function(BRLCAD_OPTION opt default)
cmake_parse_arguments(O "" "DESCRIPTION;TYPE" "ALIASES" ${ARGN})
# Initialize
set(lopt "${${opt}}")
set(otype)
if(O_TYPE)
set(otype ${O_TYPE})
endif(O_TYPE)
# Process aliases and write descriptions
if(O_ALIASES)
OPTION_RESOLVE_ALIASES(lopt "${opt}" "${O_ALIASES}" "${otype}")
WRITE_CONFIG_OPTS("${opt}" "${O_ALIASES}" "${otype}")
if(O_DESCRIPTION)
WRITE_OPTION_DESCRIPTION("${opt}" "${O_ALIASES}" "${O_DESCRIPTION}")
endif(O_DESCRIPTION)
endif(O_ALIASES)
# Finalize the actual value to be used
OPT_NORMALIZE(lopt "${default}" ${otype})
# Set in the cache
if("${otype}" STREQUAL "BOOL")
set(${opt} "${lopt}" CACHE BOOL "define ${opt}" FORCE)
else("${otype}" STREQUAL "BOOL")
set(${opt} "${lopt}" CACHE STRING "define ${opt}" FORCE)
endif("${otype}" STREQUAL "BOOL")
# For drop-down menus in CMake gui - set STRINGS property
if("${otype}" STREQUAL "ABS")
set_property(CACHE ${opt} PROPERTY STRINGS AUTO BUNDLED SYSTEM)
endif("${otype}" STREQUAL "ABS")
# Let the parent know
set(${opt} "${lopt}" PARENT_SCOPE)
endfunction(BRLCAD_OPTION)
OPTION_ALIASES("${opt}" "${opt_ALIASES}" "BOOL")
OPTION_DESCRIPTION("${opt}" "${opt_ALIASES}" "${opt_DESCRIPTION}")
endmacro(BRLCAD_OPTION)
# Local Variables:
# tab-width: 8
+381 -381
View File
@@ -37,431 +37,431 @@
# This file contains the CMake routines that summarize the results
# of the BRL-CAD configure process.
# By default, tailor the summary for an 80 column terminal
set(MAX_LINE_LENGTH 80)
function(BRLCAD_Summary)
# By default, tailor the summary for an 80 column terminal
set(MAX_LINE_LENGTH 80)
###################################################
# #
# Print Summary Banner #
# #
###################################################
###################################################
# #
# Print Summary Banner #
# #
###################################################
message("\n")
if(CMAKE_BUILD_TYPE)
set(BRLCAD_SUMMARY_BANNER " BRL-CAD Release ${BRLCAD_VERSION}, Build ${CONFIG_DATE} - ${CMAKE_BUILD_TYPE} Build ")
else(CMAKE_BUILD_TYPE)
set(BRLCAD_SUMMARY_BANNER " BRL-CAD Release ${BRLCAD_VERSION}, Build ${CONFIG_DATE} ")
endif(CMAKE_BUILD_TYPE)
# Standardize width of summary line
math(EXPR BANNER_LINE_TRIGGER "${MAX_LINE_LENGTH} - 1")
string(LENGTH "${BRLCAD_SUMMARY_BANNER}" CURRENT_LENGTH)
while(${CURRENT_LENGTH} LESS ${BANNER_LINE_TRIGGER})
set(BRLCAD_SUMMARY_BANNER "-${BRLCAD_SUMMARY_BANNER}-")
string(LENGTH "${BRLCAD_SUMMARY_BANNER}" CURRENT_LENGTH)
endwhile(${CURRENT_LENGTH} LESS ${BANNER_LINE_TRIGGER})
set(BRLCAD_SUMMARY_BANNER "${BRLCAD_SUMMARY_BANNER}\n")
message("${BRLCAD_SUMMARY_BANNER}")
###################################################
# #
# Installation Directories #
# #
###################################################
# Labels
set(CMAKE_INSTALL_PREFIX_LABEL "Prefix")
set(BIN_DIR_LABEL "Binaries")
set(LIB_DIR_LABEL "Libraries")
set(MAN_DIR_LABEL "Manual pages")
set(DATA_DIR_LABEL "Data resources")
set(PATH_LABELS CMAKE_INSTALL_PREFIX BIN_DIR LIB_DIR MAN_DIR DATA_DIR)
# Initialize length var
set(PATH_LABEL_LENGTH 0)
# Find longest label string for installation directories
foreach(path_label ${PATH_LABELS})
string(LENGTH "${${path_label}_LABEL}" CURRENT_LENGTH)
if (${CURRENT_LENGTH} GREATER ${PATH_LABEL_LENGTH})
set(PATH_LABEL_LENGTH ${CURRENT_LENGTH})
endif (${CURRENT_LENGTH} GREATER ${PATH_LABEL_LENGTH})
endforeach(path_label ${PATH_LABELS})
# Print each installation directory, adding white space
# as needed to the labels to align them properly
foreach(path_label ${PATH_LABELS})
set(CURRENT_LABEL ${${path_label}_LABEL})
string(LENGTH "${CURRENT_LABEL}" CURRENT_LENGTH)
while(${PATH_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
set(CURRENT_LABEL " ${CURRENT_LABEL}")
string(LENGTH "${CURRENT_LABEL}" CURRENT_LENGTH)
endwhile(${PATH_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
if(path_label MATCHES "^CMAKE_INSTALL_PREFIX$")
message("${CURRENT_LABEL}: ${${path_label}}")
else(path_label MATCHES "^CMAKE_INSTALL_PREFIX$")
message("${CURRENT_LABEL}: ${CMAKE_INSTALL_PREFIX}/${${path_label}}")
endif(path_label MATCHES "^CMAKE_INSTALL_PREFIX$")
endforeach()
message(" ")
###################################################
# #
# Compiler Flags #
# #
###################################################
set(ALL_FLAG_TYPES C CXX SHARED_LINKER)
# Labels
set(C_LABEL "CFLAGS")
set(CXX_LABEL "CXXFLAGS")
set(SHARED_LINKER_LABEL "LDFLAGS")
set(C_COMPILER_LABEL "CC")
set(CXX_COMPILER_LABEL "CXX")
set(ALL_FLAG_LABELS C_LABEL CXX_LABEL SHARED_LINKER_LABEL C_COMPILER_LABEL CXX_COMPILER_LABEL)
# Initialize length var
set(MAX_LABEL_LENGTH 0)
# Find longest label string for FLAGS
foreach(setting_label ${ALL_FLAG_LABELS})
string(LENGTH "${${setting_label}}" CURRENT_LENGTH)
if(${CURRENT_LENGTH} GREATER ${MAX_LABEL_LENGTH})
set(MAX_LABEL_LENGTH ${CURRENT_LENGTH})
endif(${CURRENT_LENGTH} GREATER ${MAX_LABEL_LENGTH})
endforeach(setting_label ${ALL_FLAG_LABELS})
# Add spaces to all labels to make their length uniform
foreach(setting_label ${ALL_FLAG_LABELS})
string(LENGTH "${${setting_label}}" CURRENT_LENGTH)
while(${MAX_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
set(${setting_label} "${${setting_label}} ")
string(LENGTH "${${setting_label}}" CURRENT_LENGTH)
endwhile(${MAX_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
endforeach(setting_label ${ALL_FLAG_LABELS})
# Add the equals sign.
foreach(setting_label ${ALL_FLAG_LABELS})
set(${setting_label} "${${setting_label}} =")
endforeach(setting_label ${ALL_FLAG_LABELS})
# If we're not using MSVC, go ahead and print the compilers
if(NOT MSVC)
message("${C_COMPILER_LABEL} ${CMAKE_C_COMPILER}")
message("${CXX_COMPILER_LABEL} ${CMAKE_CXX_COMPILER}")
endif(NOT MSVC)
list(GET ALL_FLAG_LABELS 0 LABEL_LENGTH_STR)
string(LENGTH "${LABEL_LENGTH_STR}" LABEL_LENGTH)
function(print_flags flag_type flags FLAGS_MAXLINE)
set(LINE_STR "${${flag_type}_LABEL}")
string(REPLACE " " ";" ${flag_type}_LIST "${flags}")
list(LENGTH ${flag_type}_LIST FLAG_CNT)
while(${FLAG_CNT} GREATER 0)
string(LENGTH "${LINE_STR}" LINE_LENGTH)
if(${LINE_LENGTH} STREQUAL "0")
while(${LINE_LENGTH} LESS ${LABEL_LENGTH})
set(LINE_STR "${LINE_STR} ")
string(LENGTH "${LINE_STR}" LINE_LENGTH)
endwhile(${LINE_LENGTH} LESS ${LABEL_LENGTH})
set(LINE_STR "${LINE_STR} ")
endif(${LINE_LENGTH} STREQUAL "0")
list(GET ${flag_type}_LIST 0 NEXT_FLAG)
if(NOT "${NEXT_FLAG}" STREQUAL "")
string(LENGTH ${NEXT_FLAG} FLAG_LENGTH)
math(EXPR NEW_LINE_LENGTH "${LINE_LENGTH} + ${FLAG_LENGTH} + 1")
if(${NEW_LINE_LENGTH} LESS ${FLAGS_MAXLINE})
set(LINE_STR "${LINE_STR} ${NEXT_FLAG}")
list(REMOVE_AT ${flag_type}_LIST 0)
list(LENGTH ${flag_type}_LIST FLAG_CNT)
else(${NEW_LINE_LENGTH} LESS ${FLAGS_MAXLINE})
message("${LINE_STR}")
set(LINE_STR "")
endif(${NEW_LINE_LENGTH} LESS ${FLAGS_MAXLINE})
else(NOT "${NEXT_FLAG}" STREQUAL "")
list(REMOVE_AT ${flag_type}_LIST 0)
endif(NOT "${NEXT_FLAG}" STREQUAL "")
endwhile(${FLAG_CNT} GREATER 0)
if(NOT "${LINE_STR}" STREQUAL "")
message("${LINE_STR}")
endif(NOT "${LINE_STR}" STREQUAL "")
endfunction()
if(CMAKE_CONFIGURATION_TYPES)
message("Flags common to all build configurations:")
foreach(flag_type ${ALL_FLAG_TYPES})
print_flags(${flag_type} "${CMAKE_${flag_type}_FLAGS}" ${MAX_LINE_LENGTH})
endforeach(flag_type ${ALL_FLAG_TYPES})
message(" ")
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
set(HAVE_EXTRA_FLAGS 0)
foreach(flag_type ${ALL_FLAG_TYPES})
if(CMAKE_${flag_type}_FLAGS_${CFG_TYPE_UPPER})
set(HAVE_EXTRA_FLAGS 1)
endif(CMAKE_${flag_type}_FLAGS_${CFG_TYPE_UPPER})
endforeach(flag_type ${ALL_FLAG_TYPES})
if(HAVE_EXTRA_FLAGS)
message("Additional Compilation flags used when building with configuration ${CFG_TYPE}:")
foreach(flag_type ${ALL_FLAG_TYPES})
print_flags(${flag_type} "${CMAKE_${flag_type}_FLAGS_${CFG_TYPE_UPPER}}" ${MAX_LINE_LENGTH})
endforeach(flag_type ${ALL_FLAG_TYPES})
message(" ")
endif(HAVE_EXTRA_FLAGS)
endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
else(CMAKE_CONFIGURATION_TYPES)
message("\n")
if(CMAKE_BUILD_TYPE)
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
foreach(flag_type ${ALL_FLAG_TYPES})
print_flags(${flag_type} "${CMAKE_${flag_type}_FLAGS} ${CMAKE_${flag_type}_FLAGS_${BUILD_TYPE}}" ${MAX_LINE_LENGTH})
endforeach(flag_type ${ALL_FLAG_TYPES})
message(" ")
set(BRLCAD_SUMMARY_BANNER " BRL-CAD Release ${BRLCAD_VERSION}, Build ${CONFIG_DATE} - ${CMAKE_BUILD_TYPE} Build ")
else(CMAKE_BUILD_TYPE)
set(BRLCAD_SUMMARY_BANNER " BRL-CAD Release ${BRLCAD_VERSION}, Build ${CONFIG_DATE} ")
endif(CMAKE_BUILD_TYPE)
# Standardize width of summary line
math(EXPR BANNER_LINE_TRIGGER "${MAX_LINE_LENGTH} - 1")
string(LENGTH "${BRLCAD_SUMMARY_BANNER}" CURRENT_LENGTH)
while(${CURRENT_LENGTH} LESS ${BANNER_LINE_TRIGGER})
set(BRLCAD_SUMMARY_BANNER "-${BRLCAD_SUMMARY_BANNER}-")
string(LENGTH "${BRLCAD_SUMMARY_BANNER}" CURRENT_LENGTH)
endwhile(${CURRENT_LENGTH} LESS ${BANNER_LINE_TRIGGER})
set(BRLCAD_SUMMARY_BANNER "${BRLCAD_SUMMARY_BANNER}\n")
message("${BRLCAD_SUMMARY_BANNER}")
###################################################
# #
# Installation Directories #
# #
###################################################
# Labels
set(CMAKE_INSTALL_PREFIX_LABEL "Prefix")
set(BIN_DIR_LABEL "Binaries")
set(LIB_DIR_LABEL "Libraries")
set(MAN_DIR_LABEL "Manual pages")
set(DATA_DIR_LABEL "Data resources")
set(PATH_LABELS CMAKE_INSTALL_PREFIX BIN_DIR LIB_DIR MAN_DIR DATA_DIR)
# Initialize length var
set(PATH_LABEL_LENGTH 0)
# Find longest label string for installation directories
foreach(path_label ${PATH_LABELS})
string(LENGTH "${${path_label}_LABEL}" CURRENT_LENGTH)
if (${CURRENT_LENGTH} GREATER ${PATH_LABEL_LENGTH})
set(PATH_LABEL_LENGTH ${CURRENT_LENGTH})
endif (${CURRENT_LENGTH} GREATER ${PATH_LABEL_LENGTH})
endforeach(path_label ${PATH_LABELS})
# Print each installation directory, adding white space
# as needed to the labels to align them properly
foreach(path_label ${PATH_LABELS})
set(CURRENT_LABEL ${${path_label}_LABEL})
string(LENGTH "${CURRENT_LABEL}" CURRENT_LENGTH)
while(${PATH_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
set(CURRENT_LABEL " ${CURRENT_LABEL}")
string(LENGTH "${CURRENT_LABEL}" CURRENT_LENGTH)
endwhile(${PATH_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
if(path_label MATCHES "^CMAKE_INSTALL_PREFIX$")
message("${CURRENT_LABEL}: ${${path_label}}")
else(path_label MATCHES "^CMAKE_INSTALL_PREFIX$")
message("${CURRENT_LABEL}: ${CMAKE_INSTALL_PREFIX}/${${path_label}}")
endif(path_label MATCHES "^CMAKE_INSTALL_PREFIX$")
endforeach()
message(" ")
###################################################
# #
# Compiler Flags #
# #
###################################################
set(ALL_FLAG_TYPES C CXX SHARED_LINKER)
# Labels
set(C_LABEL "CFLAGS")
set(CXX_LABEL "CXXFLAGS")
set(SHARED_LINKER_LABEL "LDFLAGS")
set(C_COMPILER_LABEL "CC")
set(CXX_COMPILER_LABEL "CXX")
set(ALL_FLAG_LABELS C_LABEL CXX_LABEL SHARED_LINKER_LABEL C_COMPILER_LABEL CXX_COMPILER_LABEL)
# Initialize length var
set(MAX_LABEL_LENGTH 0)
# Find longest label string for FLAGS
foreach(setting_label ${ALL_FLAG_LABELS})
string(LENGTH "${${setting_label}}" CURRENT_LENGTH)
if(${CURRENT_LENGTH} GREATER ${MAX_LABEL_LENGTH})
set(MAX_LABEL_LENGTH ${CURRENT_LENGTH})
endif(${CURRENT_LENGTH} GREATER ${MAX_LABEL_LENGTH})
endforeach(setting_label ${ALL_FLAG_LABELS})
# Add spaces to all labels to make their length uniform
foreach(setting_label ${ALL_FLAG_LABELS})
string(LENGTH "${${setting_label}}" CURRENT_LENGTH)
while(${MAX_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
set(${setting_label} "${${setting_label}} ")
string(LENGTH "${${setting_label}}" CURRENT_LENGTH)
endwhile(${MAX_LABEL_LENGTH} GREATER ${CURRENT_LENGTH})
endforeach(setting_label ${ALL_FLAG_LABELS})
# Add the equals sign.
foreach(setting_label ${ALL_FLAG_LABELS})
set(${setting_label} "${${setting_label}} =")
endforeach(setting_label ${ALL_FLAG_LABELS})
# If we're not using MSVC, go ahead and print the compilers
if(NOT MSVC)
message("${C_COMPILER_LABEL} ${CMAKE_C_COMPILER}")
message("${CXX_COMPILER_LABEL} ${CMAKE_CXX_COMPILER}")
endif(NOT MSVC)
list(GET ALL_FLAG_LABELS 0 LABEL_LENGTH_STR)
string(LENGTH "${LABEL_LENGTH_STR}" LABEL_LENGTH)
function(print_flags flag_type flags FLAGS_MAXLINE)
set(LINE_STR "${${flag_type}_LABEL}")
string(REPLACE " " ";" ${flag_type}_LIST "${flags}")
list(LENGTH ${flag_type}_LIST FLAG_CNT)
while(${FLAG_CNT} GREATER 0)
string(LENGTH "${LINE_STR}" LINE_LENGTH)
if(${LINE_LENGTH} STREQUAL "0")
while(${LINE_LENGTH} LESS ${LABEL_LENGTH})
set(LINE_STR "${LINE_STR} ")
string(LENGTH "${LINE_STR}" LINE_LENGTH)
endwhile(${LINE_LENGTH} LESS ${LABEL_LENGTH})
set(LINE_STR "${LINE_STR} ")
endif(${LINE_LENGTH} STREQUAL "0")
list(GET ${flag_type}_LIST 0 NEXT_FLAG)
if(NOT "${NEXT_FLAG}" STREQUAL "")
string(LENGTH ${NEXT_FLAG} FLAG_LENGTH)
math(EXPR NEW_LINE_LENGTH "${LINE_LENGTH} + ${FLAG_LENGTH} + 1")
if(${LINE_LENGTH} EQUAL ${LABEL_LENGTH} OR ${NEW_LINE_LENGTH} LESS ${FLAGS_MAXLINE})
set(LINE_STR "${LINE_STR} ${NEXT_FLAG}")
list(REMOVE_AT ${flag_type}_LIST 0)
list(LENGTH ${flag_type}_LIST FLAG_CNT)
else(${LINE_LENGTH} EQUAL ${LABEL_LENGTH} OR ${NEW_LINE_LENGTH} LESS ${FLAGS_MAXLINE})
message("${LINE_STR}")
set(LINE_STR "")
endif(${LINE_LENGTH} EQUAL ${LABEL_LENGTH} OR ${NEW_LINE_LENGTH} LESS ${FLAGS_MAXLINE})
else(NOT "${NEXT_FLAG}" STREQUAL "")
list(REMOVE_AT ${flag_type}_LIST 0)
endif(NOT "${NEXT_FLAG}" STREQUAL "")
endwhile(${FLAG_CNT} GREATER 0)
if(NOT "${LINE_STR}" STREQUAL "")
message("${LINE_STR}")
endif(NOT "${LINE_STR}" STREQUAL "")
endfunction()
if(CMAKE_CONFIGURATION_TYPES)
message("Flags common to all build configurations:")
foreach(flag_type ${ALL_FLAG_TYPES})
print_flags(${flag_type} "${CMAKE_${flag_type}_FLAGS}" ${MAX_LINE_LENGTH})
endforeach(flag_type ${ALL_FLAG_TYPES})
endif(CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES)
message(" ")
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
set(HAVE_EXTRA_FLAGS 0)
foreach(flag_type ${ALL_FLAG_TYPES})
if(CMAKE_${flag_type}_FLAGS_${CFG_TYPE_UPPER})
set(HAVE_EXTRA_FLAGS 1)
endif(CMAKE_${flag_type}_FLAGS_${CFG_TYPE_UPPER})
endforeach(flag_type ${ALL_FLAG_TYPES})
if(HAVE_EXTRA_FLAGS)
message("Additional Compilation flags used when building with configuration ${CFG_TYPE}:")
foreach(flag_type ${ALL_FLAG_TYPES})
print_flags(${flag_type} "${CMAKE_${flag_type}_FLAGS_${CFG_TYPE_UPPER}}" ${MAX_LINE_LENGTH})
endforeach(flag_type ${ALL_FLAG_TYPES})
message(" ")
endif(HAVE_EXTRA_FLAGS)
endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
else(CMAKE_CONFIGURATION_TYPES)
if(CMAKE_BUILD_TYPE)
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
foreach(flag_type ${ALL_FLAG_TYPES})
print_flags(${flag_type} "${CMAKE_${flag_type}_FLAGS} ${CMAKE_${flag_type}_FLAGS_${BUILD_TYPE}}" ${MAX_LINE_LENGTH})
endforeach(flag_type ${ALL_FLAG_TYPES})
message(" ")
else(CMAKE_BUILD_TYPE)
foreach(flag_type ${ALL_FLAG_TYPES})
print_flags(${flag_type} "${CMAKE_${flag_type}_FLAGS}" ${MAX_LINE_LENGTH})
endforeach(flag_type ${ALL_FLAG_TYPES})
endif(CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES)
# Spacer between flags and compilation status lists
message(" ")
# Spacer between flags and compilation status lists
message(" ")
###################################################
# #
# Set up primary report item lists and labels #
# #
###################################################
###################################################
# #
# Set up primary report item lists and labels #
# #
###################################################
# Build options
set(BRLCAD_BULLET_BUILD_LABEL "Compile Bullet ")
set(BRLCAD_TCL_BUILD_LABEL "Compile Tcl ")
set(BRLCAD_TK_BUILD_LABEL "Compile Tk ")
set(BRLCAD_INCRTCL_BUILD_LABEL "Compile Itcl/Itk ")
set(BRLCAD_IWIDGETS_BUILD_LABEL "Compile Iwidgets ")
set(BRLCAD_TKHTML_BUILD_LABEL "Compile Tkhtml ")
set(BRLCAD_TKPNG_BUILD_LABEL "Compile tkpng ")
set(BRLCAD_TKTABLE_BUILD_LABEL "Compile Tktable ")
set(BRLCAD_PNG_BUILD_LABEL "Compile libpng ")
set(BRLCAD_REGEX_BUILD_LABEL "Compile libregex ")
set(BRLCAD_ZLIB_BUILD_LABEL "Compile zlib ")
set(BRLCAD_TERMLIB_BUILD_LABEL "Compile termlib ")
set(BRLCAD_UTAHRLE_BUILD_LABEL "Compile Utah Raster Toolkit ")
set(BRLCAD_OPENNURBS_BUILD_LABEL "Compile openNURBS ")
set(BRLCAD_SC_BUILD_LABEL "Compile STEPcode")
set(BRLCAD_ENABLE_X11_LABEL "X11 support (optional) ")
set(BRLCAD_ENABLE_OPENGL_LABEL "OpenGL support (optional) ")
set(BRLCAD_ENABLE_QT_LABEL "Qt support (optional) ")
set(BRLCAD_ENABLE_RUNTIME_DEBUG_LABEL "Enable run-time debugging (optional) ")
set(BRLCAD_ARCH_BITSETTING_LABEL "Build 32/64-bit release ")
set(BRLCAD_OPTIMIZED_BUILD_LABEL "Build optimized release ")
set(BRLCAD_FLAGS_DEBUG_LABEL "Build debuggable release")
set(BRLCAD_ENABLE_PROFILING_LABEL "Build profile release ")
set(BRLCAD_ENABLE_SMP_LABEL "Build SMP-capable release ")
set(BUILD_STATIC_LIBS_LABEL "Build static libraries ")
set(BUILD_SHARED_LIBS_LABEL "Build dynamic libraries ")
set(BRLCAD_ENABLE_COMPILER_WARNINGS_LABEL "Print verbose compilation warnings ")
set(BRLCAD_ENABLE_VERBOSE_PROGRESS_LABEL "Print verbose compilation progress ")
set(BRLCAD_INSTALL_EXAMPLE_GEOMETRY_LABEL "Install example geometry models ")
set(BRLCAD_DOCBOOK_BUILD_LABEL "Generate extra docs ")
set(ENABLE_STRICT_COMPILER_STANDARD_COMPLIANCE_LABEL "Build with strict ISO C compliance checking ")
set(ENABLE_POSIX_COMPLIANCE_LABEL "Build with strict POSIX compliance checking ")
set(ENABLE_ALL_CXX_COMPILE_LABEL "Build all C and C++ files with a C++ compiler ")
# Build options
set(BRLCAD_TCL_BUILD_LABEL "Compile Tcl ")
set(BRLCAD_TK_BUILD_LABEL "Compile Tk ")
set(BRLCAD_INCRTCL_BUILD_LABEL "Compile Itcl/Itk ")
set(BRLCAD_IWIDGETS_BUILD_LABEL "Compile Iwidgets ")
set(BRLCAD_TKHTML_BUILD_LABEL "Compile Tkhtml ")
set(BRLCAD_TKPNG_BUILD_LABEL "Compile tkpng ")
set(BRLCAD_TKTABLE_BUILD_LABEL "Compile Tktable ")
set(BRLCAD_PNG_BUILD_LABEL "Compile libpng ")
set(BRLCAD_REGEX_BUILD_LABEL "Compile libregex ")
set(BRLCAD_ZLIB_BUILD_LABEL "Compile zlib ")
set(BRLCAD_TERMLIB_BUILD_LABEL "Compile termlib ")
set(BRLCAD_UTAHRLE_BUILD_LABEL "Compile Utah Raster Toolkit ")
set(BRLCAD_OPENNURBS_BUILD_LABEL "Compile openNURBS ")
set(BRLCAD_SC_BUILD_LABEL "Compile STEPcode")
set(BRLCAD_ENABLE_X11_LABEL "X11 support (optional) ")
set(BRLCAD_ENABLE_OPENGL_LABEL "OpenGL support (optional) ")
set(BRLCAD_ENABLE_QT_LABEL "Qt support (optional) ")
set(BRLCAD_ENABLE_RUNTIME_DEBUG_LABEL "Enable run-time debugging (optional) ")
set(BRLCAD_ARCH_BITSETTING_LABEL "Build 32/64-bit release ")
set(BRLCAD_OPTIMIZED_BUILD_LABEL "Build optimized release ")
set(BRLCAD_FLAGS_DEBUG_LABEL "Build debuggable release")
set(BRLCAD_ENABLE_PROFILING_LABEL "Build profile release ")
set(BRLCAD_ENABLE_SMP_LABEL "Build SMP-capable release ")
set(BUILD_STATIC_LIBS_LABEL "Build static libraries ")
set(BUILD_SHARED_LIBS_LABEL "Build dynamic libraries ")
set(BRLCAD_ENABLE_COMPILER_WARNINGS_LABEL "Print verbose compilation warnings ")
set(BRLCAD_ENABLE_VERBOSE_PROGRESS_LABEL "Print verbose compilation progress ")
set(BRLCAD_INSTALL_EXAMPLE_GEOMETRY_LABEL "Install example geometry models ")
set(BRLCAD_DOCBOOK_BUILD_LABEL "Generate extra docs ")
set(ENABLE_STRICT_COMPILER_STANDARD_COMPLIANCE_LABEL "Build with strict ISO C compliance checking ")
set(ENABLE_POSIX_COMPLIANCE_LABEL "Build with strict POSIX compliance checking ")
set(ENABLE_ALL_CXX_COMPILE_LABEL "Build all C and C++ files with a C++ compiler ")
# Make sets to use for iteration over all report items
set(BUILD_REPORT_ITEMS
# Make sets to use for iteration over all report items
set(BUILD_REPORT_ITEMS
TCL TK INCRTCL IWIDGETS TKHTML TKPNG TKTABLE PNG REGEX ZLIB
TERMLIB UTAHRLE OPENNURBS SC BULLET)
TERMLIB UTAHRLE OPENNURBS SC)
set(FEATURE_REPORT_ITEMS
set(FEATURE_REPORT_ITEMS
BRLCAD_ENABLE_OPENGL
BRLCAD_ENABLE_X11
BRLCAD_ENABLE_QT
BRLCAD_ENABLE_RUNTIME_DEBUG
)
set(OTHER_REPORT_ITEMS
set(OTHER_REPORT_ITEMS
BRLCAD_ARCH_BITSETTING BRLCAD_OPTIMIZED_BUILD
BUILD_STATIC_LIBS BUILD_SHARED_LIBS
BRLCAD_INSTALL_EXAMPLE_GEOMETRY BRLCAD_DOCBOOK_BUILD
)
if(BRLCAD_SUMMARIZE_DEV_SETTINGS)
set(OTHER_REPORT_ITEMS ${OTHER_REPORT_ITEMS}
BRLCAD_FLAGS_DEBUG
BRLCAD_ENABLE_SMP
BRLCAD_ENABLE_PROFILING
BRLCAD_ENABLE_COMPILER_WARNINGS
BRLCAD_ENABLE_VERBOSE_PROGRESS
ENABLE_STRICT_COMPILER_STANDARD_COMPLIANCE
ENABLE_POSIX_COMPLIANCE ENABLE_ALL_CXX_COMPILE
)
endif(BRLCAD_SUMMARIZE_DEV_SETTINGS)
if(BRLCAD_SUMMARIZE_DEV_SETTINGS)
set(OTHER_REPORT_ITEMS ${OTHER_REPORT_ITEMS}
BRLCAD_FLAGS_DEBUG
BRLCAD_ENABLE_SMP
BRLCAD_ENABLE_PROFILING
BRLCAD_ENABLE_COMPILER_WARNINGS
BRLCAD_ENABLE_VERBOSE_PROGRESS
ENABLE_STRICT_COMPILER_STANDARD_COMPLIANCE
ENABLE_POSIX_COMPLIANCE ENABLE_ALL_CXX_COMPILE
)
endif(BRLCAD_SUMMARIZE_DEV_SETTINGS)
# Construct list of all items
set(ALL_ITEMS)
foreach(item ${BUILD_REPORT_ITEMS})
set(ALL_ITEMS ${ALL_ITEMS} BRLCAD_${item}_BUILD)
endforeach(item ${BUILD_REPORT_ITEMS})
set(ALL_ITEMS ${ALL_ITEMS} ${FEATURE_REPORT_ITEMS} ${OTHER_REPORT_ITEMS})
# Construct list of all items
set(ALL_ITEMS)
foreach(item ${BUILD_REPORT_ITEMS})
set(ALL_ITEMS ${ALL_ITEMS} BRLCAD_${item}_BUILD)
endforeach(item ${BUILD_REPORT_ITEMS})
set(ALL_ITEMS ${ALL_ITEMS} ${FEATURE_REPORT_ITEMS} ${OTHER_REPORT_ITEMS})
# Construct list of all labels
set(ALL_LABELS)
foreach(item ${ALL_ITEMS})
set(ALL_LABELS ${ALL_LABELS} ${item}_LABEL)
endforeach(item ${ALL_ITEMS})
# Construct list of all labels
set(ALL_LABELS)
foreach(item ${ALL_ITEMS})
set(ALL_LABELS ${ALL_LABELS} ${item}_LABEL)
endforeach(item ${ALL_ITEMS})
# Find the maximum label length
set(LABEL_LENGTH 0)
foreach(label ${ALL_LABELS})
string(LENGTH "${${label}}" CURRENT_LENGTH)
if(${CURRENT_LENGTH} GREATER ${LABEL_LENGTH})
set(LABEL_LENGTH ${CURRENT_LENGTH})
endif(${CURRENT_LENGTH} GREATER ${LABEL_LENGTH})
endforeach(label ${ALL_LABELS})
# Add necessary periods to each label to make a uniform
# label size
foreach(label ${ALL_LABELS})
string(LENGTH "${${label}}" CURRENT_LENGTH)
while(${CURRENT_LENGTH} LESS ${LABEL_LENGTH})
set(${label} "${${label}}.")
# Find the maximum label length
set(LABEL_LENGTH 0)
foreach(label ${ALL_LABELS})
string(LENGTH "${${label}}" CURRENT_LENGTH)
endwhile(${CURRENT_LENGTH} LESS ${LABEL_LENGTH})
endforeach(label ${ALL_LABELS})
if(${CURRENT_LENGTH} GREATER ${LABEL_LENGTH})
set(LABEL_LENGTH ${CURRENT_LENGTH})
endif(${CURRENT_LENGTH} GREATER ${LABEL_LENGTH})
endforeach(label ${ALL_LABELS})
# Add the final element to each label.
foreach(label ${ALL_LABELS})
set(${label} "${${label}}..:")
endforeach(label ${ALL_LABELS})
# Add necessary periods to each label to make a uniform
# label size
foreach(label ${ALL_LABELS})
string(LENGTH "${${label}}" CURRENT_LENGTH)
while(${CURRENT_LENGTH} LESS ${LABEL_LENGTH})
set(${label} "${${label}}.")
string(LENGTH "${${label}}" CURRENT_LENGTH)
endwhile(${CURRENT_LENGTH} LESS ${LABEL_LENGTH})
endforeach(label ${ALL_LABELS})
###################################################
# #
# Third Party #
# #
###################################################
# The actual build state (as opposed to the AUTO/BUNDLED/SYSTEM setting)
# of the third party libraries is not present in the global cache and
# must be explicitly pulled from src/other
macro(GET_BUILD_STATE ITEM)
get_directory_property(BRLCAD_${ITEM}_BUILD DIRECTORY src/other DEFINITION BRLCAD_${ITEM}_BUILD)
get_directory_property(BRLCAD_${ITEM}_NOTFOUND DIRECTORY src/other DEFINITION BRLCAD_${ITEM}_NOTFOUND)
if("${BRLCAD_${ITEM}_BUILD}" STREQUAL "OFF" AND BRLCAD_${ITEM}_NOTFOUND)
set(BRLCAD_${ITEM}_BUILD "OFF!")
endif("${BRLCAD_${ITEM}_BUILD}" STREQUAL "OFF" AND BRLCAD_${ITEM}_NOTFOUND)
endmacro(GET_BUILD_STATE)
# Add the final element to each label.
foreach(label ${ALL_LABELS})
set(${label} "${${label}}..:")
endforeach(label ${ALL_LABELS})
# List of components to be reported on.
set(THIRD_PARTY_COMPONENT_LIST ${BUILD_REPORT_ITEMS})
# IncrTcl must be handled separately
list(REMOVE_ITEM THIRD_PARTY_COMPONENT_LIST "INCRTCL")
###################################################
# #
# Third Party #
# #
###################################################
# The actual build state (as opposed to the AUTO/BUNDLED/SYSTEM setting)
# of the third party libraries is not present in the global cache and
# must be explicitly pulled from src/other
macro(GET_BUILD_STATE ITEM)
endmacro(GET_BUILD_STATE)
# Set state messages for standard components
foreach(item ${THIRD_PARTY_COMPONENT_LIST})
GET_BUILD_STATE(${item})
endforeach(item ${THIRD_PARTY_COMPONENT_LIST})
# List of components to be reported on.
set(THIRD_PARTY_COMPONENT_LIST ${BUILD_REPORT_ITEMS})
# IncrTcl must be handled separately
list(REMOVE_ITEM THIRD_PARTY_COMPONENT_LIST "INCRTCL")
# IncrTcl is both ITCL and ITK - handle the various possibilities here
get_directory_property(BRLCAD_ITCL_BUILD DIRECTORY src/other DEFINITION BRLCAD_ITCL_BUILD)
get_directory_property(BRLCAD_ITK_BUILD DIRECTORY src/other DEFINITION BRLCAD_ITK_BUILD)
get_directory_property(BRLCAD_ITCL_NOTFOUND DIRECTORY src/other DEFINITION BRLCAD_ITCL_NOTFOUND)
get_directory_property(BRLCAD_ITK_NOTFOUND DIRECTORY src/other DEFINITION BRLCAD_ITK_NOTFOUND)
if(BRLCAD_ITCL_BUILD AND BRLCAD_ITK_BUILD)
set(BRLCAD_INCRTCL_BUILD ON)
else(BRLCAD_ITCL_BUILD AND BRLCAD_ITK_BUILD)
if(BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
set(BRLCAD_INCRTCL_BUILD "ON (Itcl only)")
endif(BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
if(BRLCAD_ITK_BUILD AND NOT BRLCAD_ITCL_BUILD)
set(BRLCAD_INCRTCL_BUILD "ON (Itk only)")
endif(BRLCAD_ITK_BUILD AND NOT BRLCAD_ITCL_BUILD)
if(NOT BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
if(BRLCAD_ITCL_NOTFOUND OR BRLCAD_ITK_NOTFOUND)
set(BRLCAD_INCRTCL_BUILD "OFF!")
else(BRLCAD_ITCL_NOTFOUND OR BRLCAD_ITK_NOTFOUND)
set(BRLCAD_INCRTCL_BUILD "OFF")
endif(BRLCAD_ITCL_NOTFOUND OR BRLCAD_ITK_NOTFOUND)
endif(NOT BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
endif(BRLCAD_ITCL_BUILD AND BRLCAD_ITK_BUILD)
# Set state messages for standard components
foreach(ITEM ${THIRD_PARTY_COMPONENT_LIST})
get_directory_property(BRLCAD_${ITEM}_BUILD DIRECTORY src/other DEFINITION BRLCAD_${ITEM}_BUILD)
get_directory_property(BRLCAD_${ITEM}_NOTFOUND DIRECTORY src/other DEFINITION BRLCAD_${ITEM}_NOTFOUND)
if("${BRLCAD_${ITEM}_BUILD}" STREQUAL "OFF" AND BRLCAD_${ITEM}_NOTFOUND)
set(BRLCAD_${ITEM}_BUILD "OFF!")
endif("${BRLCAD_${ITEM}_BUILD}" STREQUAL "OFF" AND BRLCAD_${ITEM}_NOTFOUND)
endforeach(ITEM ${THIRD_PARTY_COMPONENT_LIST})
foreach(item ${BUILD_REPORT_ITEMS})
message("${BRLCAD_${item}_BUILD_LABEL} ${BRLCAD_${item}_BUILD}")
endforeach(item ${BUILD_REPORT_ITEMS})
# IncrTcl is both ITCL and ITK - handle the various possibilities here
get_directory_property(BRLCAD_ITCL_BUILD DIRECTORY src/other DEFINITION BRLCAD_ITCL_BUILD)
get_directory_property(BRLCAD_ITK_BUILD DIRECTORY src/other DEFINITION BRLCAD_ITK_BUILD)
get_directory_property(BRLCAD_ITCL_NOTFOUND DIRECTORY src/other DEFINITION BRLCAD_ITCL_NOTFOUND)
get_directory_property(BRLCAD_ITK_NOTFOUND DIRECTORY src/other DEFINITION BRLCAD_ITK_NOTFOUND)
if(BRLCAD_ITCL_BUILD AND BRLCAD_ITK_BUILD)
set(BRLCAD_INCRTCL_BUILD ON)
else(BRLCAD_ITCL_BUILD AND BRLCAD_ITK_BUILD)
if(BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
set(BRLCAD_INCRTCL_BUILD "ON (Itcl only)")
endif(BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
if(BRLCAD_ITK_BUILD AND NOT BRLCAD_ITCL_BUILD)
set(BRLCAD_INCRTCL_BUILD "ON (Itk only)")
endif(BRLCAD_ITK_BUILD AND NOT BRLCAD_ITCL_BUILD)
if(NOT BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
if(BRLCAD_ITCL_NOTFOUND OR BRLCAD_ITK_NOTFOUND)
set(BRLCAD_INCRTCL_BUILD "OFF!")
else(BRLCAD_ITCL_NOTFOUND OR BRLCAD_ITK_NOTFOUND)
set(BRLCAD_INCRTCL_BUILD "OFF")
endif(BRLCAD_ITCL_NOTFOUND OR BRLCAD_ITK_NOTFOUND)
endif(NOT BRLCAD_ITCL_BUILD AND NOT BRLCAD_ITK_BUILD)
endif(BRLCAD_ITCL_BUILD AND BRLCAD_ITK_BUILD)
message(" ")
foreach(item ${BUILD_REPORT_ITEMS})
message("${BRLCAD_${item}_BUILD_LABEL} ${BRLCAD_${item}_BUILD}")
endforeach(item ${BUILD_REPORT_ITEMS})
###################################################
# #
# Features #
# #
###################################################
message(" ")
# Note when the word size is automatically set.
if(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
set(BRLCAD_ARCH_BITSETTING "${CMAKE_WORD_SIZE} (Auto)")
else(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
set(BRLCAD_ARCH_BITSETTING "${CMAKE_WORD_SIZE}")
endif(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
###################################################
# #
# Features #
# #
###################################################
foreach(item ${FEATURE_REPORT_ITEMS})
message("${${item}_LABEL} ${${item}}")
endforeach(item ${BUILD_REPORT_ITEMS})
# Note when the word size is automatically set.
if(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
set(BRLCAD_ARCH_BITSETTING "${CMAKE_WORD_SIZE} (Auto)")
else(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
set(BRLCAD_ARCH_BITSETTING "${CMAKE_WORD_SIZE}")
endif(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
message(" ")
foreach(item ${FEATURE_REPORT_ITEMS})
message("${${item}_LABEL} ${${item}}")
endforeach(item ${BUILD_REPORT_ITEMS})
###################################################
# #
# Other reportable items #
# #
###################################################
message(" ")
# Flesh out the extradocs reporting with format information
set(DOCBOOK_FORMATS "")
if(BRLCAD_EXTRADOCS)
if(BRLCAD_EXTRADOCS_HTML)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} html)
endif(BRLCAD_EXTRADOCS_HTML)
if(BRLCAD_EXTRADOCS_PHP)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} php)
endif(BRLCAD_EXTRADOCS_PHP)
if(BRLCAD_EXTRADOCS_PPT)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} html)
endif(BRLCAD_EXTRADOCS_PPT)
if(BRLCAD_EXTRADOCS_MAN)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} man)
endif(BRLCAD_EXTRADOCS_MAN)
if (BRLCAD_EXTRADOCS_PDF)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} pdf)
endif(BRLCAD_EXTRADOCS_PDF)
if(DOCBOOK_FORMATS)
list(REMOVE_DUPLICATES DOCBOOK_FORMATS)
string(REPLACE ";" "/" DOCBOOK_FORMATS "${DOCBOOK_FORMATS}")
set(BRLCAD_DOCBOOK_BUILD "ON (${DOCBOOK_FORMATS})")
else(DOCBOOK_FORMATS)
set(BRLCAD_DOCBOOK_BUILD "ON (All formats disabled)")
endif(DOCBOOK_FORMATS)
else (BRLCAD_EXTRADOCS)
set(BRLCAD_DOCBOOK_BUILD "OFF")
endif (BRLCAD_EXTRADOCS)
###################################################
# #
# Other reportable items #
# #
###################################################
# In multi-configuration builds, some features are
# set at build time instead of configure time.
set(MULTICONFIG_FEATURES "BRLCAD_OPTIMIZED_BUILD")
if(CMAKE_CONFIGURATION_TYPES)
foreach(item ${MULTICONFIG_FEATURES})
set(${item} "Build Configuration Dependent")
endforeach(item ${MULTICONFIG_FEATURES})
endif(CMAKE_CONFIGURATION_TYPES)
# Flesh out the extradocs reporting with format information
set(DOCBOOK_FORMATS "")
if(BRLCAD_EXTRADOCS)
if(BRLCAD_EXTRADOCS_HTML)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} html)
endif(BRLCAD_EXTRADOCS_HTML)
if(BRLCAD_EXTRADOCS_PHP)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} php)
endif(BRLCAD_EXTRADOCS_PHP)
if(BRLCAD_EXTRADOCS_PPT)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} html)
endif(BRLCAD_EXTRADOCS_PPT)
if(BRLCAD_EXTRADOCS_MAN)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} man)
endif(BRLCAD_EXTRADOCS_MAN)
if (BRLCAD_EXTRADOCS_PDF)
set(DOCBOOK_FORMATS ${DOCBOOK_FORMATS} pdf)
endif(BRLCAD_EXTRADOCS_PDF)
if(DOCBOOK_FORMATS)
list(REMOVE_DUPLICATES DOCBOOK_FORMATS)
string(REPLACE ";" "/" DOCBOOK_FORMATS "${DOCBOOK_FORMATS}")
set(BRLCAD_DOCBOOK_BUILD "ON (${DOCBOOK_FORMATS})")
else(DOCBOOK_FORMATS)
set(BRLCAD_DOCBOOK_BUILD "ON (All formats disabled)")
endif(DOCBOOK_FORMATS)
else (BRLCAD_EXTRADOCS)
set(BRLCAD_DOCBOOK_BUILD "OFF")
endif (BRLCAD_EXTRADOCS)
foreach(item ${OTHER_REPORT_ITEMS})
message("${${item}_LABEL} ${${item}}")
endforeach(item ${BUILD_REPORT_ITEMS})
# In multi-configuration builds, some features are
# set at build time instead of configure time.
set(MULTICONFIG_FEATURES "BRLCAD_OPTIMIZED_BUILD")
if(CMAKE_CONFIGURATION_TYPES)
foreach(item ${MULTICONFIG_FEATURES})
set(${item} "Build Configuration Dependent")
endforeach(item ${MULTICONFIG_FEATURES})
endif(CMAKE_CONFIGURATION_TYPES)
message(" ")
foreach(item ${OTHER_REPORT_ITEMS})
message("${${item}_LABEL} ${${item}}")
endforeach(item ${BUILD_REPORT_ITEMS})
message(" ")
endfunction(BRLCAD_Summary)
# Local Variables:
# tab-width: 8
+382 -399
View File
@@ -39,49 +39,13 @@ include(CMakeParseArguments)
# When defining targets, we need to know if we have a no-error flag
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
check_c_compiler_flag(-Wno-error NOERROR_FLAG_C)
check_cxx_compiler_flag(-Wno-error NOERROR_FLAG_CXX)
# Take a target definition and find out what definitions its libraries
# are using
macro(GET_TARGET_DEFINES targetname target_libs)
# Take care of compile flags and definitions
foreach(libitem ${target_libs})
list(FIND BRLCAD_LIBS ${libitem} FOUNDIT)
if(NOT ${FOUNDIT} STREQUAL "-1")
get_property(${libitem}_DEFINES GLOBAL PROPERTY ${libitem}_DEFINES)
list(APPEND ${targetname}_DEFINES ${${libitem}_DEFINES})
if(${targetname}_DEFINES)
list(REMOVE_DUPLICATES ${targetname}_DEFINES)
endif(${targetname}_DEFINES)
endif(NOT ${FOUNDIT} STREQUAL "-1")
endforeach(libitem ${target_libs})
endmacro(GET_TARGET_DEFINES)
# Take a target definition and find out what its libraries
# are supplying in the way of DLL definitions.
macro(GET_TARGET_DLL_DEFINES targetname target_libs)
if(CPP_DLL_DEFINES)
# In case of re-running cmake, make sure the DLL_IMPORTS define
# for this specific library is removed, since for the actual target
# we need to export, not import.
get_property(${targetname}_DLL_DEFINES GLOBAL PROPERTY ${targetname}_DLL_DEFINES)
if(${targetname}_DLL_DEFINES)
list(REMOVE_ITEM ${targetname}_DLL_DEFINES ${targetname}_DLL_IMPORTS)
endif(${targetname}_DLL_DEFINES)
foreach(libitem ${target_libs})
list(FIND BRLCAD_LIBS ${libitem} FOUNDIT)
if(NOT ${FOUNDIT} STREQUAL "-1")
get_property(${libitem}_DLL_DEFINES GLOBAL PROPERTY ${libitem}_DLL_DEFINES)
list(APPEND ${targetname}_DLL_DEFINES ${${libitem}_DLL_DEFINES})
if(${targetname}_DLL_DEFINES)
list(REMOVE_DUPLICATES ${targetname}_DLL_DEFINES)
endif(${targetname}_DLL_DEFINES)
endif(NOT ${FOUNDIT} STREQUAL "-1")
endforeach(libitem ${target_libs})
endif(CPP_DLL_DEFINES)
endmacro(GET_TARGET_DLL_DEFINES)
# For BRL-CAD targets, use CXX as the language if the user requests it
macro(SET_CXX_LANG SRC_FILES)
function(SET_LANG_CXX SRC_FILES)
if(ENABLE_ALL_CXX_COMPILE)
foreach(srcfile ${SRC_FILES})
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}" MATCHES "src/other")
@@ -91,80 +55,27 @@ macro(SET_CXX_LANG SRC_FILES)
endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}" MATCHES "src/other")
endforeach(srcfile ${SRC_FILES})
endif(ENABLE_ALL_CXX_COMPILE)
endmacro(SET_CXX_LANG SRC_FILES)
endfunction(SET_LANG_CXX SRC_FILES)
# Take a target definition and find out what compilation flags its libraries
# are using
macro(GET_TARGET_FLAGS targetname target_libs)
set(FLAG_LANGUAGES C CXX)
foreach(lang ${FLAG_LANGUAGES})
get_property(${targetname}_${lang}_FLAGS GLOBAL PROPERTY ${targetname}_${lang}_FLAGS)
foreach(libitem ${target_libs})
list(FIND BRLCAD_LIBS ${libitem} FOUNDIT)
if(NOT ${FOUNDIT} STREQUAL "-1")
get_property(${libitem}_${lang}_FLAGS GLOBAL PROPERTY ${libitem}_${lang}_FLAGS)
list(APPEND ${targetname}_${lang}_FLAGS ${${libitem}_${lang}_FLAGS})
endif(NOT ${FOUNDIT} STREQUAL "-1")
endforeach(libitem ${target_libs})
if(${targetname}_${lang}_FLAGS)
list(REMOVE_DUPLICATES ${targetname}_${lang}_FLAGS)
endif(${targetname}_${lang}_FLAGS)
set_property(GLOBAL PROPERTY ${targetname}_${lang}_FLAGS "${${targetname}_${lang}_FLAGS}")
mark_as_advanced(${targetname}_${lang}_FLAGS)
endforeach(lang ${FLAG_LANGUAGES})
endmacro(GET_TARGET_FLAGS)
# BRL-CAD style checking with AStyle
function(VALIDATE_STYLE targetname srcslist)
# When a build target source file list contains files that are NOT all
# one language, we need to apply flags on a per-file basis
macro(FLAGS_TO_FILES srcslist targetname)
foreach(srcfile ${srcslist})
get_property(file_language SOURCE ${srcfile} PROPERTY LANGUAGE)
if(NOT file_language)
get_filename_component(srcfile_ext ${srcfile} EXT)
if(${srcfile_ext} STREQUAL ".cxx" OR ${srcfile_ext} STREQUAL ".cpp" OR ${srcfile_ext} STREQUAL ".cc")
set(file_language CXX)
endif(${srcfile_ext} STREQUAL ".cxx" OR ${srcfile_ext} STREQUAL ".cpp" OR ${srcfile_ext} STREQUAL ".cc")
if(${srcfile_ext} STREQUAL ".c")
set(file_language C)
endif(${srcfile_ext} STREQUAL ".c")
endif(NOT file_language)
if(file_language)
foreach(lib_flag ${${targetname}_${file_language}_FLAGS})
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS "${lib_flag}")
endforeach(lib_flag ${${targetname}_${file_language}_FLAGS})
endif(file_language)
if("${file_language}" STREQUAL "C" AND NOT "${C_INLINE}" STREQUAL "inline")
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_DEFINITIONS "inline=${C_INLINE}")
endif("${file_language}" STREQUAL "C" AND NOT "${C_INLINE}" STREQUAL "inline")
endforeach(srcfile ${srcslist})
endmacro(FLAGS_TO_FILES)
if(BRLCAD_STYLE_VALIDATE AND ASTYLE_EXECUTABLE AND NOT "${srcslist}" STREQUAL "")
# Handle C++ NO_STRICT settings
macro(CXX_NO_STRICT cxx_srcslist)
CHECK_CXX_COMPILER_FLAG(-Wno-error NOERROR_FLAG_CXX)
if(NOERROR_FLAG_CXX AND BRLCAD_ENABLE_STRICT)
foreach(srcfile ${cxx_srcslist})
get_filename_component(srcfile_ext ${srcfile} EXT)
if(${srcfile_ext} STREQUAL ".cxx" OR ${srcfile_ext} STREQUAL ".cpp" OR ${srcfile_ext} STREQUAL ".cc")
get_property(previous_flags SOURCE ${srcfile} PROPERTY COMPILE_FLAGS)
set_source_files_properties(${srcfile} COMPILE_FLAGS "${previous_flags} -Wno-error")
endif()
endforeach(srcfile ${cxx_srcslist})
endif(NOERROR_FLAG_CXX AND BRLCAD_ENABLE_STRICT)
endmacro(CXX_NO_STRICT cxx_srcslist)
# BRL-CAD style checking test
function(VALIDATE_STYLE srcslist targetname)
if(BRLCAD_STYLE_VALIDATE)
# Find out of any of the files need to be ignored
set(fullpath_srcslist)
foreach(srcfile ${srcslist})
get_property(IGNORE_FILE SOURCE ${srcfile} PROPERTY EXTERNAL DEFINED)
message("${srcfile} external: ${IGNORE_FILE}")
if(NOT IGNORE_FILE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
set(fullpath_srcslist ${fullpath_srcslist} "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
endif(NOT IGNORE_FILE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
get_property(IGNORE_FILE SOURCE ${srcfile} PROPERTY EXTERNAL)
if(IGNORE_FILE)
message("Note: skipping style validation on external file ${srcfile}")
else(IGNORE_FILE)
set(fullpath_srcslist ${fullpath_srcslist} "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
endif(IGNORE_FILE)
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
endforeach(srcfile ${srcslist})
# If we have a list that isn't empty, use it
if(fullpath_srcslist)
add_custom_command(
TARGET ${targetname} PRE_LINK
@@ -176,49 +87,268 @@ function(VALIDATE_STYLE srcslist targetname)
endif(TARGET astyle)
endif(fullpath_srcslist)
endif(BRLCAD_STYLE_VALIDATE)
endif(BRLCAD_STYLE_VALIDATE AND ASTYLE_EXECUTABLE AND NOT "${srcslist}" STREQUAL "")
endfunction(VALIDATE_STYLE)
# Determine if a given file is a C or C++ file
function(FILE_LANG sfile outvar)
if("${srcfile}" MATCHES "<TARGET_OBJECTS:")
set(${outvar} "" PARENT_SCOPE)
return()
endif("${srcfile}" MATCHES "<TARGET_OBJECTS:")
# Try property first
get_property(file_language SOURCE ${srcfile} PROPERTY LANGUAGE)
# If that doesn't work, go with extension
if(NOT file_language)
get_filename_component(srcfile_ext ${srcfile} EXT)
string(SUBSTRING "${srcfile_ext}" 1 -1 f_ext)
while(NOT "${f_ext}" STREQUAL "")
get_filename_component(f_ext ${f_ext} EXT)
if(f_ext)
set(srcfile_ext ${f_ext})
string(SUBSTRING "${f_ext}" 1 -1 f_ext)
endif(f_ext)
endwhile(NOT "${f_ext}" STREQUAL "")
# C++
if(${srcfile_ext} STREQUAL ".cxx" OR ${srcfile_ext} STREQUAL ".cpp" OR ${srcfile_ext} STREQUAL ".cc")
set(file_language CXX)
endif(${srcfile_ext} STREQUAL ".cxx" OR ${srcfile_ext} STREQUAL ".cpp" OR ${srcfile_ext} STREQUAL ".cc")
if(${srcfile_ext} STREQUAL ".hxx" OR ${srcfile_ext} STREQUAL ".hpp" OR ${srcfile_ext} STREQUAL ".hh")
set(file_language CXX)
endif(${srcfile_ext} STREQUAL ".hxx" OR ${srcfile_ext} STREQUAL ".hpp" OR ${srcfile_ext} STREQUAL ".hh")
# C
if(${srcfile_ext} STREQUAL ".c" OR ${srcfile_ext} STREQUAL ".h")
set(file_language C)
endif(${srcfile_ext} STREQUAL ".c" OR ${srcfile_ext} STREQUAL ".h")
# If we can't figure it out, assume C...
if(NOT file_language)
message(WARNING "Can't determine the source language of ${sfile}, assuming C...")
set(file_language C)
endif(NOT file_language)
endif(NOT file_language)
set(${outvar} "${file_language}" PARENT_SCOPE)
endfunction(FILE_LANG)
# Assemble the targets and compilation flags needed by the target
function(GET_FLAGS_AND_DEFINITIONS targetname target_libs)
cmake_parse_arguments(G "" "CFLAGS;CXXFLAGS;DEFINES;DLL_DEFINES" "" ${ARGN})
#####################################################################
# Compile flags - note that targets may have separate C and C++ flags
if(G_CFLAGS OR G_CXXFLAGS)
set(FLAG_LANGUAGES C CXX)
foreach(slang ${FLAG_LANGUAGES})
# If we've already got some flags assigned to this target, pull them in
get_property(T_FLAGS GLOBAL PROPERTY ${targetname}_${lang}_FLAGS)
# Get all the flags from all the associated libraries
foreach(libitem ${target_libs})
get_property(ITEM_FLAGS GLOBAL PROPERTY ${libitem}_${lang}_FLAGS)
list(APPEND T_FLAGS ${${libitem}_${lang}_FLAGS})
endforeach(libitem ${target_libs})
# If we've got anything, scrub down to unique entries
if(T_FLAGS)
list(REMOVE_DUPLICATES T_FLAGS)
endif(T_FLAGS)
# Put the results back into the global target
set_property(GLOBAL PROPERTY ${targetname}_${lang}_FLAGS "${T_FLAGS}")
# Set the language specific flag variables
if("${slang}" STREQUAL "C")
set(T_C_FLAGS "${T_FLAGS}")
endif("${slang}" STREQUAL "C")
if("${slang}" STREQUAL "CXX")
set(T_CXX_FLAGS "${T_FLAGS}")
endif("${slang}" STREQUAL "CXX")
endforeach(slang ${FLAG_LANGUAGES})
if(G_CFLAGS)
set(${G_CFLAGS} ${T_C_FLAGS} PARENT_SCOPE)
endif(G_CFLAGS)
if(G_CXXFLAGS)
set(${G_CXXFLAGS} ${T_CXX_FLAGS} PARENT_SCOPE)
endif(G_CXXFLAGS)
endif(G_CFLAGS OR G_CXXFLAGS)
#############################################################
# Compilation definitions (common to all source files)
if(G_DEFINES)
get_property(T_DEFINES GLOBAL PROPERTY ${targetname}_DEFINES)
foreach(libitem ${target_libs})
get_property(${libitem}_DEFINES GLOBAL PROPERTY ${libitem}_DEFINES)
list(APPEND T_DEFINES ${${libitem}_DEFINES})
endforeach(libitem ${target_libs})
# No duplicate definitions needed
if(T_DEFINES)
list(REMOVE_DUPLICATES T_DEFINES)
endif(T_DEFINES)
# Send the finalized list back to the parent
set(${G_DEFINES} ${T_DEFINES} PARENT_SCOPE)
endif(G_DEFINES)
# DLL defines (needed for Visual Studio import/export)
if(G_DLL_DEFINES)
get_property(T_DLL_DEFINES GLOBAL PROPERTY ${targetname}_DLL_DEFINES)
foreach(libitem ${target_libs})
get_property(${libitem}_DLL_DEFINES GLOBAL PROPERTY ${libitem}_DLL_DEFINES)
list(APPEND T_DLL_DEFINES ${${libitem}_DLL_DEFINES})
endforeach(libitem ${target_libs})
# In case of re-running cmake, make sure the DLL_IMPORTS define for this
# specific target is removed if the target looks like a library, since for
# the actual library target we need to export, not import. (Don't want to
# do this willy-nilly, since (for example) the rt exec target and the librt
# library will both map to the same "UPPER_CORE" name...)
if(T_DLL_DEFINES AND ${targetname} MATCHES "^lib*")
string(REPLACE "lib" "" LOWERCORE "${targetname}")
string(TOUPPER ${LOWERCORE} UPPER_CORE)
list(REMOVE_ITEM T_DLL_DEFINES ${UPPER_CORE}_DLL_IMPORTS)
endif(T_DLL_DEFINES AND ${targetname} MATCHES "^lib*")
# No duplicate definitions needed
if(T_DLL_DEFINES)
list(REMOVE_DUPLICATES T_DLL_DEFINES)
endif(T_DLL_DEFINES)
# Send the finalized list back to the parent
set(${G_DLL_DEFINES} ${T_DLL_DEFINES} PARENT_SCOPE)
endif(G_DLL_DEFINES)
endfunction(GET_FLAGS_AND_DEFINITIONS)
# Determine the language for a target
# For simplicity, always set compile definitions and compile flags on files rather
# than build targets (less logic, simplifies dealing with OBJECT libraries.)
# TODO - remove duplicates, which may occur if more than one target uses the same
# source file (i.e. rt, rtweight, etc...)
function(SET_FLAGS_AND_DEFINITIONS srcslist)
cmake_parse_arguments(S "NO_STRICT_CXX" "TARGET" "CFLAGS;CXXFLAGS;DEFINES;DLL_DEFINES" ${ARGN})
foreach(srcfile ${srcslist})
# Defines apply across C/C++
foreach(tdef ${S_DEFINES})
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_DEFINITIONS "${tdef}")
endforeach(tdef ${S_DEFINES})
# C or C++?
FILE_LANG("${srcfile}" flang)
# Handle C files
if("${file_language}" STREQUAL "C")
foreach(tflag ${S_CFLAGS})
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS "${tflag}")
endforeach(tflag ${S_CFLAGS})
# Handle inline definition for C files only
if(NOT "${C_INLINE}" STREQUAL "inline")
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_DEFINITIONS "inline=${C_INLINE}")
endif(NOT "${C_INLINE}" STREQUAL "inline")
# Handle disabling of strict compilation if target requires that
if(S_NO_STRICT AND NOERROR_FLAG AND BRLCAD_ENABLE_STRICT)
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif(S_NO_STRICT AND NOERROR_FLAG AND BRLCAD_ENABLE_STRICT)
endif("${file_language}" STREQUAL "C")
# Handle C++ files
if("${file_language}" STREQUAL "C++")
foreach(tflag ${S_CXXFLAGS})
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS "${tflag}")
endforeach(tflag ${S_CXXFLAGS})
# Handle disabling of strict compilation if target requires that
if( (S_NO_STRICT OR _S_NO_STRICT_CXX) AND NOERROR_FLAG_CXX AND BRLCAD_ENABLE_STRICT)
set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif( (S_NO_STRICT OR _S_NO_STRICT_CXX) AND NOERROR_FLAG_CXX AND BRLCAD_ENABLE_STRICT)
endif("${file_language}" STREQUAL "C++")
endforeach(srcfile ${srcslist})
# If we have been supplied a target name, set the appropriate properties.
if(S_TARGET)
set_property(GLOBAL PROPERTY ${S_TARGET}_DEFINES "${S_DEFINES}")
if(S_DLL_DEFINES)
# Make sure we append here, since the target will probably already have this property set.
set_property(GLOBAL APPEND PROPERTY ${S_TARGET}_DLL_DEFINES "${S_DLL_DEFINES}")
foreach(tdef ${S_DLL_DEFINES})
set_property(TARGET ${S_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "${tdef}")
endforeach(tdef ${S_DLL_DEFINES})
endif(S_DLL_DEFINES)
endif(S_TARGET)
endfunction(SET_FLAGS_AND_DEFINITIONS)
#-----------------------------------------------------------------------------
# Core routines for adding executables and libraries to the build and
# install lists of CMake
macro(BRLCAD_ADDEXEC execname srcslist libslist)
function(BRLCAD_ADDEXEC execname srcslist libslist)
string(TOUPPER "${execname}" EXECNAME_UPPER)
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${EXECNAME_UPPER} "TEST;NO_INSTALL;NO_STRICT;NO_STRICT_CXX;GUI" "FOLDER" "" ${ARGN})
endif(${ARGC} GREATER 3)
cmake_parse_arguments(E "TEST;NO_INSTALL;NO_STRICT;NO_STRICT_CXX;GUI" "FOLDER" "" ${ARGN})
# Go all C++ if the settings request it
SET_CXX_LANG("${srcslist}")
SET_LANG_CXX("${srcslist}")
# Call standard CMake commands
if(${EXECNAME_UPPER}_GUI)
# Add the executable. If the caller indicates this is a GUI type executable,
# add the correct flag for Visual Studio building (where it matters)
if(E_GUI)
add_executable(${execname} WIN32 ${srcslist})
else(${EXECNAME_UPPER}_GUI)
else(E_GUI)
add_executable(${execname} ${srcslist})
endif(${EXECNAME_UPPER}_GUI)
target_link_libraries(${execname} ${libslist})
endif(E_GUI)
# Check at comple time the standard BRL-CAD style rules
VALIDATE_STYLE("${srcslist}" "${execname}")
# Let CMAKEFILES know what's going on
CMAKEFILES(${srcslist})
# Check at compile time the standard BRL-CAD style rules
VALIDATE_STYLE("${execname}" "${srcslist}")
# Set the FOLDER property. If the target has supplied a folder, use
# that as a subfolder
set(SUBFOLDER "${${EXECNAME_UPPER}_FOLDER}")
if(${EXECNAME_UPPER}_NO_INSTALL AND "${SUBFOLDER}" STREQUAL "")
set(SUBFOLDER "Build Only")
endif(${EXECNAME_UPPER}_NO_INSTALL AND "${SUBFOLDER}" STREQUAL "")
if(${EXECNAME_UPPER}_TEST AND "${SUBFOLDER}" STREQUAL "")
set(SUBFOLDER "Test Programs")
endif(${EXECNAME_UPPER}_TEST AND "${SUBFOLDER}" STREQUAL "")
# Use the list of libraries to be linked into this target to
# accumulate the necessary definitions and compilation flags.
GET_FLAGS_AND_DEFINITIONS(${execname} "${libslist}" CFLAGS E_C_FLAGS CXXFLAGS E_CXX_FLAGS DEFINES E_DEFINES DLL_DEFINES E_DLL_DEFINES)
if("${SUBFOLDER}" STREQUAL "")
set_target_properties(${execname} PROPERTIES FOLDER "BRL-CAD Executables")
else("${SUBFOLDER}" STREQUAL "")
set_target_properties(${execname} PROPERTIES FOLDER "BRL-CAD Executables/${SUBFOLDER}")
endif("${SUBFOLDER}" STREQUAL "")
# Having built up the necessary sets, apply them
SET_FLAGS_AND_DEFINITIONS("${srcslist}" TARGET ${execname} CFLAGS "${E_C_FLAGS}" CXXFLAGS "${E_CXX_FLAGS}" DEFINES "${E_DEFINES}" DLL_DEFINES "${E_DLL_DEFINES}")
# If we have libraries to link, link them.
if(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
target_link_libraries(${execname} ${libslist})
endif(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
# In some situations (usually test executables) we want to be able
# to force the executable to remain in the local compilation
@@ -227,7 +357,9 @@ macro(BRLCAD_ADDEXEC execname srcslist libslist)
# If an executable isn't to be installed or needs to be installed
# somewhere other than the default location, the NO_INSTALL argument
# bypasses the standard install command call.
if(${EXECNAME_UPPER}_NO_INSTALL OR ${EXECNAME_UPPER}_TEST)
#
# If we *are* installing, do so to the binary directory (BIN_DIR)
if(E_NO_INSTALL OR E_TEST)
# Unfortunately, we currently need Windows binaries in the same directories as their DLL libraries
if(NOT WIN32)
if(NOT CMAKE_CONFIGURATION_TYPES)
@@ -239,284 +371,132 @@ macro(BRLCAD_ADDEXEC execname srcslist libslist)
endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
endif(NOT CMAKE_CONFIGURATION_TYPES)
endif(NOT WIN32)
else(${EXECNAME_UPPER}_NO_INSTALL OR ${EXECNAME_UPPER}_TEST)
else(E_NO_INSTALL OR E_TEST)
install(TARGETS ${execname} DESTINATION ${BIN_DIR})
endif(${EXECNAME_UPPER}_NO_INSTALL OR ${EXECNAME_UPPER}_TEST)
endif(E_NO_INSTALL OR E_TEST)
# Use the list of libraries to be linked into this target to
# accumulate the necessary definitions and compilation flags.
GET_TARGET_DEFINES(${execname} "${libslist}")
# For DLL libraries, we may need additional flags
GET_TARGET_DLL_DEFINES(${execname} "${libslist}")
GET_TARGET_FLAGS(${execname} "${libslist}")
# Find out if we have C, C++, or both
SRCS_LANG("${srcslist}" exec_type ${execname})
# Set the folder property (used in programs such as Visual Studio to organize
# build targets.
if(E_NO_INSTALL AND NOT E_FOLDER)
set(SUBFOLDER "/Build Only")
endif(E_NO_INSTALL AND NOT E_FOLDER)
if(E_TEST AND NOT E_FOLDER AND NOT SUBFOLDER)
set(SUBFOLDER "/Test Programs")
endif(E_TEST AND NOT E_FOLDER AND NOT SUBFOLDER)
if(E_FOLDER)
set(SUBFOLDER "/${E_FOLDER}")
endif(E_FOLDER)
set_target_properties(${execname} PROPERTIES FOLDER "BRL-CAD Executables${SUBFOLDER}")
# Add the definitions
foreach(lib_define ${${execname}_DEFINES})
set_property(TARGET ${execname} APPEND PROPERTY COMPILE_DEFINITIONS "${lib_define}")
endforeach(lib_define ${${execname}_DEFINES})
foreach(lib_define ${${execname}_DLL_DEFINES})
set_property(TARGET ${execname} APPEND PROPERTY COMPILE_DEFINITIONS "${lib_define}")
endforeach(lib_define ${${execname}_DLL_DEFINES})
# If we have a mixed language exec, pass on the flags to
# the source files - otherwise, use the target.
if(${exec_type} STREQUAL "MIXED")
FLAGS_TO_FILES("${srcslist}" ${execname})
else(${exec_type} STREQUAL "MIXED")
# All one language - we can apply the flags to the target
foreach(lib_flag ${${execname}_${exec_type}_FLAGS})
set_property(TARGET ${execname} APPEND PROPERTY COMPILE_FLAGS "${lib_flag}")
endforeach(lib_flag ${${execname}_${exec_type}_FLAGS})
if(NOT "${C_INLINE}" STREQUAL "inline" AND "${exec_type}" STREQUAL "C")
set_property(TARGET ${execname} APPEND PROPERTY COMPILE_DEFINITIONS "inline=${C_INLINE}")
endif(NOT "${C_INLINE}" STREQUAL "inline" AND "${exec_type}" STREQUAL "C")
endif(${exec_type} STREQUAL "MIXED")
# If this target is marked as incompatible with the strict flags, disable them
if(${exec_type} STREQUAL "C" AND BRLCAD_ENABLE_STRICT AND ${EXECNAME_UPPER}_NO_STRICT)
CHECK_C_COMPILER_FLAG(-Wno-error NOERROR_FLAG)
if(NOERROR_FLAG)
set_property(TARGET ${execname} APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif(NOERROR_FLAG)
endif(${exec_type} STREQUAL "C" AND BRLCAD_ENABLE_STRICT AND ${EXECNAME_UPPER}_NO_STRICT)
if(${exec_type} STREQUAL "CXX" AND BRLCAD_ENABLE_STRICT)
if(${EXECNAME_UPPER}_NO_STRICT_CXX OR ${EXECNAME_UPPER}_NO_STRICT)
CHECK_CXX_COMPILER_FLAG(-Wno-error NOERROR_FLAG_CXX)
if(NOERROR_FLAG_CXX)
set_property(TARGET ${execname} APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif(NOERROR_FLAG_CXX)
endif(${EXECNAME_UPPER}_NO_STRICT_CXX OR ${EXECNAME_UPPER}_NO_STRICT)
endif(${exec_type} STREQUAL "CXX" AND BRLCAD_ENABLE_STRICT)
# C++ is handled separately (on a per-file basis) if we have mixed sources via the NO_STRICT_CXX flag
if(${exec_type} STREQUAL "MIXED" AND ${EXECNAME_UPPER}_NO_STRICT_CXX)
CXX_NO_STRICT("${srcslist}")
endif(${exec_type} STREQUAL "MIXED" AND ${EXECNAME_UPPER}_NO_STRICT_CXX)
endmacro(BRLCAD_ADDEXEC execname srcslist libslist)
endfunction(BRLCAD_ADDEXEC execname srcslist libslist)
#-----------------------------------------------------------------------------
# Library macro handles both shared and static libs, so one "BRLCAD_ADDLIB"
# Library function handles both shared and static libs, so one "BRLCAD_ADDLIB"
# statement will cover both automatically
macro(BRLCAD_ADDLIB libname srcslist libslist)
function(BRLCAD_ADDLIB libname srcslist libslist)
string(TOUPPER "${libname}" LIBNAME_UPPER)
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${LIBNAME_UPPER} "SHARED;STATIC;NO_INSTALL;NO_STRICT;NO_STRICT_CXX" "FOLDER" "SO_SRCS;STATIC_SRCS" ${ARGN})
endif(${ARGC} GREATER 3)
cmake_parse_arguments(L "SHARED;STATIC;NO_INSTALL;NO_STRICT;NO_STRICT_CXX" "FOLDER" "SHARED_SRCS;STATIC_SRCS" ${ARGN})
set(all_srcs ${srcslist} ${${LIBNAME_UPPER}_SO_SRCS} ${${LIBNAME_UPPER}_STATIC_SRCS})
# Let CMAKEFILES know what's going on
CMAKEFILES(${srcslist} ${L_SHARED_SRCS} ${L_STATIC_SRCS})
# Go all C++ if the settings request it
SET_CXX_LANG("${all_srcs}")
SET_LANG_CXX("${srcslist};${L_SHARED_SRCS};${L_STATIC_SRCS}")
# Add ${libname} to the list of BRL-CAD libraries
list(APPEND BRLCAD_LIBS ${libname})
list(REMOVE_DUPLICATES BRLCAD_LIBS)
set(BRLCAD_LIBS "${BRLCAD_LIBS}" CACHE STRING "BRL-CAD libraries" FORCE)
# Retrieve the build flags and definitions
GET_FLAGS_AND_DEFINITIONS(${libname} "${libslist}"
CFLAGS L_C_FLAGS
CXXFLAGS L_CXX_FLAGS
DEFINES L_DEFINES
DLL_DEFINES L_DLL_DEFINES
)
# Collect the definitions and flags needed by this library
GET_TARGET_DEFINES(${libname} "${libslist}")
# For DLL libraries, we may need additional flags
GET_TARGET_DLL_DEFINES(${libname} "${libslist}")
GET_TARGET_FLAGS(${libname} "${libslist}")
# Local copy of srcslist in case manipulation is needed
set(lsrcslist ${srcslist})
# Find out if we have C, C++, or both
SRCS_LANG("${all_srcs}" lib_type ${libname})
# If we're going to have a specified subfolder, prepare the appropriate string:
if(L_FOLDER)
set(SUBFOLDER "/${L_FOLDER}")
endif(L_FOLDER)
# If we have a mixed language library, go ahead and pass on the flags to
# the source files - we don't need the targets defined since the flags
# will be managed per-source-file.
if(${lib_type} STREQUAL "MIXED")
FLAGS_TO_FILES("${all_srcs}" ${libname})
endif(${lib_type} STREQUAL "MIXED")
# If we need it, set up the OBJECT library build
if(USE_OBJECT_LIBS)
add_library(${libname}-obj OBJECT ${lsrcslist})
set(lsrcslist $<TARGET_OBJECTS:${libname}-obj>)
set_target_properties(${libname}-obj PROPERTIES FOLDER "BRL-CAD OBJECT Libraries${SUBFOLDER}")
endif(USE_OBJECT_LIBS)
# Handle "shared" libraries (with MSVC, these would be dynamic libraries)
if((NOT ${LIBNAME_UPPER}_STATIC) AND (BUILD_SHARED_LIBS OR ${LIBNAME_UPPER}_SHARED))
set(so_srcs ${srcslist} ${${LIBNAME_UPPER}_SO_SRCS})
add_library(${libname} SHARED ${so_srcs})
# Check at comple time the standard BRL-CAD style rules
VALIDATE_STYLE("${so_srcs}" "${libname}")
# Set the FOLDER property. If the target has supplied a folder, use
# that as a subfolder
if("${${LIBNAME_UPPER}_FOLDER}" STREQUAL "")
set_target_properties(${libname} PROPERTIES FOLDER "BRL-CAD Shared Libraries")
else("${${LIBNAME_UPPER}_FOLDER}" STREQUAL "")
set_target_properties(${libname} PROPERTIES FOLDER "BRL-CAD Shared Libraries/${${LIBNAME_UPPER}_FOLDER}")
endif("${${LIBNAME_UPPER}_FOLDER}" STREQUAL "")
# Make sure we don't end up with outputs named liblib...
if(${libname} MATCHES "^lib*")
set_target_properties(${libname} PROPERTIES PREFIX "")
endif(${libname} MATCHES "^lib*")
# Generate the upper case abbreviation of the library that is used for
# DLL definitions. If We are using DLLs, we need to define export
# for this library.
if(L_SHARED OR (BUILD_SHARED_LIBS AND NOT L_STATIC))
add_library(${libname} SHARED ${lsrcslist} ${L_SHARED_SRCS})
if(CPP_DLL_DEFINES)
string(REPLACE "lib" "" LOWERCORE "${libname}")
string(TOUPPER ${LOWERCORE} UPPER_CORE)
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_DEFINITIONS "${UPPER_CORE}_DLL_EXPORTS")
set_property(GLOBAL APPEND PROPERTY ${libname}_DLL_DEFINES "${UPPER_CORE}_DLL_IMPORTS")
endif(CPP_DLL_DEFINES)
endif(L_SHARED OR (BUILD_SHARED_LIBS AND NOT L_STATIC))
# If we have libraries to link, link them.
if(L_STATIC OR (BUILD_STATIC_LIBS AND NOT L_SHARED))
if(L_STATIC)
set(libstatic ${libname})
else(L_STATIC)
set(libstatic ${libname}-static)
endif(L_STATIC)
add_library(${libstatic} STATIC ${lsrcslist} ${L_STATIC_SRCS})
if(NOT CPP_DLL_DEFINES)
set_target_properties(${libstatic} PROPERTIES OUTPUT_NAME "${libname}")
endif(NOT CPP_DLL_DEFINES)
endif(L_STATIC OR (BUILD_STATIC_LIBS AND NOT L_SHARED))
# Make sure we don't end up with outputs named liblib...
set(possible_targets ${libname} ${libname}-static)
foreach(pt ${possible_targets})
if(TARGET ${pt} AND ${pt} MATCHES "^lib*")
set_target_properties(${pt} PROPERTIES PREFIX "")
endif(TARGET ${pt} AND ${pt} MATCHES "^lib*")
endforeach(pt ${possible_targets})
# Now that we have both the sources lists and the build targets, assign flags
SET_FLAGS_AND_DEFINITIONS("${srcslist};${L_SHARED_SRCS};${L_STATIC_SRCS}"
TARGET ${libname}
CFLAGS "${L_C_FLAGS}"
CXXFLAGS "${L_CXX_FLAGS}"
DEFINES "${L_DEFINES}"
DLL_DEFINES "${L_DLL_DEFINES}"
)
# Extra static lib specific work
if(L_STATIC OR (BUILD_STATIC_LIBS AND NOT L_SHARED))
set_target_properties(${libstatic} PROPERTIES FOLDER "BRL-CAD Static Libraries${SUBFOLDER}")
VALIDATE_STYLE("${libstatic}" "${srcslist};${L_STATIC_SRCS}")
if(NOT L_NO_INSTALL)
install(TARGETS ${libstatic}
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR})
endif(NOT L_NO_INSTALL)
endif(L_STATIC OR (BUILD_STATIC_LIBS AND NOT L_SHARED))
# Extra shared lib specific work
if(L_SHARED OR (BUILD_SHARED_LIBS AND NOT L_STATIC))
set_target_properties(${libname} PROPERTIES FOLDER "BRL-CAD Shared Libraries${SUBFOLDER}")
VALIDATE_STYLE("${libname}" "${srcslist};${L_SHARED_SRCS}")
# If we have libraries to link for a shared library, link them.
if(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
target_link_libraries(${libname} ${libslist})
endif(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
# If a library isn't to be installed or needs to be installed
# somewhere other than the default location, the NO_INSTALL argument
# bypasses the standard install command call. Otherwise, call install
# with standard arguments.
if(NOT ${LIBNAME_UPPER}_NO_INSTALL)
if(NOT L_NO_INSTALL)
install(TARGETS ${libname}
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR})
endif(NOT ${LIBNAME_UPPER}_NO_INSTALL)
endif(NOT L_NO_INSTALL)
endif(L_SHARED OR (BUILD_SHARED_LIBS AND NOT L_STATIC))
# Apply the definitions.
foreach(lib_define ${${libname}_DEFINES})
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_DEFINITIONS "${lib_define}")
endforeach(lib_define ${${libname}_DEFINES})
# If we're building a DLL, also apply the DLL definitions
foreach(lib_define ${${libname}_DLL_DEFINES})
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_DEFINITIONS "${lib_define}")
endforeach(lib_define ${${libname}_DLL_DEFINES})
# If we haven't already taken care of the flags on a per-file basis,
# apply them to the target now that we have one.
if(NOT ${lib_type} STREQUAL "MIXED")
# All one language - we can apply the flags to the target
foreach(lib_flag ${${libname}_${lib_type}_FLAGS})
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_FLAGS "${lib_flag}")
endforeach(lib_flag ${${libname}_${lib_type}_FLAGS})
if(NOT "${C_INLINE}" STREQUAL "inline" AND "${lib_type}" STREQUAL "C")
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_DEFINITIONS "inline=${C_INLINE}")
endif(NOT "${C_INLINE}" STREQUAL "inline" AND "${lib_type}" STREQUAL "C")
endif(NOT ${lib_type} STREQUAL "MIXED")
# If we can't build this library strict, add the -Wno-error flag
if(${lib_type} STREQUAL "C" AND BRLCAD_ENABLE_STRICT AND ${LIBNAME_UPPER}_NO_STRICT)
CHECK_C_COMPILER_FLAG(-Wno-error NOERROR_FLAG)
if(NOERROR_FLAG)
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif(NOERROR_FLAG)
endif(${lib_type} STREQUAL "C" AND BRLCAD_ENABLE_STRICT AND ${LIBNAME_UPPER}_NO_STRICT)
if(${lib_type} STREQUAL "CXX" AND BRLCAD_ENABLE_STRICT)
if(${LIBNAME_UPPER}_NO_STRICT_CXX OR ${LIBNAME_UPPER}_NO_STRICT)
CHECK_CXX_COMPILER_FLAG(-Wno-error NOERROR_FLAG_CXX)
if(NOERROR_FLAG_CXX)
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif(NOERROR_FLAG_CXX)
endif(${LIBNAME_UPPER}_NO_STRICT_CXX OR ${LIBNAME_UPPER}_NO_STRICT)
endif(${lib_type} STREQUAL "CXX" AND BRLCAD_ENABLE_STRICT)
endif((NOT ${LIBNAME_UPPER}_STATIC) AND (BUILD_SHARED_LIBS OR ${LIBNAME_UPPER}_SHARED))
# Handle static libraries (renaming requirements to both allow unique targets and
# respect standard naming conventions.)
if((NOT ${LIBNAME_UPPER}_SHARED) AND (BUILD_STATIC_LIBS OR ${LIBNAME_UPPER}_STATIC))
set(static_srcs ${srcslist} ${${LIBNAME_UPPER}_STATIC_SRCS})
add_library(${libname}-static STATIC ${static_srcs})
set_target_properties(${libname}-static PROPERTIES FOLDER "BRL-CAD Static Libs")
if(NOT BUILD_SHARED_LIBS)
# Check at comple time the standard BRL-CAD style rules
VALIDATE_STYLE("${static_srcs}" "${libname}-static")
endif(NOT BUILD_SHARED_LIBS)
# Set the FOLDER property. If the target has supplied a folder, use
# that as a subfolder
if("${${LIBNAME_UPPER}_FOLDER}" STREQUAL "")
set_target_properties(${libname}-static PROPERTIES FOLDER "BRL-CAD Static Libraries")
else("${${LIBNAME_UPPER}_FOLDER}" STREQUAL "")
set_target_properties(${libname}-static PROPERTIES FOLDER "BRL-CAD Static Libraries/${${LIBNAME_UPPER}_FOLDER}")
endif("${${LIBNAME_UPPER}_FOLDER}" STREQUAL "")
# Make sure we don't end up with outputs named liblib...
if(${libname}-static MATCHES "^lib*")
set_target_properties(${libname}-static PROPERTIES PREFIX "")
endif(${libname}-static MATCHES "^lib*")
if(NOT MSVC)
if(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
target_link_libraries(${libname}-static ${libslist})
endif(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
set_target_properties(${libname}-static PROPERTIES OUTPUT_NAME "${libname}")
endif(NOT MSVC)
# If a library isn't to be installed or needs to be installed
# somewhere other than the default location, the NO_INSTALL argument
# bypasses the standard install command call. Otherwise, call install
# with standard arguments.
if(NOT ${LIBNAME_UPPER}_NO_INSTALL)
install(TARGETS ${libname}-static
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR})
endif(NOT ${LIBNAME_UPPER}_NO_INSTALL)
foreach(lib_define ${${libname}_DEFINES})
set_property(TARGET ${libname}-static APPEND PROPERTY COMPILE_DEFINITIONS "${lib_define}")
endforeach(lib_define ${${libname}_DEFINES})
# If we haven't already taken care of the flags on a per-file basis,
# apply them to the target now that we have one.
if(NOT ${lib_type} STREQUAL "MIXED")
# All one language - we can apply the flags to the target
foreach(lib_flag ${${libname}_${lib_type}_FLAGS})
set_property(TARGET ${libname}-static APPEND PROPERTY COMPILE_FLAGS "${lib_flag}")
endforeach(lib_flag ${${libname}_${lib_type}_FLAGS})
endif(NOT ${lib_type} STREQUAL "MIXED")
# If we can't build this library strict, add the -Wno-error flag
if(${lib_type} STREQUAL "C" AND BRLCAD_ENABLE_STRICT AND ${LIBNAME_UPPER}_NO_STRICT)
CHECK_C_COMPILER_FLAG(-Wno-error NOERROR_FLAG)
if(NOERROR_FLAG)
set_property(TARGET ${libname}-static APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif(NOERROR_FLAG)
endif(${lib_type} STREQUAL "C" AND BRLCAD_ENABLE_STRICT AND ${LIBNAME_UPPER}_NO_STRICT)
if(${lib_type} STREQUAL "CXX" AND BRLCAD_ENABLE_STRICT)
if(${LIBNAME_UPPER}_NO_STRICT_CXX OR ${LIBNAME_UPPER}_NO_STRICT)
CHECK_CXX_COMPILER_FLAG(-Wno-error NOERROR_FLAG_CXX)
if(NOERROR_FLAG_CXX)
set_property(TARGET ${libname}-static APPEND PROPERTY COMPILE_FLAGS "-Wno-error")
endif(NOERROR_FLAG_CXX)
endif(${LIBNAME_UPPER}_NO_STRICT_CXX OR ${LIBNAME_UPPER}_NO_STRICT)
endif(${lib_type} STREQUAL "CXX" AND BRLCAD_ENABLE_STRICT)
endif((NOT ${LIBNAME_UPPER}_SHARED) AND (BUILD_STATIC_LIBS OR ${LIBNAME_UPPER}_STATIC))
# Mixed source STRICTNESS is handled separately (on a per-file basis) if we have mixed
# sources via the NO_STRICT_CXX flag
if(${lib_type} STREQUAL "MIXED" AND ${LIBNAME_UPPER}_NO_STRICT_CXX)
CXX_NO_STRICT("${all_srcs}")
endif(${lib_type} STREQUAL "MIXED" AND ${LIBNAME_UPPER}_NO_STRICT_CXX)
# For any CPP_DLL_DEFINES DLL library, users of that library will need the DLL_IMPORTS
# definition specific to that library. Add it to ${libname}_DLL_DEFINES
if(CPP_DLL_DEFINES)
list(APPEND ${libname}_DLL_DEFINES ${UPPER_CORE}_DLL_IMPORTS)
endif(CPP_DLL_DEFINES)
set_property(GLOBAL PROPERTY ${libname}_DLL_DEFINES "${${libname}_DLL_DEFINES}")
mark_as_advanced(BRLCAD_LIBS)
endmacro(BRLCAD_ADDLIB libname srcslist libslist)
endfunction(BRLCAD_ADDLIB libname srcslist libslist)
#-----------------------------------------------------------------------------
# For situations when a local 3rd party library (say, zlib) has been chosen in
@@ -548,7 +528,7 @@ endmacro(BRLCAD_ADDLIB libname srcslist libslist)
# 3. For remaining paths, if the "root" path matches the BRLCAD_SOURCE_DIR
# or BRLCAD_BINARY_DIR paths, they are appended.
# 4. Any remaining paths are appended.
macro(BRLCAD_SORT_INCLUDE_DIRS DIR_LIST)
function(BRLCAD_SORT_INCLUDE_DIRS DIR_LIST)
if(${DIR_LIST})
set(ORDERED_ELEMENTS "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" "${BRLCAD_BINARY_DIR}/include" "${BRLCAD_SOURCE_DIR}/include")
set(NEW_DIR_LIST "")
@@ -586,15 +566,15 @@ macro(BRLCAD_SORT_INCLUDE_DIRS DIR_LIST)
list(REMOVE_DUPLICATES NEW_DIR_LIST)
# put the results into DIR_LIST
set(${DIR_LIST} ${NEW_DIR_LIST})
set(${DIR_LIST} ${NEW_DIR_LIST} PARENT_SCOPE)
endif(${DIR_LIST})
endmacro(BRLCAD_SORT_INCLUDE_DIRS)
endfunction(BRLCAD_SORT_INCLUDE_DIRS)
#-----------------------------------------------------------------------------
# Wrapper to properly include directories for a BRL-CAD build. Handles the
# SYSTEM option to the include_directories command, as well as calling the
# sort macro.
macro(BRLCAD_INCLUDE_DIRS DIR_LIST)
# sort function.
function(BRLCAD_INCLUDE_DIRS DIR_LIST)
set(INCLUDE_DIRS ${${DIR_LIST}})
if(INCLUDE_DIRS)
@@ -625,14 +605,14 @@ macro(BRLCAD_INCLUDE_DIRS DIR_LIST)
endif("${inc_dir}" MATCHES "other" OR NOT IS_LOCAL)
endforeach(inc_dir ${ALL_INCLUDES})
endmacro(BRLCAD_INCLUDE_DIRS DIR_LIST)
endfunction(BRLCAD_INCLUDE_DIRS DIR_LIST)
#-----------------------------------------------------------------------------
# Wrapper to handle include directories specific to libraries. Removes
# duplicates and makes sure the <LIB>_INCLUDE_DIRS list is in the cache
# immediately, so it can be used by other libraries. These lists are not
# intended as toplevel user settable options so mark as advanced.
macro(BRLCAD_LIB_INCLUDE_DIRS libname DIR_LIST LOCAL_DIR_LIST)
function(BRLCAD_LIB_INCLUDE_DIRS libname DIR_LIST LOCAL_DIR_LIST)
string(TOUPPER ${libname} LIB_UPPER)
list(REMOVE_DUPLICATES ${DIR_LIST})
@@ -641,7 +621,7 @@ macro(BRLCAD_LIB_INCLUDE_DIRS libname DIR_LIST LOCAL_DIR_LIST)
set(ALL_INCLUDES ${${DIR_LIST}} ${${LOCAL_DIR_LIST}})
BRLCAD_INCLUDE_DIRS(ALL_INCLUDES)
endmacro(BRLCAD_LIB_INCLUDE_DIRS)
endfunction(BRLCAD_LIB_INCLUDE_DIRS)
#-----------------------------------------------------------------------------
@@ -666,7 +646,7 @@ endmacro(BRLCAD_LIB_INCLUDE_DIRS)
# of the custom commands robust we supply full file paths as dependencies to
# the file copying custom commands.
macro(BRLCAD_MANAGE_FILES inputdata targetdir)
function(BRLCAD_MANAGE_FILES inputdata targetdir)
string(RANDOM LENGTH 10 ALPHABET 0123456789 VAR_PREFIX)
if(${ARGC} GREATER 2)
@@ -675,7 +655,10 @@ macro(BRLCAD_MANAGE_FILES inputdata targetdir)
# Handle both a list of one or more files and variable holding a list of files -
# find out what we've got.
NORMALIZE_FILE_LIST("${inputdata}" datalist fullpath_datalist targetname)
NORMALIZE_FILE_LIST("${inputdata}" RLIST datalist FPLIST fullpath_datalist TARGET targetname)
# Identify the source files for CMake
CMAKEFILES(${datalist})
#-----------------------------------------------------------------------------
# Some of the more advanced build system features in BRL-CAD's CMake
@@ -809,25 +792,25 @@ macro(BRLCAD_MANAGE_FILES inputdata targetdir)
install(FILES ${datalist} DESTINATION ${targetdir})
endif(${VAR_PREFIX}_EXEC)
endmacro(BRLCAD_MANAGE_FILES)
endfunction(BRLCAD_MANAGE_FILES)
#-----------------------------------------------------------------------------
# Specific uses of the BRLCAD_MANAGED_FILES functionality - these cover most
# of the common cases in BRL-CAD.
macro(BRLCAD_ADDDATA datalist targetdir)
function(BRLCAD_ADDDATA datalist targetdir)
BRLCAD_MANAGE_FILES(${datalist} ${DATA_DIR}/${targetdir})
endmacro(BRLCAD_ADDDATA)
endfunction(BRLCAD_ADDDATA)
macro(ADD_DOC doclist targetdir)
function(ADD_DOC doclist targetdir)
set(doc_target_dir ${DOC_DIR}/${targetdir})
BRLCAD_MANAGE_FILES(${doclist} ${doc_target_dir})
endmacro(ADD_DOC)
endfunction(ADD_DOC)
macro(ADD_MAN_PAGES num inmanlist)
function(ADD_MAN_PAGES num inmanlist)
set(man_target_dir ${MAN_DIR}/man${num})
BRLCAD_MANAGE_FILES(${inmanlist} ${man_target_dir})
endmacro(ADD_MAN_PAGES)
endfunction(ADD_MAN_PAGES)
# Local Variables:
# tab-width: 8
+590 -137
View File
@@ -33,8 +33,74 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# Need sophisticated option parsing
include(CMakeParseArguments)
#-----------------------------------------------------------------------------
# Pretty-printing macro that generates a box around a string and prints the
# We want to support a "distclean" build target that will clear all
# CMake-generated files from a source directory in the case of an
# in-source-dir configuration. Not recommended, but we'll try to
# recover if it happens.
define_property(GLOBAL PROPERTY CMAKE_DISTCLEAN_TARGET_LIST BRIEF_DOCS "All CMake generated files" FULL_DOCS "List of all files generated by CMake")
function(distclean)
foreach(item ${ARGN})
set_property(GLOBAL APPEND PROPERTY CMAKE_DISTCLEAN_TARGET_LIST "${item}")
endforeach(item ${ARGN})
endfunction(distclean)
#-----------------------------------------------------------------------------
# Use a variation on Fraser's approach for capturing command line args from
# http://stackoverflow.com/questions/10205986/how-to-capture-cmake-command-line-arguments
# to log what variables have been passed in from the user via -D arguments - haven't
# found a variable that saves the original ARGV list except for those defined in
# -P script mode, which doesn't help here.
function(record_cmdline_args)
get_cmake_property(VARS VARIABLES)
foreach(VAR ${VARS})
get_property(VAR_HELPSTRING CACHE ${VAR} PROPERTY HELPSTRING)
# Rather than look for "No help, variable specified on the command line."
# exactly, match a slightly more robust subset...
string(TOLOWER "${VAR_HELPSTRING}" VAR_HELPSTRING)
if("${VAR_HELPSTRING}" MATCHES "specified on the command line")
get_property(VAR_TYPE CACHE ${VAR} PROPERTY TYPE)
if(NOT VAR_TYPE STREQUAL "UNINITIALIZED")
set(VAR "${VAR}:${VAR_TYPE}")
endif(NOT VAR_TYPE STREQUAL "UNINITIALIZED")
set(CMAKE_ARGS "${CMAKE_ARGS} -D${VAR}=${${VAR}}")
endif("${VAR_HELPSTRING}" MATCHES "specified on the command line")
endforeach(VAR ${VARS})
file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log" "${CMAKE_COMMAND} \"${CMAKE_SOURCE_DIR}\" ${CMAKE_ARGS}\n")
endfunction(record_cmdline_args)
#---------------------------------------------------------------------
# Wrap the default message() function to also append ALL messages to a
# CMakeOutput.log file in addition to usual console printing.
# Note - only do this after calling project, since this override seems to do
# unexpected things to the messages returned by that command
function(message)
# bleh, don't know a clean+safe way to avoid string comparing the
# optional arg, so we extract it and test.
list(GET ARGV 0 MessageType)
if (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR OR MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR MessageType STREQUAL STATUS)
list(REMOVE_AT ARGV 0)
_message(${MessageType} "${ARGV}")
file(APPEND "${BRLCAD_BINARY_DIR}/CMakeFiles/CMakeOutput.log" "${MessageType}: ${ARGV}\n")
else (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR OR MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR MessageType STREQUAL STATUS)
_message("${ARGV}")
file(APPEND "${BRLCAD_BINARY_DIR}/CMakeFiles/CMakeOutput.log" "${ARGV}\n")
endif (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR OR MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR MessageType STREQUAL STATUS)
# ~10% slower alternative that avoids adding '--' to STATUS messages
# execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${ARGV}")
endfunction(message)
#-----------------------------------------------------------------------------
# Pretty-printing function that generates a box around a string and prints the
# resulting message.
function(BOX_PRINT input_string border_string)
string(LENGTH ${input_string} MESSAGE_LENGTH)
@@ -48,106 +114,6 @@ function(BOX_PRINT input_string border_string)
message("${SEPARATOR_STRING}")
endfunction()
#-----------------------------------------------------------------------------
# It is sometimes convenient to be able to supply both a filename and a
# variable name containing a list of files to a single macro.
# This routine handles both forms of input - separate variables are
# used to indicate which variable names are supposed to contain the
# initial list contents and the full path version of that list. Thus,
# macros using the normalize macro get the list in a known variable and
# can use it reliably, regardless of whether inlist contained the actual
# list contents or a variable.
macro(NORMALIZE_FILE_LIST inlist targetvar fullpath_targetvar)
# First, figure out whether we have list contents or a list name
set(havevarname 0)
foreach(maybefilename ${inlist})
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${maybefilename}")
set(havevarname 1)
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${maybefilename}")
endforeach(maybefilename ${${targetvar}})
# Put the list contents in the targetvar variable and
# generate a target name.
if(NOT havevarname)
set(${targetvar} "${inlist}")
# Initial clean-up
string(REGEX REPLACE " " "_" targetstr "${inlist}")
string(REGEX REPLACE "/" "_" targetstr "${targetstr}")
string(REGEX REPLACE "\\." "_" targetstr "${targetstr}")
# For situations like file copying, where we sometimes need to autogenerate
# target names, it is important to make sure we can avoid generating absurdly
# long names. To do this, we run candidate names through a length filter
# and use their MD5 hash if they are longer than 30 characters.
# It's cryptic but the odds are very good the result will be a unique
# target name and the string will be short enough, which is what we need.
string(LENGTH "${targetstr}" STRLEN)
if ("${STRLEN}" GREATER 30)
string(MD5 targetname "${targetstr}")
else ("${STRLEN}" GREATER 30)
set(targetname "${targetstr}")
endif ("${STRLEN}" GREATER 30)
else(NOT havevarname)
set(${targetvar} "${${inlist}}")
set(targetname "${inlist}")
endif(NOT havevarname)
# Mark the inputs as files to ignore in distcheck
CMAKEFILES(${${targetvar}})
# For some uses, we need the contents of the input list
# with full paths. Generate a list that we're sure has
# full paths, and return that to the second variable.
set(${fullpath_targetvar} "")
foreach(filename ${${targetvar}})
get_filename_component(file_fullpath "${filename}" ABSOLUTE)
set(${fullpath_targetvar} ${${fullpath_targetvar}} "${file_fullpath}")
endforeach(filename ${${targetvar}})
# Some macros will also want a valid build target name
# based on the input - if a third input parameter has
# been supplied, return the target name using it.
if(NOT "${ARGV3}" STREQUAL "")
set(${ARGV3} "${targetname}")
endif(NOT "${ARGV3}" STREQUAL "")
endmacro(NORMALIZE_FILE_LIST)
#-----------------------------------------------------------------------------
# It is sometimes necessary for build logic to be aware of all instances
# of a certain category of target that have been defined for a particular
# build directory - for example, the pkgIndex.tcl generation targets need
# to ensure that all data copying targets have done their work before they
# generate their indexes. To support this, macros are define that allow
# globally available lists to be defined, maintained and accessed. We use
# this approach instead of directory properties because CMake's documentation
# seems to indicate that directory properties also apply to subdirectories,
# and we want these lists to be associated with one and only one directory.
macro(BRLCAD_ADD_DIR_LIST_ENTRY list_name dir_in list_entry)
string(REGEX REPLACE "/" "_" currdir_str ${dir_in})
string(TOUPPER "${currdir_str}" currdir_str)
get_property(${list_name}_${currdir_str} GLOBAL PROPERTY DATA_TARGETS_${currdir_str})
if(NOT ${list_name}_${currdir_str})
define_property(GLOBAL PROPERTY CMAKE_LIBRARY_TARGET_LIST BRIEF_DOCS "${list_name}" FULL_DOCS "${list_name} for directory ${dir_in}")
endif(NOT ${list_name}_${currdir_str})
set_property(GLOBAL APPEND PROPERTY ${list_name}_${currdir_str} ${list_entry})
endmacro(BRLCAD_ADD_DIR_LIST_ENTRY)
macro(BRLCAD_GET_DIR_LIST_CONTENTS list_name dir_in outvar)
string(REGEX REPLACE "/" "_" currdir_str ${dir_in})
string(TOUPPER "${currdir_str}" currdir_str)
get_property(${list_name}_${currdir_str} GLOBAL PROPERTY ${list_name}_${currdir_str})
set(${outvar} "${DATA_TARGETS_${currdir_str}}")
endmacro(BRLCAD_GET_DIR_LIST_CONTENTS)
#-----------------------------------------------------------------------------
# We need a way to tell whether one path is a subpath of another path without
# relying on regular expressions, since file paths may have characters in them
@@ -160,47 +126,252 @@ endmacro(BRLCAD_GET_DIR_LIST_CONTENTS)
# The routine below does the check without using regex matching, in order to
# handle path names that contain characters that would be interpreted as active
# in a regex string.
function(IS_SUBPATH in_candidate_subpath in_full_path result_var)
# Convert paths to lists of directories - regex based
# matching won't work reliably, so instead look at each
# element compared to its corresponding element in the
# other path using string comparison.
function(IS_SUBPATH candidate_subpath full_path result_var)
# get the CMake form of the path so we have something consistent
# to work on
file(TO_CMAKE_PATH "${in_full_path}" full_path)
file(TO_CMAKE_PATH "${in_candidate_subpath}" candidate_subpath)
# Just assume it isn't until we prove it is
set(${result_var} 0 PARENT_SCOPE)
# check the string lengths - if the "subpath" is longer
# than the full path, there's not point in going further
string(LENGTH "${full_path}" FULL_LENGTH)
string(LENGTH "${candidate_subpath}" SUB_LENGTH)
# get the CMake form of the path so we have something consistent to work on
file(TO_CMAKE_PATH "${full_path}" c_full_path)
file(TO_CMAKE_PATH "${candidate_subpath}" c_candidate_subpath)
# check the string lengths - if the "subpath" is longer than the full path,
# there's not point in going further
string(LENGTH "${c_full_path}" FULL_LENGTH)
string(LENGTH "${c_candidate_subpath}" SUB_LENGTH)
if("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
set(${result_var} 0 PARENT_SCOPE)
else("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
# OK, maybe it's a subpath - time to actually check
string(REPLACE "/" ";" full_path_list "${full_path}")
string(REPLACE "/" ";" candidate_subpath_list "${candidate_subpath}")
set(found_difference 0)
while(NOT found_difference AND candidate_subpath_list)
list(GET full_path_list 0 full_path_element)
list(GET candidate_subpath_list 0 subpath_element)
if("${full_path_element}" STREQUAL "${subpath_element}")
list(REMOVE_AT full_path_list 0)
list(REMOVE_AT candidate_subpath_list 0)
else("${full_path_element}" STREQUAL "${subpath_element}")
set(found_difference 1)
endif("${full_path_element}" STREQUAL "${subpath_element}")
endwhile(NOT found_difference AND candidate_subpath_list)
# Now we know - report the result
if(NOT found_difference)
set(${result_var} 1 PARENT_SCOPE)
else(NOT found_difference)
set(${result_var} 0 PARENT_SCOPE)
endif(NOT found_difference)
return()
endif("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
# OK, maybe it's a subpath - time to actually check
string(SUBSTRING "${c_full_path}" 0 ${SUB_LENGTH} c_full_subpath)
if(NOT "${c_full_subpath}" STREQUAL "${c_candidate_subpath}")
return()
endif(NOT "${c_full_subpath}" STREQUAL "${c_candidate_subpath}")
# If we get here, it's a subpath
set(${result_var} 1 PARENT_SCOPE)
endfunction(IS_SUBPATH)
#-----------------------------------------------------------------------------
# Distcheck needs to know what files are "supposed" to be present in order to
# make sure the source tree is clean prior to building a distribution tarball,
#
# For this set of functions to work correctly, it is important that any call
# (via target definitions or via explicit calls to CMAKEFILES) supply relative
# paths for files present in the source tree. Generated files fed into
# compilation targets are not one of the things that should be in lists
# generated by this function, and the only way to reliably recognize them is to
# reject files specified using their full path. Such files must use their full
# path in the build logic in order for out-of-src-dir builds to function, so as
# long as no full paths are used for files actually IN the source tree this
# method is reliable. The filtering logic will try to catch improperly
# specified files, but if the build directory and the source directory are one
# and the same this will not be possible.
define_property(GLOBAL PROPERTY CMAKE_IGNORE_FILES BRIEF_DOCS "distcheck ignore files" FULL_DOCS "List of files known to CMake")
define_property(GLOBAL PROPERTY CMAKE_IGNORE_DIRS BRIEF_DOCS "distcheck ignore dirs" FULL_DOCS "List of directories marked as fully known to CMake")
# If the build directory is not the same as the source directory, we can
# enforce the convention that only generated files be specified with their full
# name.
function(CHECK_SOURCE_DIR_FULLPATH ITEM_PATH)
# We can only do this if BINARY_DIR != SOURCE_DIR
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
return()
endif(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# If it's a full path in the binary dir, it's fine
IS_SUBPATH("${CMAKE_BINARY_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
if(NOT "${SUBPATH_TEST}" STREQUAL "0")
return()
endif(NOT "${SUBPATH_TEST}" STREQUAL "0")
# If it's a full path in the source dir, it's fatal
IS_SUBPATH("${CMAKE_SOURCE_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
if("${SUBPATH_TEST}" STREQUAL "1")
message(FATAL_ERROR "${ITEM} is listed in \"${CMAKE_CURRENT_SOURCE_DIR}\" using its absolute path. Please specify the location of this file using a relative path.")
endif("${SUBPATH_TEST}" STREQUAL "1")
endfunction(CHECK_SOURCE_DIR_FULLPATH ITEM_PATH)
function(CMFILE ITEM)
get_filename_component(ITEM_PATH "${ITEM}" PATH)
if(NOT "${ITEM_PATH}" STREQUAL "")
# The hard case - path specified, need some validation.
CHECK_SOURCE_DIR_FULLPATH("${ITEM_PATH}")
# Ignore files specified using full paths, since they
# should be generated files and are not part of the
# source code repository.
get_filename_component(ITEM_ABS_PATH "${ITEM_PATH}" ABSOLUTE)
if("${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
return()
endif("${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
endif(NOT "${ITEM_PATH}" STREQUAL "")
# Handle fatal cases
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
message(FATAL_ERROR "Trying to ignore directory: ${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
message(FATAL_ERROR "Attempting to ignore non-existent file ${ITEM}, in directory \"${CMAKE_CURRENT_SOURCE_DIR}\"")
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
# We're good - log it
set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
endfunction(CMFILE ITEM)
function(CMAKEFILES)
if(NOT BRLCAD_IS_SUBBUILD)
# CMake flags to add_library/add_executable aren't going to be valid filenames - just
# yank them up front.
set(ITEMS ${ARGN})
list(REMOVE_ITEM ITEMS SHARED STATIC OBJECT WIN32 UNKNOWN IMPORTED MODULE INTERFACE EXCLUDE_FROM_ALL)
# TODO - once we require a new enough CMake version, replace the foreach below with list(FILTER ...)
foreach(ITEM ${ITEMS})
if("${ITEM}" MATCHES "TARGET_OBJECTS")
list(REMOVE_ITEM ITEMS "${ITEM}")
endif("${ITEM}" MATCHES "TARGET_OBJECTS")
endforeach(ITEM ${ITEMS})
foreach(ITEM ${ITEMS})
CMFILE("${ITEM}")
endforeach(ITEM ${ITEMS})
endif(NOT BRLCAD_IS_SUBBUILD)
endfunction(CMAKEFILES FILESLIST)
# Routine to tell distcheck to ignore a series of items in a directory.
# Primarily useful when working with src/other dist lists.
function(CMAKEFILES_IN_DIR filestoignore targetdir)
if(NOT BRLCAD_IS_SUBBUILD)
set(CMAKE_IGNORE_LIST "")
foreach(filepath ${${filestoignore}})
set(CMAKE_IGNORE_LIST ${CMAKE_IGNORE_LIST} "${targetdir}/${filepath}")
endforeach(filepath ${filestoignore})
CMAKEFILES(${CMAKE_IGNORE_LIST})
endif(NOT BRLCAD_IS_SUBBUILD)
endfunction(CMAKEFILES_IN_DIR)
#-----------------------------------------------------------------------------
# It is sometimes convenient to be able to supply both a filename and a
# variable name containing a list of files to a single function. This routine
# handles both forms of input - separate variables are used to indicate which
# variable names are supposed to contain the initial list contents and the full
# path version of that list. Thus, functions using the normalize function get
# the list in a known variable and can use it reliably, regardless of whether
# inlist contained the actual list contents or a variable.
function(NORMALIZE_FILE_LIST inlist)
cmake_parse_arguments(N "" "RLIST;FPLIST;TARGET" "" ${ARGN})
# First, figure out whether we have list contents or a list name
set(havevarname 0)
foreach(maybefilename ${inlist})
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${maybefilename}")
set(havevarname 1)
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${maybefilename}")
endforeach(maybefilename ${inlist})
# Put the list contents in the targetvar variable and
# generate a target name.
if(NOT havevarname)
set(rlist "${inlist}")
if(N_RLIST)
set(${N_RLIST} "${inlist}" PARENT_SCOPE)
endif(N_RLIST)
# If we want a target name and all we've got is a list of files,
# we need to get a bit creative.
if(N_TARGET)
# Initial clean-up
string(REGEX REPLACE " " "_" targetstr "${inlist}")
string(REGEX REPLACE "/" "_" targetstr "${targetstr}")
string(REGEX REPLACE "\\." "_" targetstr "${targetstr}")
# For situations like file copying, where we sometimes need to autogenerate
# target names, it is important to make sure we can avoid generating absurdly
# long names. To do this, we run candidate names through a length filter
# and use their MD5 hash if they are longer than 30 characters.
# It's cryptic but the odds are very good the result will be a unique
# target name and the string will be short enough, which is what we need.
string(LENGTH "${targetstr}" STRLEN)
if ("${STRLEN}" GREATER 30)
string(MD5 targetname "${targetstr}")
else ("${STRLEN}" GREATER 30)
set(targetname "${targetstr}")
endif ("${STRLEN}" GREATER 30)
# Send back the final result
set(${N_TARGET} "${targetname}" PARENT_SCOPE)
endif(N_TARGET)
else(NOT havevarname)
set(rlist "${${inlist}}")
if(N_RLIST)
set(${N_RLIST} "${${inlist}}" PARENT_SCOPE)
endif(N_RLIST)
if(N_TARGET)
set(${N_TARGET} "${inlist}" PARENT_SCOPE)
endif(N_TARGET)
endif(NOT havevarname)
# For some uses, we need the contents of the input list
# with full paths. Generate a list that we're sure has
# full paths, and return that to the second variable.
if(N_FPLIST)
set(fullpaths "")
foreach(filename ${rlist})
get_filename_component(file_fullpath "${filename}" ABSOLUTE)
set(fullpaths ${fullpaths} "${file_fullpath}")
endforeach(filename ${rlist})
set(${N_FPLIST} "${fullpaths}" PARENT_SCOPE)
endif(N_FPLIST)
endfunction(NORMALIZE_FILE_LIST)
#-----------------------------------------------------------------------------
# It is sometimes necessary for build logic to be aware of all instances
# of a certain category of target that have been defined for a particular
# build directory - for example, the pkgIndex.tcl generation targets need
# to ensure that all data copying targets have done their work before they
# generate their indexes. To support this, functions are define that allow
# globally available lists to be defined, maintained and accessed. We use
# this approach instead of directory properties because CMake's documentation
# seems to indicate that directory properties also apply to subdirectories,
# and we want these lists to be associated with one and only one directory.
function(BRLCAD_ADD_DIR_LIST_ENTRY list_name dir_in list_entry)
string(REGEX REPLACE "/" "_" currdir_str ${dir_in})
string(TOUPPER "${currdir_str}" currdir_str)
get_property(${list_name}_${currdir_str} GLOBAL PROPERTY DATA_TARGETS_${currdir_str})
if(NOT ${list_name}_${currdir_str})
define_property(GLOBAL PROPERTY CMAKE_LIBRARY_TARGET_LIST BRIEF_DOCS "${list_name}" FULL_DOCS "${list_name} for directory ${dir_in}")
endif(NOT ${list_name}_${currdir_str})
set_property(GLOBAL APPEND PROPERTY ${list_name}_${currdir_str} ${list_entry})
endfunction(BRLCAD_ADD_DIR_LIST_ENTRY)
function(BRLCAD_GET_DIR_LIST_CONTENTS list_name dir_in outvar)
string(REGEX REPLACE "/" "_" currdir_str ${dir_in})
string(TOUPPER "${currdir_str}" currdir_str)
get_property(${list_name}_${currdir_str} GLOBAL PROPERTY ${list_name}_${currdir_str})
set(${outvar} "${DATA_TARGETS_${currdir_str}}" PARENT_SCOPE)
endfunction(BRLCAD_GET_DIR_LIST_CONTENTS)
#-----------------------------------------------------------------------------
# Determine whether a list of source files contains all C, all C++, or
# mixed source types.
@@ -222,7 +393,7 @@ function(SRCS_LANG sourceslist resultvar targetname)
endif(${srcfile_ext} MATCHES ".cxx$" OR ${srcfile_ext} MATCHES ".cpp$" OR ${srcfile_ext} MATCHES ".cc$")
endif(NOT file_language)
if(NOT file_language)
message("WARNING - file ${srcfile} listed in the ${targetname} sources list does not appear to be a C or C++ file.")
message(WARNING "File ${srcfile} listed in the ${targetname} sources list does not appear to be a C or C++ file.")
endif(NOT file_language)
endforeach(srcfile ${sourceslist})
set(${resultvar} "UNKNOWN" PARENT_SCOPE)
@@ -248,6 +419,288 @@ function(ADD_TARGET_DEPS tname)
endif(TARGET ${tname})
endfunction(ADD_TARGET_DEPS tname)
#---------------------------------------------------------------------------
# Write out an execution script to run commands with the necessary
# variables set to allow execution in the build directory, even if
# there are installed libraries present in the final installation
# directory.
function(generate_cmd_script cmd_exe script_file)
cmake_parse_arguments(GCS "" "OLOG;ELOG" "CARGS" ${ARGN})
# Initialize file
file(WRITE "${script_file}" "# Script to run ${cmd_exe}\n")
# Handle multiconfig (must be run-time determination for Visual Studio and XCode)
# TODO - logic writing this trick needs to become some sort of standard routine...
file(APPEND "${script_file}" "if(EXISTS \"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Release\")\n")
file(APPEND "${script_file}" " set(CBDIR \"${CMAKE_BINARY_DIR}/Release\")\n")
file(APPEND "${script_file}" "elseif(EXISTS \"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Debug\")\n")
file(APPEND "${script_file}" " set(CBDIR \"${CMAKE_BINARY_DIR}/Debug\")\n")
file(APPEND "${script_file}" "else(EXISTS \"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Release\")\n")
file(APPEND "${script_file}" " set(CBDIR \"${CMAKE_BINARY_DIR}\")\n")
file(APPEND "${script_file}" "endif(EXISTS \"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Release\")\n")
# BRLCAD_ROOT is the hammer that makes certain we are running
# things found in the build directory
file(APPEND "${script_file}" "set(ENV{BRLCAD_ROOT} \"\${CBDIR}\")\n")
# Substitute in the correct binary path anywhere it is needed in the args
file(APPEND "${script_file}" "string(REPLACE \"CURRENT_BUILD_DIR\" \"\${CBDIR}\" FIXED_CMD_ARGS \"${GCS_CARGS}\")\n")
# Use the CMake executable to figure out if we need an extension
get_filename_component(EXE_EXT "${CMAKE_COMMAND}" EXT)
# Write the actual cmake command to run the process
file(APPEND "${script_file}" "execute_process(COMMAND \"\${CBDIR}/${BIN_DIR}/${cmd_exe}${EXE_EXT}\" \${FIXED_CMD_ARGS} RESULT_VARIABLE CR OUTPUT_VARIABLE CO ERROR_VARIABLE CE)\n")
# Log the outputs, if we are supposed to do that
if(GCS_OLOG)
file(APPEND "${script_file}" "file(APPEND \"${GCS_OLOG}\" \"\${CO}\")\n")
endif(GCS_OLOG)
if(GCS_ELOG)
file(APPEND "${script_file}" "file(APPEND \"${GCS_ELOG}\" \"\${CE}\")\n")
endif(GCS_ELOG)
# Fail the command if the result was non-zero
file(APPEND "${script_file}" "if(CR)\n")
file(APPEND "${script_file}" " message(FATAL_ERROR \"\${CBDIR}/${BIN_DIR}/${cmd_exe}${EXE_EXT} failure: \${CR}\\n\${CO}\\n\${CE}\")\n")
file(APPEND "${script_file}" "endif(CR)\n")
# If we are doing distclean, let CMake know to remove the script and log files
if(COMMAND distclean)
set(distclean_files "${script_file}" "${GCS_OLOG}" "${GCS_ELOG}")
list(REMOVE_DUPLICATES distclean_files)
distclean(${distclean_files})
endif(COMMAND distclean)
endfunction(generate_cmd_script)
#---------------------------------------------------------------------------
# Set variables reporting time of configuration. Sets CONFIG_DATE and
# CONFIG_DATESTAMP in parent scope.
#
# Unfortunately, CMake doesn't give you variables with current day,
# month, etc. There are several possible approaches to this, but most
# (e.g. the date command) are not cross platform. We build a small C
# program which supplies the needed info.
function(set_config_time)
# We don't want any parent C flags here - hopefully, the below code will
# "just work" in any environment we care about. The gnu89 standard doesn't
# like the %z print specifier, but unless/until we hit a compiler that really
# can't deal with it don't worry about it.
set(CMAKE_C_FLAGS "")
set(rfc2822_src "
/* RFC2822 timestamp and individual day, month and year files */
#include <time.h>
#include <stdio.h>
#include <string.h>
int main(int argc, const char **argv) {
time_t t = time(NULL);
struct tm *currenttime = localtime(&t);
if (argc <= 1) {
char rfc2822[200];
strftime(rfc2822, sizeof(rfc2822), \"%a, %d %b %Y %H:%M:%S %z\", currenttime);
printf(\"%s\", rfc2822);
return 0;
}
if (strncmp(argv[1], \"day\", 4) == 0) {
printf(\"%02d\", currenttime->tm_mday);
}
if (strncmp(argv[1], \"month\", 5) == 0) {
printf(\"%02d\", currenttime->tm_mon + 1);
}
if (strncmp(argv[1], \"year\", 4) == 0) {
printf(\"%d\", currenttime->tm_year + 1900);
}
return 0;
}")
# Build the code so we can run it
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822.c" "${rfc2822_src}")
try_compile(rfc2822_build "${CMAKE_BINARY_DIR}/CMakeTmp"
SOURCES "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822.c"
OUTPUT_VARIABLE RFC2822_BUILD_INFO
COPY_FILE "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822${EXE_EXT}")
if(NOT rfc2822_build)
message(FATAL_ERROR "Could not build rfc2822 timestamp pretty-printing utility: ${RFC2822_BUILD_INFO}")
endif(NOT rfc2822_build)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822.c")
# Build up and set CONFIG_DATE
execute_process(COMMAND "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822" day OUTPUT_VARIABLE CONFIG_DAY)
string(STRIP ${CONFIG_DAY} CONFIG_DAY)
execute_process(COMMAND "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822" month OUTPUT_VARIABLE CONFIG_MONTH)
string(STRIP ${CONFIG_MONTH} CONFIG_MONTH)
execute_process(COMMAND "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822" year OUTPUT_VARIABLE CONFIG_YEAR)
string(STRIP ${CONFIG_YEAR} CONFIG_YEAR)
set(CONFIG_DATE "${CONFIG_YEAR}${CONFIG_MONTH}${CONFIG_DAY}" PARENT_SCOPE)
# Set DATESTAMP
execute_process(COMMAND "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822" OUTPUT_VARIABLE RFC2822_STRING)
string(STRIP ${RFC2822_STRING} RFC2822_STRING)
set(CONFIG_DATESTAMP "${RFC2822_STRING}" PARENT_SCOPE)
# Cleanup
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/rfc2822")
endfunction(set_config_time)
#---------------------------------------------------------------------------
# Code for timing configuration and building of BRL-CAD. These executables
# are used to define build targets for cross-platform reporting. Run after
# set_config_time.
function(generate_timer_exes)
#########################################################################
# Print a basic time stamp
set(printtimestamp_src "
#define _CRT_SECURE_NO_WARNINGS 1
#include <time.h>
#include <stdio.h>
int main(int argc, const char **argv)
{
time_t t = time(NULL);
struct tm *currenttime = localtime(&t);
if (argc < 2) return 1;
printf(\"\\n%s%s\\n\", argv[1], asctime(currenttime));
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/printtimestamp.c" "${printtimestamp_src}")
try_compile(pts_build ${CMAKE_BINARY_DIR}/CMakeTmp
"${CMAKE_BINARY_DIR}/CMakeTmp/printtimestamp.c"
COPY_FILE ${CMAKE_BINARY_DIR}/CMakeTmp/pts${EXE_EXT})
if(NOT pts_build)
message(FATAL_ERROR "Could not build timestamp pretty-printing utility")
endif(NOT pts_build)
#########################################################################
# We need some way to know at the end of the build when we kicked things
# off (both configuration and the build itself). Create a simple program
# that can stash that info in a file
set(sstamp_src "
#define _CRT_SECURE_NO_WARNINGS 1
#include <time.h>
#include <stdio.h>
int main(int argc, const char **argv) {
FILE *outfp = NULL;
time_t t = time(NULL);
if (argc < 2) return 1;
outfp = fopen(argv[1], \"w\");
fprintf(outfp, \"%ld\", (long)t);
fclose(outfp);
return 0;
}
")
# Build the code so we can run it
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/sstamp.c" "${sstamp_src}")
try_compile(sstamp_build "${CMAKE_BINARY_DIR}/CMakeTmp"
SOURCES "${CMAKE_BINARY_DIR}/CMakeTmp/sstamp.c"
OUTPUT_VARIABLE SSTAMP_BUILD_INFO
COPY_FILE "${CMAKE_BINARY_DIR}/CMakeTmp/sstamp${EXE_EXT}")
if(NOT sstamp_build)
message(FATAL_ERROR "Could not build second timestamping utility: ${SSTAMP_BUILD_INFO}")
endif(NOT sstamp_build)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/sstamp.c")
if(COMMAND distclean)
distclean("${CMAKE_BINARY_DIR}/CMakeTmp/sstamp")
endif(COMMAND distclean)
#########################################################################
# To report at the end what the actual deltas are, we need to read in the
# time stamps from the previous program and do some math.
# The install instructions at the end of the message are tool specific - key
# off of generators or build tools.
if("${CMAKE_GENERATOR}" MATCHES "Make")
set(INSTALL_LINE "Run 'make install' to begin installation into ${CMAKE_INSTALL_PREFIX}")
set(BENCHMARK_LINE "Run 'make benchmark' to run the BRL-CAD Benchmark Suite")
endif("${CMAKE_GENERATOR}" MATCHES "Make")
if("${CMAKE_GENERATOR}" MATCHES "Ninja")
set(INSTALL_LINE "Run 'ninja install' to begin installation into ${CMAKE_INSTALL_PREFIX}")
set(BENCHMARK_LINE "Run 'ninja benchmark' to run the BRL-CAD Benchmark Suite")
endif("${CMAKE_GENERATOR}" MATCHES "Ninja")
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(INSTALL_LINE "Run 'xcodebuild -target install' to begin installation into ${CMAKE_INSTALL_PREFIX}")
set(BENCHMARK_LINE "Run 'xcodebuild -target benchmark' to run the BRL-CAD Benchmark Suite")
endif("${CMAKE_GENERATOR}" MATCHES "Xcode")
if(MSVC)
# slightly misuse the lines for MSVC, since we don't usually do the
# install/benchmark routine there. (Benchmarks aren't currently supported
# in MSVC anyway.)
set(INSTALL_LINE "To build, launch Visual Studio and open ${CMAKE_BINARY_DIR}/BRLCAD.sln")
set(BENCHMARK_LINE "Build the ALL_BUILD target. To create an NSIS installer, build the PACKAGE target")
endif(MSVC)
set(dreport_src "
#define _CRT_SECURE_NO_WARNINGS 1
#include <time.h>
#include <stdio.h>
#include <string.h>
void printtime(long tdiff) {
long d_mins, d_hrs, d_days;
d_days = 0; d_hrs = 0; d_mins = 0;
if (tdiff > 86400) { d_days = tdiff / 86400; tdiff = tdiff % 86400; }
if (tdiff > 3600) { d_hrs = tdiff / 3600; tdiff = tdiff % 3600; }
if (tdiff > 60) { d_mins = tdiff / 60; tdiff = tdiff % 60; }
if (d_days > 0) { if (d_days == 1) { printf(\"%ld day \", d_days); } else { printf(\"%ld days \", d_days); } }
if (d_hrs > 0) { if (d_hrs == 1) { printf(\"%ld hour \", d_hrs); } else { printf(\"%ld hours \", d_hrs); } }
if (d_mins > 0) { if (d_mins == 1) { printf(\"%ld minute \", d_mins); } else { printf(\"%ld minutes \", d_mins); } }
if (tdiff > 0) { if (tdiff == 1) { printf(\"%ld second \", tdiff); } else { printf(\"%ld seconds \", tdiff); } }
if (tdiff == 0 && d_mins == 0 && d_hrs == 0 && d_days == 0) { printf(\"0 seconds \"); }
}
int main(int argc, const char **argv) {
FILE *infp = NULL; time_t t = time(NULL); long start_time;
if (argc < 3) return 1;
if (strncmp(argv[1], \"final\", 5) == 0) {
if (argc < 4) return 1;
printf(\"Done.\\n\\nBRL-CAD Release ${BRLCAD_VERSION}, Build ${CONFIG_DATE}\\n\\nElapsed compilation time: \");
infp = fopen(argv[2], \"r\"); (void)fscanf(infp, \"%ld\", &start_time); ; fclose(infp); printtime(((long)t) - start_time);
printf(\"\\nElapsed time since configuration: \");
infp = fopen(argv[3], \"r\"); (void)fscanf(infp, \"%ld\", &start_time); ; fclose(infp); printtime(((long)t) - start_time);
printf(\"\\n---\\n${INSTALL_LINE}\\n${BENCHMARK_LINE}\\n\\n\");
return 0;
}
printf(\"%s\", argv[1]);
infp = fopen(argv[2], \"r\"); (void)fscanf(infp, \"%ld\", &start_time); ; fclose(infp); printtime(((long)t) - start_time);
printf(\"\\n\");
return 0;
}
")
# Build the code so we can run it
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/dreport.c" "${dreport_src}")
try_compile(dreport_build "${CMAKE_BINARY_DIR}/CMakeTmp"
SOURCES "${CMAKE_BINARY_DIR}/CMakeTmp/dreport.c"
OUTPUT_VARIABLE FREPORT_BUILD_INFO
COPY_FILE "${CMAKE_BINARY_DIR}/CMakeTmp/dreport${EXE_EXT}")
if(NOT dreport_build)
message(FATAL_ERROR "Could not build time delta reporting utility: ${FREPORT_BUILD_INFO}")
endif(NOT dreport_build)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/dreport.c")
if(COMMAND distclean)
distclean("${CMAKE_BINARY_DIR}/CMakeTmp/dreport")
endif(COMMAND distclean)
endfunction(generate_timer_exes)
# Local Variables:
# tab-width: 8
# mode: cmake
+101
View File
@@ -0,0 +1,101 @@
set(cmake_ignore_files
BRLCAD_CPackOptions.cmake.in
BRLCAD_CheckFunctions.cmake
BRLCAD_Options.cmake
BRLCAD_Summary.cmake
BRLCAD_Targets.cmake
BRLCAD_Util.cmake
CheckCInline.cmake
CheckCSourceRuns.cmake
CompilerFlags.cmake
Distcheck.cmake
DocBook.cmake
Doxygen.cmake
FindADAPTAGRAMS.cmake
FindASTYLE.cmake
FindBRLCADTCL.cmake
FindBRLCADZLIB.cmake
FindBSON.cmake
FindFontconfig.cmake
FindGDAL.cmake
FindGECODE.cmake
FindGL.cmake
FindLEMON.cmake
FindLEX.cmake
FindLZ4.cmake
FindNETPBM.cmake
FindOIIO.cmake
FindOPENNURBS.cmake
FindOSL.cmake
FindOpenCL.cmake
FindOpenEXR.cmake
FindPERPLEX.cmake
FindPkgMacros.cmake
FindPROJ4.cmake
FindRE2C.cmake
FindREGEX.cmake
FindSCL.cmake
FindSTL.cmake
FindShellDeps.cmake
FindTBB.cmake
FindTERMLIB.cmake
FindTINYCTHREAD.cmake
FindUTAHRLE.cmake
FindUUID.cmake
FindVDS.cmake
FindX11.cmake
FindXMLLINT.cmake
FindXSLTPROC.cmake
Fink_MacPorts.cmake
NSIS.template.in
Path_Setup.cmake
RPath_Setup.cmake
ResetCache.cmake
TCL_PKGINDEX.cmake
ThirdParty.cmake
ThirdParty_TCL.cmake
compat/README
compat/README.compat
compat/README.compat.c99
compat/fdopen_compat.h
compat/fileno_compat.h
compat/gethostname_compat.h
compat/hypot_compat.h
compat/posix_memalign_compat.h
compat/realpath_compat.h
compat/sigaction_compat.h
compat/snprintf_compat.h
compat/strcasecmp_compat.h
compat/strncasecmp_compat.h
compat/strtok_r_compat.h
compat/test_fdopen.c
compat/test_fileno.c
compat/test_gethostname.c
compat/test_posix_memalign.c
compat/test_realpath.c
compat/test_sigaction.c
compat/test_strcasecmp.c
compat/test_strncasecmp.c
compat/test_strtok_r.c
configure_prefix.sh
configure_suffix.sh
distcheck_in_src_dir.cmake.in
distcheck_repo_verify.cmake.in
distcheck_target.cmake.in
distclean.cmake.in
docbook.cmake.in
multiconfig_path_clean.cmake.in
multiconfig_path_read.cmake.in
source_archive_setup.cmake.in
tcltest.tcl.in
)
CMAKEFILES(${cmake_ignore_files})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+4 -3
View File
@@ -37,6 +37,7 @@
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CMakeParseArguments)
include(CMakePushCheckState)
set(CMAKE_BUILD_TYPES DEBUG RELEASE)
@@ -226,7 +227,7 @@ macro(CHECK_FLAG)
# Iterate over listed Build types and append the flag to them if successfully tested.
foreach(build_type ${FLAG_BUILD_TYPES})
CHECK_COMPILER_FLAG(${FLAG_LANG} ${NEW_FLAG} ${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
CHECK_COMPILER_FLAG(${FLAG_LANG} "${NEW_FLAG}" ${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
if(${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
ADD_NEW_FLAG(${FLAG_LANG} NEW_FLAG "${build_type}")
endif(${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
@@ -236,7 +237,7 @@ macro(CHECK_FLAG)
# a string build, not a CMake list build. Do this for all supplied
# group variables.
foreach(flag_group ${FLAG_GROUPS})
CHECK_COMPILER_FLAG(${FLAG_LANG} ${NEW_FLAG} ${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
CHECK_COMPILER_FLAG(${FLAG_LANG} "${NEW_FLAG}" ${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
if(${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
if(${flag_group})
set(${flag_group} "${${flag_group}} ${NEW_FLAG}")
@@ -250,7 +251,7 @@ macro(CHECK_FLAG)
# the flag as the variable's value. Do this for all supplied variables.
foreach(flag_var ${FLAG_VARS})
if(NOT ${flag_var})
CHECK_COMPILER_FLAG(${FLAG_LANG} ${NEW_FLAG} ${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
CHECK_COMPILER_FLAG(${FLAG_LANG} "${NEW_FLAG}" ${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND)
if(${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND AND NOT "${${flag_var}}")
set(${flag_var} "${NEW_FLAG}")
endif(${UPPER_FLAG}_${FLAG_LANG}_FLAG_FOUND AND NOT "${${flag_var}}")
+90 -44
View File
@@ -32,8 +32,6 @@
# FindGDAL
# --------
#
#
#
# Locate gdal
#
# This module accepts the following environment variables:
@@ -69,66 +67,114 @@
#
#include "gdal.h"
include(CheckCSourceCompiles)
function(GDALTRANS_TEST HGDALTRANS)
set(CMAKE_REQUIRED_INCLUDES ${GDAL_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${GDAL_LIBRARY})
set(GT_SRCS "
#include <gdal.h>
#include <gdalwarper.h>
#include <gdal_utils.h>
#include <cpl_conv.h>
#include <cpl_string.h>
#include <cpl_multiproc.h>
#include <ogr_spatialref.h>
#include <vrtdataset.h>
int main(int ac, char *av[])
{
GDALDatasetH gd = GDALTranslate(NULL, NULL, NULL, NULL);
}
")
CHECK_C_SOURCE_COMPILES("${GT_SRCS}" H_GT)
set(${HGDALTRANS} ${H_GT} PARENT_SCOPE)
endfunction(GDALTRANS_TEST)
find_path(GDAL_INCLUDE_DIR gdal.h
HINTS
ENV GDAL_DIR
ENV GDAL_ROOT
ENV GDAL_DIR
ENV GDAL_ROOT
PATH_SUFFIXES
include/gdal
include/GDAL
include
include/gdal
include/GDAL
include
PATHS
~/Library/Frameworks/gdal.framework/Headers
/Library/Frameworks/gdal.framework/Headers
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
~/Library/Frameworks/gdal.framework/Headers
/Library/Frameworks/gdal.framework/Headers
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
# Use gdal-config to obtain the library version (this should hopefully
# allow us to -lgdal1.x.y where x.y are correct version)
# For some reason, libgdal development packages do not contain
# libgdal.so...
find_program(GDAL_CONFIG gdal-config
HINTS
ENV GDAL_DIR
ENV GDAL_ROOT
PATH_SUFFIXES bin
PATHS
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
HINTS
ENV GDAL_DIR
ENV GDAL_ROOT
PATH_SUFFIXES bin
PATHS
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
if(GDAL_CONFIG AND NOT "${GDAL_CONFIG}" MATCHES "NOTFOUND")
exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
if(GDAL_CONFIG_LIBS)
string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS})
string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}")
string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS})
string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
endif()
exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
if(GDAL_CONFIG_LIBS)
string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS})
string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}")
string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS})
string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
endif(GDAL_CONFIG_LIBS)
endif(GDAL_CONFIG AND NOT "${GDAL_CONFIG}" MATCHES "NOTFOUND")
find_library(GDAL_LIBRARY
NAMES ${_gdal_lib} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
NAMES ${_gdal_lib} gdal GDAL
HINTS
ENV GDAL_DIR
ENV GDAL_ROOT
${_gdal_libpath}
ENV GDAL_DIR
ENV GDAL_ROOT
${_gdal_libpath}
PATH_SUFFIXES lib
PATHS
/sw
/opt/local
/opt/csw
/opt
/usr/freeware
)
/sw
/opt/local
/opt/csw
/opt
/usr/freeware
)
# Check for GDALTranslate - if we don't have that, we're not in business
if(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
GDALTRANS_TEST(HAVE_GDALTRANSLATE)
if(NOT HAVE_GDALTRANSLATE)
set(GDAL_LIBRARY NOTFOUND)
set(GDAL_INCLUDE_DIR "")
endif(NOT HAVE_GDALTRANSLATE)
endif(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR HAVE_GDALTRANSLATE)
if(HAVE_GDALTRANSLATE)
set(GDAL_LIBRARIES ${GDAL_LIBRARY})
set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
endif(HAVE_GDALTRANSLATE)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
set(GDAL_LIBRARIES ${GDAL_LIBRARY})
set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
+57 -15
View File
@@ -66,14 +66,67 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#Need to run a test lex file to determine if YYTEXT_POINTER needs
#to be defined
function(yytext_pointer_test)
set(LEX_TEST_SRCS "
%option noyywrap
%%
a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
e { yyless (input () != 0); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
#ifdef YYTEXT_POINTER
extern char *yytext;
#endif
extern int yyparse();
int main (void)
{
char test_str[] = \"BRL-CAD\";
YY_BUFFER_STATE buffer = yy_scan_string(test_str);
yylex();
yy_delete_buffer(buffer);
return 0;
}
")
if(NOT DEFINED YYTEXT_POINTER)
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.l" "${LEX_TEST_SRCS}")
execute_process(COMMAND ${LEX_EXECUTABLE} -o "${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.c" "${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.l" RESULT_VARIABLE _retval OUTPUT_VARIABLE _lexOut)
try_run(YYTEXT_POINTER_RAN YYTEXT_POINTER_COMPILED
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.c"
COMPILE_DEFINITIONS "-DYYTEXT_POINTER=1"
COMPILE_OUTPUT_VARIABLE COUTPUT
RUN_OUTPUT_VARIABLE ROUTPUT)
#message("COUTPUT: ${COUTPUT}")
#message("ROUTPUT: ${ROUTPUT}")
if(YYTEXT_POINTER_COMPILED AND NOT YYTEXT_POINTER_RAN)
set(YYTEXT_POINTER 1 PARENT_SCOPE)
if(CONFIG_H_FILE)
CONFIG_H_APPEND(${CMAKE_CURRENT_PROJECT} "#define YYTEXT_POINTER 1\n")
endif(CONFIG_H_FILE)
else(YYTEXT_POINTER_COMPILED AND NOT YYTEXT_POINTER_RAN)
set(YYTEXT_POINTER 0 PARENT_SCOPE)
endif(YYTEXT_POINTER_COMPILED AND NOT YYTEXT_POINTER_RAN)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.c")
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.l")
endif(NOT DEFINED YYTEXT_POINTER)
endfunction(yytext_pointer_test)
find_program(LEX_EXECUTABLE flex DOC "path to the lex executable")
if(NOT LEX_EXECUTABLE)
find_program(LEX_EXECUTABLE lex DOC "path to the lex executable")
endif(NOT LEX_EXECUTABLE)
mark_as_advanced(LEX_EXECUTABLE)
find_library(FL_LIBRARY NAMES fl
DOC "path to the fl library")
find_library(FL_LIBRARY NAMES fl DOC "path to the fl library")
mark_as_advanced(FL_LIBRARY)
set(LEX_LIBRARIES ${FL_LIBRARY})
@@ -112,19 +165,8 @@ if(LEX_EXECUTABLE)
endmacro(LEX_TARGET)
#============================================================
#Need to run a test lex file to determine if YYTEXT_POINTER needs
#to be defined
EXEC_PROGRAM(${LEX_EXECUTABLE} ARGS "${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/lex_test.l" -o "${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.c" RETURN_VALUE _retval OUTPUT_VARIABLE _lexOut)
INCLUDE (CheckCSourceRuns)
set(FILE_RUN_DEFINITIONS "-DYYTEXT_POINTER=1")
if(NOT DEFINED YYTEXT_POINTER)
CHECK_C_SOURCE_RUNS("${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/sys_wait_test.c" YYTEXT_POINTER)
endif(NOT DEFINED YYTEXT_POINTER)
set(FILE_RUN_DEFINITIONS)
if(CONFIG_H_FILE)
CONFIG_H_APPEND(${CMAKE_CURRENT_PROJECT} "#cmakedefine YYTEXT_POINTER 1\n")
endif(CONFIG_H_FILE)
# Execute the YYTEXT pointer test defined above
yytext_pointer_test()
endif(LEX_EXECUTABLE)
+78
View File
@@ -0,0 +1,78 @@
###############################################################################
# CMake module to search for PROJ.4 library
#
# On success, the macro sets the following variables:
# PROJ4_FOUND = if the library found
# PROJ4_VERSION = version number of PROJ.4 found
# PROJ4_LIBRARIES = full path to the library
# PROJ4_INCLUDE_DIR = where to find the library headers
# Also defined, but not for general use are
# PROJ4_LIBRARY, where to find the PROJ.4 library.
#
# Copyright (c) 2009 Mateusz Loskot <mateusz@loskot.net>
#
# 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 copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the 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.
#
###############################################################################
# Try to use OSGeo4W installation
if(WIN32)
set(PROJ4_OSGEO4W_HOME "C:/OSGeo4W")
if($ENV{OSGEO4W_HOME})
set(PROJ4_OSGEO4W_HOME "$ENV{OSGEO4W_HOME}")
endif()
endif()
find_path(PROJ4_INCLUDE_DIR proj_api.h
PATHS ${PROJ4_OSGEO4W_HOME}/include
DOC "Path to PROJ.4 library include directory")
if (PROJ4_INCLUDE_DIR)
# Extract version from proj_api.h (ex: 480)
file(STRINGS ${PROJ4_INCLUDE_DIR}/proj_api.h
PJ_VERSIONSTR
REGEX "#define[ ]+PJ_VERSION[ ]+[0-9]+")
string(REGEX MATCH "[0-9]+" PJ_VERSIONSTR ${PJ_VERSIONSTR})
# TODO: Should be formatted as 4.8.0?
set(PROJ4_VERSION ${PJ_VERSIONSTR})
endif()
set(PROJ4_NAMES ${PROJ4_NAMES} proj proj_i)
find_library(PROJ4_LIBRARY
NAMES ${PROJ4_NAMES}
PATHS ${PROJ4_OSGEO4W_HOME}/lib
DOC "Path to PROJ.4 library file")
if(PROJ4_LIBRARY)
set(PROJ4_LIBRARIES ${PROJ4_LIBRARY})
endif()
# Handle the QUIETLY and REQUIRED arguments and set PROJ4_FOUND to TRUE
# if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PROJ4 DEFAULT_MSG
PROJ4_LIBRARY
PROJ4_INCLUDE_DIR)
+4 -2
View File
@@ -44,6 +44,8 @@
#
#=============================================================================
include(CheckCSourceRuns)
set(stl_test_src "
int
main(int ac, char *av[])
@@ -61,7 +63,7 @@ if(NOT DEFINED STL_LIB_TEST)
# first try with no library
set(CMAKE_REQUIRED_LIBRARIES "")
CHECK_C_SOURCE_RUNS("${stl_test_src}" STL_LIB_TEST)
check_c_source_runs("${stl_test_src}" STL_LIB_TEST)
if("${STL_LIB_TEST}" EQUAL 1)
# succeeded - no STL needed
@@ -73,7 +75,7 @@ if(NOT DEFINED STL_LIB_TEST)
endif(NOT STDCXX_LIBRARIES)
set(CMAKE_REQUIRED_LIBRARIES "${STDCXX_LIBRARIES}")
CHECK_C_SOURCE_RUNS("${stl_test_src}" STL_LIB_TEST)
check_c_source_runs("${stl_test_src}" STL_LIB_TEST)
if("${STL_LIB_TEST}" EQUAL 1)
set(STDCXX_LIBRARIES "${STDCXX_LIBRARIES}" CACHE STRING "STL found" FORCE)
+78 -17
View File
@@ -45,38 +45,99 @@ include(CheckLibraryExists)
include(CheckIncludeFiles)
include(CheckCSourceRuns)
macro(TERMLIB_CHECK_LIBRARY lname func headers)
set(termlib_src "
#ifdef HAVE_TERMLIB_H
# include <termlib.h>
#else
# ifdef HAVE_NCURSES_H
# include <ncurses.h>
# else
# ifdef HAVE_CURSES_H
# include <curses.h>
# else
# ifdef HAVE_TERMCAP_H
# include <termcap.h>
# else
# ifdef HAVE_TERMINFO_H
# include <terminfo.h>
# else
# ifdef HAVE_TINFO_H
# include <tinfo.h>
# endif
# endif
# endif
# endif
# endif
# ifdef HAVE_TERM_H
# include <term.h>
# endif
#endif
int main (void) {
char buffer[2048] = {0};
(void)tgetent(buffer, \"vt100\");
return 0;
}
")
include(CheckCCompilerFlag)
check_c_compiler_flag(-Wall WALL_FLAG)
if(WALL_FLAG)
set(WALL_DEF "-Wall")
endif(WALL_FLAG)
check_c_compiler_flag(-Werror WERROR_FLAG)
if(WERROR_FLAG)
set(WERROR_DEF "-Werror")
endif(WERROR_FLAG)
function(TERMLIB_CHECK_LIBRARY lname func headers)
if(NOT TERMLIB_LIBRARY OR "${TERMLIB_LIBRARY}" MATCHES "NOTFOUND")
CHECK_LIBRARY_EXISTS(${lname} ${func} "" HAVE_TERMLIB_${lname})
if(HAVE_TERMLIB_${lname})
# Got lib, now sort through headers
foreach(hdr ${headers})
string(TOUPPER "${hdr}" HDR)
string(REGEX REPLACE "[^A-Z0-9]" "_" HDR "${HDR}")
CHECK_INCLUDE_FILES(${hdr} HAVE_${HDR})
if(NOT TERMLIB_INCLUDE_DIR OR "${TERMLIB_INCLUDE_DIR}" MATCHES "NOTFOUND")
string(TOUPPER "${hdr}" HDR)
string(REGEX REPLACE "[^A-Z0-9]" "_" HDR "${HDR}")
CHECK_INCLUDE_FILES(${hdr} HAVE_${HDR})
find_path(TERMLIB_INCLUDE_DIR "${hdr}")
if(NOT "${TERMLIB_INCLUDE_DIR}" MATCHES "NOTFOUND")
set(LIBTERM_RESULT)
set(LIBTERM_RESULT 1)
set(TERMLIB_LIBRARY "${lname}")
configure_file("${BRLCAD_CMAKE_DIR}/test_srcs/termlib.c.in" "${CMAKE_BINARY_DIR}/CMakeTmp/termlib.c")
set(CMAKE_REQUIRED_LIBRARIES_BAK ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${TERMLIB_LIBRARY})
if(NOT DEFINED LIBTERM_RESULT)
CHECK_C_SOURCE_RUNS("${CMAKE_BINARY_DIR}/CMakeTmp/termlib.c" LIBTERM_RESULT)
endif(NOT DEFINED LIBTERM_RESULT)
if(NOT LIBTERM_RESULT)
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/termlib.c" "${termlib_src}")
if(LIBTERM_RESULT)
set(CMAKE_C_FLAGS "") # We need -Wall and -Werror, without -w
try_run(LIBTERM_RESULT LIBTERM_COMPILE "${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/termlib.c"
COMPILE_DEFINITIONS -DHAVE_${HDR} ${WALL_DEF} ${WERROR_DEF}
LINK_LIBRARIES "${lname}"
COMPILE_OUTPUT_VARIABLE CTERM_OUT
RUN_OUTPUT_VARIABLE RTERM_OUT)
#message("CTERM: ${CTERM_OUT}")
#message("RTERM: ${RTERM_OUT}")
#message("LIBTERM_RESULT: ${LIBTERM_RESULT}")
endif(LIBTERM_RESULT)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/termlib.c")
if(LIBTERM_RESULT)
set(TERMLIB_LIBRARY "NOTFOUND" CACHE STRING "TERMLIB" FORCE)
else(NOT LIBTERM_RESULT)
set(TERMLIB_LIBRARY ${TERMLIB_LIBRARY} CACHE STRING "TERMLIB" FORCE)
endif(NOT LIBTERM_RESULT)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BAK})
set(TERMLIB_INCLUDE_DIR "NOTFOUND" CACHE STRING "TERMLIB" FORCE)
unset(HAVE_${HDR} CACHE)
else(LIBTERM_RESULT)
# Have a winning combination. Set lib and include dir
set(TERMLIB_LIBRARY ${lname} CACHE STRING "TERMLIB" FORCE)
set(TERMLIB_LIBRARY ${lname} PARENT_SCOPE)
set(TERMLIB_INCLUDE_DIR "${TERMLIB_INCLUDE_DIR}" CACHE STRING "TERMLIB" FORCE)
set(TERMLIB_INCLUDE_DIR "${TERMLIB_INCLUDE_DIR}" PARENT_SCOPE)
# We also want this header's test (and only this header) to be
# reported as successful in the parent
set(HAVE_${HDR} 1 CACHE BOOL "TERMLIB" FORCE PARENT_SCOPE)
return()
endif(LIBTERM_RESULT)
endif(NOT "${TERMLIB_INCLUDE_DIR}" MATCHES "NOTFOUND")
endif(NOT TERMLIB_INCLUDE_DIR OR "${TERMLIB_INCLUDE_DIR}" MATCHES "NOTFOUND")
endforeach(hdr ${headers})
endif(HAVE_TERMLIB_${lname})
endif(NOT TERMLIB_LIBRARY OR "${TERMLIB_LIBRARY}" MATCHES "NOTFOUND")
endmacro(TERMLIB_CHECK_LIBRARY lname func)
endfunction(TERMLIB_CHECK_LIBRARY lname func)
TERMLIB_CHECK_LIBRARY(termlib tputs "termlib.h")
TERMLIB_CHECK_LIBRARY(ncurses tputs "ncurses.h;curses.h;termcap.h;term.h")
+40 -20
View File
@@ -36,29 +36,49 @@
# Documentation of these options is available at
# http://www.cmake.org/Wiki/CMake_RPATH_handling
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
if(NOT COMMAND cmake_set_rpath)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
function(cmake_set_rpath)
# the RPATH/INSTALL_NAME_DIR to be used when installing
if(NOT APPLE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}:\$ORIGIN/../${LIB_DIR}")
else(NOT APPLE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR};@loader_path/../${LIB_DIR}")
endif(NOT APPLE)
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH for CMake < 3.0
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
# http://www.cmake.org/cmake/help/v3.2/policy/CMP0042.html
if ("${CMAKE_VERSION}" VERSION_LESS 3.0)
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
endif ("${CMAKE_VERSION}" VERSION_LESS 3.0)
if(NOT CMAKE_RPATH_SET)
# 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)
# 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)
# 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)
# 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}/${LIB_DIR}:\$ORIGIN/../${LIB_DIR}" PARENT_SCOPE)
else(NOT APPLE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR};@loader_path/../${LIB_DIR}" PARENT_SCOPE)
endif(NOT APPLE)
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH for CMake < 3.0
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
# http://www.cmake.org/cmake/help/v3.2/policy/CMP0042.html
if ("${CMAKE_VERSION}" VERSION_LESS 3.0)
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}" PARENT_SCOPE)
endif ("${CMAKE_VERSION}" VERSION_LESS 3.0)
# 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)
# RPATH setup is now complete
set(CMAKE_RPATH_SET 1 PARENT_SCOPE)
endif(NOT CMAKE_RPATH_SET)
endfunction(cmake_set_rpath)
endif(NOT COMMAND cmake_set_rpath)
# Local Variables:
# tab-width: 8
+26 -28
View File
@@ -35,44 +35,42 @@
#============================================================
# TCL_PKGINDEX
#============================================================
macro(TCL_PKGINDEX target pkgname pkgversion)
function(TCL_PKGINDEX target pkgname pkgversion)
# Identify the shared library suffix to be used
set(lname ${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX})
# Create a "working" pkgIndex.tcl file that will allow
# the package to work from the build directory
set(lld_install "${LIB_DIR}")
if(MSVC)
set(lld_install "${BIN_DIR}")
endif(MSVC)
if(NOT CMAKE_CONFIGURATION_TYPES)
set(loadable_libdir_build "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(loadable_libdir_install "${LIB_DIR}")
if(CMAKE_BUILD_TYPE)
get_target_property(target_LIBLOCATION ${target} LOCATION_${CMAKE_BUILD_TYPE})
else(CMAKE_BUILD_TYPE)
get_target_property(target_LIBLOCATION ${target} LOCATION)
endif(CMAKE_BUILD_TYPE)
get_filename_component(target_LIBNAME ${target_LIBLOCATION} NAME)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir .. .. \"${loadable_libdir_install}\" ${target_LIBNAME}] ${pkgname}]")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl" DESTINATION lib/${pkgname}${pkgversion})
file(WRITE "${CMAKE_BINARY_DIR}/lib/${pkgname}${pkgversion}/pkgIndex.tcl" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir \"${loadable_libdir_build}\" ${target_LIBNAME}] ${pkgname}]")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl")
set(lld_build "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(bpkgindex "${CMAKE_BINARY_DIR}/lib/${pkgname}${pkgversion}/pkgIndex.tcl")
file(WRITE "${bpkgindex}" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir \"${lld_build}\" ${lname}] ${pkgname}]")
DISTCLEAN("${CMAKE_BINARY_DIR}/lib/${pkgname}${pkgversion}")
else(NOT CMAKE_CONFIGURATION_TYPES)
if(MSVC)
set(loadable_libdir_install "${BIN_DIR}")
else(MSVC)
set(loadable_libdir_install "${LIB_DIR}")
endif(MSVC)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl")
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
set(bpkgindex "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}/${pkgname}${pkgversion}/pkgIndex.tcl")
set(lld_build "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
if(MSVC)
set(loadable_libdir_build "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
else(MSVC)
set(loadable_libdir_build "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
set(lld_build "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
endif(MSVC)
get_target_property(target_LIBLOCATION ${target} LOCATION_${CFG_TYPE_UPPER})
get_filename_component(target_LIBNAME ${target_LIBLOCATION} NAME)
file(WRITE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}/${pkgname}${pkgversion}/pkgIndex.tcl "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir \"${loadable_libdir_build}\" ${target_LIBNAME}] ${pkgname}]")
file(WRITE "${bpkgindex}" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir \"${lld_build}\" ${lname}] ${pkgname}]")
DISTCLEAN(${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}/${pkgname}${pkgversion})
endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir .. .. \"${loadable_libdir_install}\" ${target_LIBNAME}] ${pkgname}]")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl" DESTINATION lib/${pkgname}${pkgversion})
endif(NOT CMAKE_CONFIGURATION_TYPES)
endmacro(TCL_PKGINDEX)
# Create the file Tcl will use once installed
set(ipkgindex "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl")
file(WRITE "${ipkgindex}" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir .. .. \"${lld_install}\" ${lname}] ${pkgname}]")
install(FILES "${ipkgindex}" DESTINATION lib/${pkgname}${pkgversion})
DISTCLEAN("${ipkgindex}")
endfunction(TCL_PKGINDEX)
# Local Variables:
# tab-width: 8
+98 -103
View File
@@ -53,46 +53,45 @@ include(CMakeParseArguments)
# )
#-----------------------------------------------------------------------------
macro(THIRD_PARTY dir varname_root build_target description)
function(THIRD_PARTY dir varname_root build_target description)
# Parse extra arguments
CMAKE_PARSE_ARGUMENTS(TP "UNDOCUMENTED" "FIND_NAME;FIND_VERSION" "FIND_COMPONENTS;REQUIRED_VARS;RESET_VARS;ALIASES;FLAGS" ${ARGN})
# If the library variable has been explicitly set, get
# an varname_rootcase version of it for easier matching
if(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
string(TOUPPER "${${CMAKE_PROJECT_NAME}_${varname_root}}" OPT_STR_UPPER)
else(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
set(OPT_STR_UPPER "")
endif(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
if(NOT ${OPT_STR_UPPER} STREQUAL "")
if(${OPT_STR_UPPER} STREQUAL "ON")
set(OPT_STR_UPPER "BUNDLED")
endif(${OPT_STR_UPPER} STREQUAL "ON")
if(${OPT_STR_UPPER} STREQUAL "OFF")
set(OPT_STR_UPPER "SYSTEM")
endif(${OPT_STR_UPPER} STREQUAL "OFF")
endif(NOT ${OPT_STR_UPPER} STREQUAL "")
if(${ARGC} GREATER 3)
# Parse extra arguments
CMAKE_PARSE_ARGUMENTS(${varname_root} "UNDOCUMENTED" "FIND_NAME;FIND_VERSION" "FIND_COMPONENTS;REQUIRED_VARS;RESET_VARS;ALIASES;FLAGS" ${ARGN})
endif(${ARGC} GREATER 3)
if(NOT ${varname_root}_FIND_NAME)
set(${varname_root}_FIND_NAME ${varname_root})
endif(NOT ${varname_root}_FIND_NAME)
# a 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(${varname_root}_DISABLED 0)
set(${varname_root}_DISABLE_TEST 0)
set(${varname_root}_MET_CONDITION 0)
foreach(item ${${varname_root}_RESET_VARS})
set(TP_DISABLED 0)
set(TP_DISABLE_TEST 0)
set(TP_MET_CONDITION 0)
if(NOT TP_FIND_NAME)
set(TP_FIND_NAME ${varname_root})
endif(NOT TP_FIND_NAME)
foreach(item ${TP_RESET_VARS})
set(${item} "${varname_root}-NOTFOUND" CACHE STRING "${item}" FORCE)
endforeach(item ${${varname_root}_RESET_VARS})
endforeach(item ${TP_RESET_VARS})
# 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. If any of the required flags are off, this extension is a no-go.
set(DISABLE_STR "")
foreach(item ${${varname_root}_REQUIRED_VARS})
foreach(item ${TP_REQUIRED_VARS})
if(NOT ${item})
set(${varname_root}_DISABLED 1)
set(${varname_root}_DISABLE_TEST 1)
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}")
@@ -100,83 +99,83 @@ macro(THIRD_PARTY dir varname_root build_target description)
set(DISABLE_STR "${DISABLE_STR},${item}")
endif(NOT DISABLE_STR)
endif(NOT ${item})
endforeach(item ${${varname_root}_REQUIRED_VARS})
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_property(CACHE ${CMAKE_PROJECT_NAME}_${varname_root} PROPERTY STRINGS "DISABLED ${DISABLE_STR}")
set(${varname_root}_MET_CONDITION 1)
set(TP_MET_CONDITION 1)
else(DISABLE_STR)
# If we have a leftover disabled setting in the cache from earlier runs, clear it.
if("${CMAKE_PROJECT_NAME}_${varname_root}" MATCHES "DISABLED")
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("${CMAKE_PROJECT_NAME}_${varname_root}" MATCHES "DISABLED")
endif("${local_opt}" MATCHES "DISABLED")
endif(DISABLE_STR)
# 2. Next - is the library variable explicitly set to SYSTEM? If it is, we are NOT building it.
if(OPT_STR_UPPER)
if("${OPT_STR_UPPER}" STREQUAL "SYSTEM")
if(local_opt)
if("${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM" CACHE STRING "User forced to SYSTEM" FORCE)
set(${varname_root}_MET_CONDITION 2)
foreach(extraarg ${${varname_root}_FLAGS})
set(TP_MET_CONDITION 2)
foreach(extraarg ${TP_FLAGS})
if(extraarg STREQUAL "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(extraarg STREQUAL "NOSYS")
endforeach(extraarg ${${varname_root}_FLAGS})
endif("${OPT_STR_UPPER}" STREQUAL "SYSTEM")
endif(OPT_STR_UPPER)
endforeach(extraarg ${TP_FLAGS})
endif("${local_opt}" STREQUAL "SYSTEM")
endif(local_opt)
# 3. If we have a NOSYS flag and aren't explicitly disabled, 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...)
if(NOT ${varname_root}_MET_CONDITION)
foreach(extraarg ${${varname_root}_FLAGS})
if(NOT TP_MET_CONDITION)
foreach(extraarg ${TP_FLAGS})
if(extraarg STREQUAL "NOSYS")
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED" CACHE STRING "NOSYS passed, using bundled ${build_target}" FORCE)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${varname_root}_MET_CONDITION 3)
set(${varname_root}_DISABLE_TEST 1)
set(TP_MET_CONDITION 3)
set(TP_DISABLE_TEST 1)
endif(extraarg STREQUAL "NOSYS")
endforeach(extraarg ${${varname_root}_FLAGS})
endif(NOT ${varname_root}_MET_CONDITION)
endforeach(extraarg ${TP_FLAGS})
endif(NOT TP_MET_CONDITION)
# 4. If we have an explicit BUNDLE request for this particular library, honor it as long as
# features are satisfied. No point in testing if we know we're turning it on - set vars accordingly.
if(OPT_STR_UPPER)
if("${OPT_STR_UPPER}" STREQUAL "BUNDLED")
if(NOT ${varname_root}_MET_CONDITION)
if(local_opt)
if("${local_opt}" STREQUAL "BUNDLED")
if(NOT TP_MET_CONDITION)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED" CACHE STRING "User forced to BUNDLED" FORCE)
set(${varname_root}_DISABLE_TEST 1)
set(${varname_root}_MET_CONDITION 4)
endif(NOT ${varname_root}_MET_CONDITION)
endif("${OPT_STR_UPPER}" STREQUAL "BUNDLED")
endif(OPT_STR_UPPER)
set(TP_DISABLE_TEST 1)
set(TP_MET_CONDITION 4)
endif(NOT TP_MET_CONDITION)
endif("${local_opt}" STREQUAL "BUNDLED")
endif(local_opt)
# 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 ${varname_root}_MET_CONDITION)
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(${varname_root}_MET_CONDITION 5)
set(TP_MET_CONDITION 5)
elseif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${varname_root}_DISABLE_TEST 1)
set(${varname_root}_MET_CONDITION 5)
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 ${varname_root}_MET_CONDITION)
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 ${varname_root}_DISABLE_TEST)
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})
@@ -197,7 +196,7 @@ macro(THIRD_PARTY dir varname_root build_target description)
# Find*.cmake scripts that should be used. Note that newer CMake versions will prefer a system
# version of the module, so if a custom override is needed the Find*.cmake name should not conflict
# with the system version.
find_package(${${varname_root}_FIND_NAME} ${${varname_root}_FIND_VERSION} COMPONENTS ${${varname_root}_FIND_COMPONENTS})
find_package(${TP_FIND_NAME} ${TP_FIND_VERSION} COMPONENTS ${TP_FIND_COMPONENTS})
# going to use system or bundled versions of deps
if(${varname_root}_FOUND)
@@ -207,21 +206,21 @@ macro(THIRD_PARTY dir varname_root build_target description)
endif(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
else(${varname_root}_FOUND)
# If one of our previous conditions precludes building this library, we've got a problem.
if("${OPT_STR_UPPER}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
if("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
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 "${OPT_STR_UPPER}" STREQUAL "SYSTEM")
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 "${OPT_STR_UPPER}" STREQUAL "SYSTEM")
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 "${OPT_STR_UPPER}" STREQUAL "SYSTEM")
else("${OPT_STR_UPPER}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
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("${OPT_STR_UPPER}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
endif("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
endif(${varname_root}_FOUND)
endif(NOT ${varname_root}_DISABLE_TEST)
endif(NOT TP_DISABLE_TEST)
# If we're going with a system version of a library, we have to remove any previously built
# output from enabled bundled copies of the library in question, or the linker will get
@@ -241,11 +240,11 @@ macro(THIRD_PARTY dir varname_root build_target description)
)
endforeach(stale_file ${STALE_FILES})
if(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" MATCHES "${OPT_STR_UPPER}")
if("${OPT_STR_UPPER}" MATCHES "BUNDLED")
if(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" MATCHES "${local_opt}")
if("${local_opt}" MATCHES "BUNDLED")
message("Reconfiguring to use system ${varname_root}")
endif("${OPT_STR_UPPER}" MATCHES "BUNDLED")
endif(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" MATCHES "${OPT_STR_UPPER}")
endif("${local_opt}" MATCHES "BUNDLED")
endif(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" MATCHES "${local_opt}")
endif(NOT ${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
# After all that, we know now what to do about src/other/${dir} - do it
@@ -253,19 +252,19 @@ macro(THIRD_PARTY dir varname_root build_target description)
add_subdirectory(${dir})
set(${varname_root}_LIBRARY "${build_target}" CACHE STRING "${varname_root}_LIBRARY" FORCE)
set(${varname_root}_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${dir}" "${CMAKE_CURRENT_BINARY_DIR}/${dir}" CACHE STRING "set by THIRD_PARTY_SUBDIR macro" FORCE)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
include("${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
CMAKEFILES_IN_DIR(${dir}_ignore_files ${dir})
else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
message("Bundled build, but file \"${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist\" not found")
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
else(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
CMAKEFILES(${dir})
endif(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
# Let parent scope know what's happening
set(${varname_root}_LIBRARY "${${varname_root}_LIBRARY}" PARENT_SCOPE)
set(${varname_root}_INCLUDE_DIR "${${varname_root}_INCLUDE_DIR}" PARENT_SCOPE)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ${${CMAKE_PROJECT_NAME}_${varname_root}_BUILD} PARENT_SCOPE)
set(${CMAKE_PROJECT_NAME}_${varname_root} "${${CMAKE_PROJECT_NAME}_${varname_root}}" PARENT_SCOPE)
if(NOT ${varname_root}_UNDOCUMENTED)
OPTION_ALIASES("${CMAKE_PROJECT_NAME}_${varname_root}" "${varname_root}_ALIASES" "ABS")
OPTION_DESCRIPTION("${CMAKE_PROJECT_NAME}_${varname_root}" "${varname_root}_ALIASES" "${description}")
BRLCAD_OPTION("${CMAKE_PROJECT_NAME}_${varname_root}" "${${CMAKE_PROJECT_NAME}_${varname_root}}"
TYPE ABS
ALIASES ${TP_ALIASES}
DESCRIPTION "${description}")
endif(NOT ${varname_root}_UNDOCUMENTED)
# For drop-down menus in CMake gui - set STRINGS property
@@ -273,11 +272,12 @@ macro(THIRD_PARTY dir varname_root build_target description)
mark_as_advanced(${varname_root}_LIBRARY)
mark_as_advanced(${varname_root}_INCLUDE_DIR)
endmacro(THIRD_PARTY)
endfunction(THIRD_PARTY)
#-----------------------------------------------------------------------------
macro(THIRD_PARTY_EXECUTABLE lower dir required_vars aliases description)
string(TOUPPER ${lower} upper)
# If the exec variable has been explicitly set, get
# an uppercase version of it for easier matching
@@ -295,6 +295,15 @@ macro(THIRD_PARTY_EXECUTABLE lower dir required_vars aliases description)
endif(${OPT_STR_UPPER} STREQUAL "OFF")
endif(NOT ${OPT_STR_UPPER} STREQUAL "")
# 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})
# 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
@@ -518,23 +527,11 @@ macro(THIRD_PARTY_EXECUTABLE lower dir required_vars aliases description)
list(REMOVE_DUPLICATES SRC_OTHER_ADDED_DIRS)
set(SRC_OTHER_ADDED_DIRS ${SRC_OTHER_ADDED_DIRS} CACHE STRING "Enabled 3rd party sub-directories" FORCE)
mark_as_advanced(SRC_OTHER_ADDED_DIRS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
include("${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
CMAKEFILES_IN_DIR(${dir}_ignore_files ${dir})
else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
message("Bundled build, but file \"${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist\" not found")
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
endif("${ADDED_RESULT}" STREQUAL "-1")
else(SRC_OTHER_ADDED_DIRS)
add_subdirectory(${dir})
set(SRC_OTHER_ADDED_DIRS ${dir} CACHE STRING "Enabled 3rd party sub-directories" FORCE)
mark_as_advanced(SRC_OTHER_ADDED_DIRS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
include("${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
CMAKEFILES_IN_DIR(${dir}_ignore_files ${dir})
else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
message("Bundled build, but file \"${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist\" not found")
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}.dist")
endif(SRC_OTHER_ADDED_DIRS)
if(CMAKE_CONFIGURATION_TYPES)
set(${upper}_EXECUTABLE "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${BIN_DIR}/${lower}" CACHE STRING "${upper}_EXECUTABLE" FORCE)
@@ -543,15 +540,13 @@ macro(THIRD_PARTY_EXECUTABLE lower dir required_vars aliases description)
endif(CMAKE_CONFIGURATION_TYPES)
set(${upper}_EXECUTABLE_TARGET ${lower} CACHE STRING "Build target for ${lower}" FORCE)
else(${CMAKE_PROJECT_NAME}_${upper}_BUILD)
CMAKEFILES(${dir})
set(${upper}_EXECUTABLE_TARGET "" CACHE STRING "No build target for ${lower}" FORCE)
endif(${CMAKE_PROJECT_NAME}_${upper}_BUILD)
OPTION_ALIASES("${CMAKE_PROJECT_NAME}_${upper}" "${aliases}" "ABS")
OPTION_DESCRIPTION("${CMAKE_PROJECT_NAME}_${upper}" "${aliases}" "${description}")
# For drop-down menus in CMake gui - set STRINGS property
set_property(CACHE ${CMAKE_PROJECT_NAME}_${upper} PROPERTY STRINGS AUTO BUNDLED SYSTEM)
BRLCAD_OPTION("${CMAKE_PROJECT_NAME}_${upper}" "${${CMAKE_PROJECT_NAME}_${upper}}"
TYPE ABS
ALIASES ${${aliases}}
DESCRIPTION "${description}")
mark_as_advanced(${upper}_EXECUTABLE)
mark_as_advanced(${upper}_EXECUTABLE_TARGET)
+13 -15
View File
@@ -123,6 +123,15 @@ macro(THIRD_PARTY_TCL_PACKAGE pkgname dir wishcmd depends required_vars NEEDS_LI
set(${PKGNAME_UPPER}_DISABLE_TEST 0)
set(${PKGNAME_UPPER}_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} 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. First up - If any of the required flags are off, not only is this extension
# build a no-go but so is the test - BRL-CAD doesn't require it.
set(DISABLE_STR "")
@@ -321,8 +330,6 @@ macro(THIRD_PARTY_TCL_PACKAGE pkgname dir wishcmd depends required_vars NEEDS_LI
string(TOLOWER ${pkgname} PKGNAME_LOWER)
# If testing was disabled, we only care what the _BUILD variable says.
# Even if DISABLED, we still need the distcheck ignore, so do the following
# for ALL situations.
if(${PKGNAME_UPPER}_DISABLE_TEST)
if(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
add_subdirectory(${dir})
@@ -332,10 +339,6 @@ macro(THIRD_PARTY_TCL_PACKAGE pkgname dir wishcmd depends required_vars NEEDS_LI
add_dependencies(${pkgname} ${dep})
endif(BRLCAD_BUILD_${DEP_UPPER})
endforeach(dep ${depends})
include("${CMAKE_CURRENT_SOURCE_DIR}/${PKGNAME_LOWER}.dist")
CMAKEFILES_IN_DIR(${PKGNAME_LOWER}_ignore_files ${dir})
else(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
CMAKEFILES(${dir})
endif(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
endif(${PKGNAME_UPPER}_DISABLE_TEST)
@@ -383,18 +386,13 @@ macro(THIRD_PARTY_TCL_PACKAGE pkgname dir wishcmd depends required_vars NEEDS_LI
add_dependencies(${pkgname} ${dep})
endif(BRLCAD_BUILD_${DEP_UPPER})
endforeach(dep ${depends})
include("${CMAKE_CURRENT_SOURCE_DIR}/${PKGNAME_LOWER}.dist")
CMAKEFILES_IN_DIR(${PKGNAME_LOWER}_ignore_files ${dir})
else(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
CMAKEFILES(${dir})
endif(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
endif(NOT ${PKGNAME_UPPER}_MET_CONDITION)
OPTION_ALIASES("${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}" "${aliases}" "ABS")
OPTION_DESCRIPTION("${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}" "${aliases}" "${description}")
# For drop-down menus in CMake gui - set STRINGS property
set_property(CACHE ${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} PROPERTY STRINGS AUTO BUNDLED SYSTEM)
BRLCAD_OPTION("${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}" "${${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}}"
TYPE ABS
ALIASES ${${aliases}}
DESCRIPTION "${description}")
endmacro(THIRD_PARTY_TCL_PACKAGE)
-344
View File
@@ -1,344 +0,0 @@
# A U T O H E A D E R . C M A K E
#
# BRL-CAD
#
# Copyright (c) 2011-2016 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.
cmake_policy(SET CMP0064 OLD)
# The purpose of this logic is to scan a set of C/C++ source files to identify
# all of the variables the CMake configure process may need to set.
# The global property C_DEFINE_VARS will hold the list of defined variables
# found.
# TODO - Use https://sourceforge.net/p/predef/wiki/Home/ to create more
# comprehensive and less ad-hoc lists of flags for OS, arch, etc.
# A user can suppress consideration of definitions that match one or a set of
# patterns. There are some "standard" patterns that are automatically skipped
# - tests matching the "header guard" pattern are skipped, as are defines
# matching the "EXPORT" and "IMPORT" substrings, operating system and compiler
# identifiers, and various other flags that do not typically need user-defined
# configure stage testing.
set_property(GLOBAL APPEND PROPERTY C_DEFINE_SKIPPATTERNS ".*EXPORT.*")
set_property(GLOBAL APPEND PROPERTY C_DEFINE_SKIPPATTERNS ".*IMPORT.*")
function(autoheader_ignore_define def)
if("${def}" MATCHES ".*[*].*")
set_property(GLOBAL APPEND PROPERTY C_DEFINE_SKIPPATTERNS "${def}")
else("${def}" MATCHES ".*[*].*")
set_property(GLOBAL APPEND PROPERTY C_DEFINE_SKIPVARS "${def}")
endif("${def}" MATCHES ".*[*].*")
endfunction(autoheader_ignore_define)
function(autoheader_ignore_defines deflist)
foreach(def ${${deflist}})
autoheader_ignore_define(${def})
endforeach(def ${${deflist}})
endfunction(autoheader_ignore_defines)
function(autoheader_skip_files def)
set_property(GLOBAL APPEND PROPERTY FILE_SKIPPATTERNS "${def}")
endfunction(autoheader_skip_files)
# OS flags. For performance, put most common
# comparisons first (that'll typicall be
# Windows related tests)
set(OS_FLAGS
WIN32
WIN32_LEAN_AND_MEAN
_WIN32
_WIN64
_WINDOWS
__WIN32__
__WIN64
__WINDOWS__
__APPLE__
BSD
CRAY1
CRAY2
FREEBSD
MSDOS
SUNOS
SYSV
_AIX
_BEOS
_BEOS_
_IBMR2
_SCO_SV
_SGI
_ULTRIX
_WINSOCKAPI_
_XENIX
__AIX
__AIX__
__ANDROID__
__BEOS__
__BeOS
__CRAYXC
__CRAYXE
__CYGWIN__
__DARWIN__
__DOS__
__FreeBSD__
__GNU__
__HAIKU__
__LINUX__
__MSDOS__
__NT__
__NetBSD
__NetBSD__
__OPENBSD
__OS2__
__OS400__
__OpenBSD__
__QNX__
__SCO_VERSION__
__TRU64__
__aix
__aix__
__alpha
__alpha__
__apollo
__bsdos__
__convex__NATIVE
__hppa
__hpua
__hpux
__i386
__i386__
__ia64__
__linux
__linux__
__minux
__osf
__osf__
__ppc64__
__ppc__
__riscos
__riscos__
__sgi
__sinix
__sinix__
__sp3__ # what is this? context indicates it is a platform...
__sparc64__
__sun
__tru64
__ultrix
__ultrix__
__x86_64__
_sgi
_sun
_tru64
convex_NATIVE
eta10
hpux
ibm
linux
mips
sco_sv
sgi
sun
vax
)
# Compiler flags - again, group common tests at front.
set(COMPILER_FLAGS
__STDC__
_MSC_VER
__GNUC__
__GLIBC_MINOR__
__GLIBC__
!GCC_PREREQ
GCC_PREREQ
ICC_PREREQ
_CRAYC
__APPLE_CC__
__BORLANDC__
__clang__
__DECC
__INTEL_COMPILER
__MINGW32__
__STDC_VERSION__
__SUNPRO_C
__SUNPRO_CC
__TURBOC__
__USE_GNU
__WATCOMC__
__WATCOM_INT64__
__WATCOM__
)
# Language flags
set(LANG_FLAGS
__cplusplus
__OBJC__
)
# macros with define guards
set(MACRO_FLAGS
UNUSED
LIKELY
UNLIKELY
DEPRECATED
)
autoheader_ignore_defines(OS_FLAGS)
autoheader_ignore_defines(COMPILER_FLAGS)
autoheader_ignore_defines(LANG_FLAGS)
autoheader_ignore_defines(MACRO_FLAGS)
#get_property(C_DEFINE_SKIPVARS GLOBAL PROPERTY C_DEFINE_SKIPVARS)
#message("C_DEFINE_SKIPVARS: ${C_DEFINE_SKIPVARS}")
# Given a file and relative directory, construct the expected
# header guard ifdef string
macro(header_guard rdir fname ovar)
string(REPLACE "${rdir}/" "" stage1 ${fname})
string(REPLACE "/" "_" stage2 ${stage1})
string(REPLACE "." "_" stage3 ${stage2})
string(REPLACE "-" "_" stage4 ${stage3})
string(TOUPPER "${stage4}" stage5)
set(${ovar} ${stage5})
endmacro(header_guard)
function(autoheader_scan_internal seed_dir recurse)
set(scan_files)
set(extensions c h cxx cpp hxx hpp)
get_property(C_DEFINE_SKIPVARS GLOBAL PROPERTY C_DEFINE_SKIPVARS)
get_property(C_DEFINE_SKIPPATTERNS GLOBAL PROPERTY C_DEFINE_SKIPPATTERNS)
get_property(FILE_SKIPPATTERNS GLOBAL PROPERTY FILE_SKIPPATTERNS)
foreach(exten ${extensions})
set(sfiles)
if(recurse)
file(GLOB_RECURSE sfiles "${seed_dir}/*.${exten}")
else(recurse)
file(GLOB sfiles "${seed_dir}/*.${exten}")
endif(recurse)
set(scan_files ${scan_files} ${sfiles})
endforeach(exten ${extensions})
#message("found files: ${scan_files}")
foreach(ptn ${FILE_SKIPPATTERNS})
list(FILTER scan_files EXCLUDE REGEX "${ptn}")
endforeach(ptn ${FILE_SKIPPATTERNS})
#message("processing files: ${scan_files}")
set(unique_keys)
foreach(sf ${scan_files})
header_guard("${seed_dir}" "${sf}" hg)
set(SKIP_LIST "${hg}" ${C_DEFINE_SKIPVARS})
# Use unifdef to get the list of conditional symbols
# See http://dotat.at/prog/unifdef/ and https://github.com/fanf2/unifdef
execute_process(COMMAND unifdef -s ${sf} OUTPUT_VARIABLE def_list)
string(REPLACE "\n" ";" def_list "${def_list}")
if(def_list)
foreach(dflag ${def_list})
set(skip_flag 0)
foreach(sk ${SKIP_LIST})
if(NOT skip_flag)
if("${dflag}" STREQUAL "${sk}")
set(skip_flag 1)
endif("${dflag}" STREQUAL "${sk}")
endif(NOT skip_flag)
endforeach(sk ${SKIP_LIST})
foreach(sp ${C_DEFINE_SKIPPATTERNS})
if(NOT skip_flag)
if("${dflag}" MATCHES ${sp})
set(skip_flag 1)
endif("${dflag}" MATCHES ${sp})
endif(NOT skip_flag)
endforeach(sp ${C_DEFINE_SKIPPATTERNS})
if(NOT skip_flag)
#message(" ${dflag}")
set(unique_keys ${unique_keys} ${dflag})
endif(NOT skip_flag)
endforeach(dflag ${def_list})
endif(def_list)
endforeach(sf ${scan_files})
list(LENGTH unique_keys UKLEN)
if(UKLEN)
list(REMOVE_DUPLICATES unique_keys)
foreach(k ${unique_keys})
set_property(GLOBAL APPEND PROPERTY C_DEFINE_VARS "${k}")
endforeach(k ${unique_keys})
endif(UKLEN)
# If we've run autoheader_scan mulitple times, we need to
# ensure uniqueness globally...
get_property(C_DEFINE_VARS GLOBAL PROPERTY C_DEFINE_VARS)
list(LENGTH C_DEFINE_VARS DLEN)
if(DLEN)
list(REMOVE_DUPLICATES C_DEFINE_VARS)
list(SORT C_DEFINE_VARS)
endif(DLEN)
set_property(GLOBAL PROPERTY C_DEFINE_VARS "${C_DEFINE_VARS}")
endfunction(autoheader_scan_internal)
function(autoheader_scan seed_dir)
autoheader_scan_internal("${seed_dir}" 0)
endfunction(autoheader_scan)
function(autoheader_recursive_scan seed_dir)
autoheader_scan_internal("${seed_dir}" 1)
endfunction(autoheader_recursive_scan)
# For testing convenience, the following will exercise the
# logic in cmake -P script mode. Should be removed if/when
# this goes "live" in the real build.
set(LOCAL_SKIP DIRENT_ BRLCADBUILD ^BRLCAD_* ^DM_* ^FB_* NO_BOMBING_MACROS USE_BINARY_ATTRIBUTES
IF_WGL IF_X IF_QT IF_OGL NO_DEBUG_CHECKING USE_OPENCL)
autoheader_ignore_defines(LOCAL_SKIP)
autoheader_skip_files(".*src/other/.*")
autoheader_recursive_scan(${CMAKE_CURRENT_SOURCE_DIR}/include)
autoheader_recursive_scan(${CMAKE_CURRENT_SOURCE_DIR}/src)
autoheader_scan(${CMAKE_CURRENT_SOURCE_DIR}/misc/tools/perplex)
get_property(C_DEFINE_VARS GLOBAL PROPERTY C_DEFINE_VARS)
message("keys:")
foreach(k ${C_DEFINE_VARS})
message(" ${k}")
endforeach(k ${def_list})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-78
View File
@@ -1,78 +0,0 @@
# B U I L D _ C M D . C M A K E . I N
# BRL-CAD
#
# Copyright (c) 2012-2016 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.
#
###
# We need to be able to force libbu to use the build directory
# versions of plugins during build, in case there's already
# something in the install directory.
set(ENV{BRLCAD_ROOT} "@CMAKE_BINARY_DIR@")
# Set BUILD_TYPE in case it is needed
if(EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/CURRENT_PATH/Release")
set(BUILD_TYPE Release)
elseif(EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/CURRENT_PATH/Debug")
set(BUILD_TYPE Debug)
else(EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/CURRENT_PATH/Release")
set(BUILD_TYPE)
endif(EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/CURRENT_PATH/Release")
# Run Command
set(CMD_EXEC "@CMD_EXEC@")
set(CMD_ARGS @CMD_ARGS@)
execute_process(COMMAND "${CMD_EXEC}" ${CMD_ARGS}
RESULT_VARIABLE CMDRESULT OUTPUT_VARIABLE CMDOUT ERROR_VARIABLE CMDERR)
# If we're supposed to put the output in log files, do that.
set(STDOUT_LOG "@STDOUT_LOG@")
set(STDERR_LOG "@STDERR_LOG@")
if(STDOUT_LOG)
file(APPEND "${STDOUT_LOG}" "${CMDOUT}")
endif(STDOUT_LOG)
if(STDERR_LOG)
file(APPEND "${STDERR_LOG}" "${CMDERR}")
endif(STDERR_LOG)
if(CMDRESULT)
message(FATAL_ERROR "${CMD_EXEC} failure: ${CMDRESULT}\n${CMDOUT}\n${CMDERR}")
endif(CMDRESULT)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+81 -156
View File
@@ -34,21 +34,6 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# Empty elements in lists are of no interest
if(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0007 OLD)
endif(COMMAND CMAKE_POLICY)
# If BRLCAD_BUNDLED_LIBS isn't set to BUNDLED, mention that this might be a good idea.
if(NOT "@BRLCAD_BUNDLED_LIBS@" STREQUAL "BUNDLED")
message(" ")
message("Note: - running distcheck with a BRL-CAD configuration that has not enabled")
message(" all local src/other libraries. This will work, but the best level")
message(" of build system verification is achieved when BRLCAD_BUNDLED_LIBS is")
message(" set to Bundled, activating all src/other CMake build systems.")
message(" ")
endif(NOT "@BRLCAD_BUNDLED_LIBS@" STREQUAL "BUNDLED")
if(EXISTS "@CMAKE_SOURCE_DIR@/src/testing")
message(FATAL_ERROR "\nThe directory @CMAKE_SOURCE_DIR@/src/testing is present. Remove this directory from the source tree before proceeding with distcheck.")
endif(EXISTS "@CMAKE_SOURCE_DIR@/src/testing")
@@ -56,11 +41,23 @@ endif(EXISTS "@CMAKE_SOURCE_DIR@/src/testing")
set(NOT_DISTCHECK_READY 0)
set(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
# Avoid empty items in lists, so we don't trigger a CMake warning
function(scrub_list SLIST)
set(NONEMPTY)
foreach(sf ${${SLIST}})
if(NOT "${sf}" STREQUAL "")
list(APPEND NONEMPTY "${sf}")
endif(NOT "${sf}" STREQUAL "")
endforeach(sf ${${SLIST}})
string(REGEX REPLACE "^;" "" NONEMPTY "${NONEMPTY}")
set(${SLIST} ${NONEMPTY} PARENT_SCOPE)
endfunction(scrub_list SLIST)
# Subversion generates a textual report that we need to convert into a file
# list. The basic approach is to crush anything that's not what we want down
# to line returns, then replace all line returns with semicolons to create
# a valid CMake lists.
macro(SVN_INFO_TO_PATH_LIST SVN_INFO SVN_PATHLIST)
function(SVN_INFO_TO_PATH_LIST SVN_INFO SVN_PATHLIST)
set(SVN_PROCESSING ${${SVN_INFO}})
string(REGEX REPLACE "Name: [^\r\n]*" "\n" SVN_PROCESSING "${SVN_PROCESSING}")
string(REGEX REPLACE "URL: [^\r\n]*" "\n" SVN_PROCESSING "${SVN_PROCESSING}")
@@ -75,27 +72,33 @@ macro(SVN_INFO_TO_PATH_LIST SVN_INFO SVN_PATHLIST)
string(REGEX REPLACE "Path: " "" SVN_PROCESSING "${SVN_PROCESSING}")
string(REGEX REPLACE "@CMAKE_SOURCE_DIR@/" "" SVN_PROCESSING "${SVN_PROCESSING}")
string(REGEX REPLACE "@CMAKE_SOURCE_DIR@\r?\n" "\n" SVN_PROCESSING "${SVN_PROCESSING}")
string(REGEX REPLACE "Relative[^\r\n]*\r?\n" "\n" SVN_PROCESSING "${SVN_PROCESSING}")
string(REGEX REPLACE "Working Copy Root[^\r\n]*\r?\n" "\n" SVN_PROCESSING "${SVN_PROCESSING}")
string(REGEX REPLACE "\n" ";" SVN_PROCESSING "${SVN_PROCESSING}")
string(REGEX REPLACE "/;" ";" SVN_PROCESSING "${SVN_PROCESSING}")
set(${SVN_PATHLIST} "${SVN_PROCESSING}")
endmacro(SVN_INFO_TO_PATH_LIST)
scrub_list(SVN_PROCESSING)
set(SVN_FILES)
foreach(sf ${SVN_PROCESSING})
if(NOT IS_DIRECTORY "@CMAKE_SOURCE_DIR@/${sf}")
list(APPEND SVN_FILES ${sf})
endif(NOT IS_DIRECTORY "@CMAKE_SOURCE_DIR@/${sf}")
endforeach(sf ${SVN_PROCESSING})
set(${SVN_PATHLIST} "${SVN_FILES}" PARENT_SCOPE)
endfunction(SVN_INFO_TO_PATH_LIST)
# By default, assume that nothing has been modified.
set(SVN_TREE_MODIFIED 0)
# Look for Subversion - if we don't have the command, we can't query the
# repository even if it is present.
find_program(SVN_EXEC svn)
set(DISTCHECK_CMAKE_FILE_LIST "@CMAKE_BINARY_DIR@/distcheck_cmake_file_list.txt")
set(DISTCHECK_SVN_FILE_LIST "@CMAKE_BINARY_DIR@/distcheck_svn_file_list.txt")
set(DISTCHECK_FS_FILE_LIST "@CMAKE_BINARY_DIR@/distcheck_fs_file_list.txt")
# We need the Subversion binary and the source directory must be a
# checkout of the BRL-CAD subversion repository. If these two conditions
# are met, we can collect information from subversion
if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
# By default, assume that nothing has been modified.
set(SVN_TREE_MODIFIED 0)
# Get the file list
set(SVN_FILES "")
execute_process(COMMAND ${SVN_EXEC} info -R "@CMAKE_SOURCE_DIR@" OUTPUT_VARIABLE SVN_STDOUT ERROR_VARIABLE SVN_STDERR RESULT_VARIABLE RETVAL)
@@ -126,10 +129,9 @@ if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
endforeach(ITEM ${SVN_STATUS})
# Generate a sorted text file with the results of the Subversion list processing.
scrub_list(SVN_FILES)
list(SORT SVN_FILES)
list(REMOVE_DUPLICATES SVN_FILES)
string(REPLACE ";" "\n" SVN_FILES "${SVN_FILES}")
file(WRITE "@CMAKE_BINARY_DIR@/distcheck_svn_file_list.txt" "${SVN_FILES}")
# If we've got modified files, we shouldn't use resulting tarballs for a distribution -
# warn accordingly.
@@ -147,49 +149,14 @@ endif(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
# by this script we need the fully expanded list. Read and expand...
message(" --- Building list of files known to the build system: ...")
file(STRINGS "@CMAKE_BINARY_DIR@/cmakefiles.cmake" BUILD_FILES)
file(STRINGS "@CMAKE_BINARY_DIR@/cmakedirs.cmake" IGNORED_DIRECTORIES)
# Having read in the svn data, we process all the ignored directories to
# get explicit lists of what they contain. If we have Subversion use
# that to tell us what *should* be in those directories - this lets us
# spot stray files even in ignored directories. If we don't have
# Subversion, use GLOB_RECURSE.
foreach(ITEM ${IGNORED_DIRECTORIES})
if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
set(IGNORED_FILES "")
set(SVN_STDOUT "")
execute_process(COMMAND ${SVN_EXEC} info -R ${ITEM} OUTPUT_VARIABLE SVN_STDOUT ERROR_VARIABLE SVN_STDERR)
SVN_INFO_TO_PATH_LIST(SVN_STDOUT IGNORED_FILES)
# If svn reports the file as deleted, accept that
foreach(I_ITEM ${IGNORED_FILES})
if(NOT EXISTS "@CMAKE_SOURCE_DIR@/${I_ITEM}")
execute_process(COMMAND ${SVN_EXEC} status "@CMAKE_SOURCE_DIR@/${I_ITEM}" OUTPUT_VARIABLE SVN_STATUS ERROR_VARIABLE SVN_STDERR)
if("${SVN_STATUS}" MATCHES "^D")
list(REMOVE_ITEM IGNORED_FILES "${I_ITEM}")
endif("${SVN_STATUS}" MATCHES "^D")
endif(NOT EXISTS "@CMAKE_SOURCE_DIR@/${I_ITEM}")
endforeach(I_ITEM ${IGNORED_FILES})
list(APPEND BUILD_FILES ${IGNORED_FILES})
else(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
file(GLOB_RECURSE IGNORED_FILES RELATIVE "@CMAKE_SOURCE_DIR@" "${ITEM}/*")
set(IGNORED_PATHS ${IGNORED_FILES})
while(IGNORED_PATHS)
set(IGNORED_PATHS "${IGNORED_PATHS};")
string(REGEX REPLACE "[^/]*;" ";" IGNORED_PATHS "${IGNORED_PATHS}")
string(REPLACE "/;" ";" IGNORED_PATHS "${IGNORED_PATHS}")
list(REMOVE_DUPLICATES IGNORED_PATHS)
list(APPEND BUILD_FILES ${IGNORED_PATHS})
endwhile(IGNORED_PATHS)
list(APPEND BUILD_FILES ${IGNORED_FILES})
endif(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
endforeach(ITEM ${IGNORED_DIRECTORIES})
string(REPLACE "@CMAKE_SOURCE_DIR@/" "" BUILD_FILES "${BUILD_FILES}")
# Generate a sorted text file with the results of the CMake build system list processing.
foreach(BF ${BUILD_FILES})
get_filename_component(BFA "${BF}" ABSOLUTE BASE_DIR "@CMAKE_SOURCE_DIR@")
string(REPLACE "@CMAKE_SOURCE_DIR@/" "" BFA "${BFA}")
list(APPEND BFLS ${BFA})
endforeach(BF ${BUILD_FILES})
set(BUILD_FILES "${BFLS}")
list(SORT BUILD_FILES)
list(REMOVE_DUPLICATES BUILD_FILES)
string(REPLACE ";" "\n" BUILD_FILES "${BUILD_FILES}")
file(WRITE "${DISTCHECK_CMAKE_FILE_LIST}" "${BUILD_FILES}")
message(" --- Building list of files known to the build system: Done")
# Get the CPack ignore build path value from the parent CMake build
@@ -200,35 +167,29 @@ set(CPACK_IGNORE_BUILD_PATH "@CPACK_IGNORE_BUILD_PATH@")
# Subversion *expect* to be present) minus files that CPack knows to
# ignore (i.e., things that will not be included in a source archive.)
message(" --- Building list of files actually present in source tree: ...")
file(WRITE "@CMAKE_BINARY_DIR@/distcheck_fs_file_list.txt" "")
file(GLOB_RECURSE FS_FILE_LIST RELATIVE "@CMAKE_SOURCE_DIR@" "@CMAKE_SOURCE_DIR@/*")
# Start scrubbing...
string(REGEX REPLACE ";[^;]*\\.svn[^;]*" "" FS_FILE_LIST_SCRUBBED "${FS_FILE_LIST}")
if(CPACK_IGNORE_BUILD_PATH)
set(FS_FILE_LIST_SCRUBBED ";${FS_FILE_LIST_SCRUBBED}")
string(REGEX REPLACE ";${CPACK_IGNORE_BUILD_PATH}[^;]*" "" FS_FILE_LIST_SCRUBBED "${FS_FILE_LIST_SCRUBBED}")
endif(CPACK_IGNORE_BUILD_PATH)
string(REGEX REPLACE "[^/]*;" ";" FS_FILE_LIST_P1 "${FS_FILE_LIST_SCRUBBED}")
string(REPLACE "/;" ";" FS_FILE_LIST_P1 "${FS_FILE_LIST_P1}")
list(REMOVE_DUPLICATES FS_FILE_LIST_P1)
string(REGEX REPLACE "[^/]*;" ";" FS_FILE_LIST_P2 "${FS_FILE_LIST_P1}")
string(REPLACE "/;" ";" FS_FILE_LIST_P2 "${FS_FILE_LIST_P2}")
list(REMOVE_DUPLICATES FS_FILE_LIST_P2)
set(FS_FILE_LIST ${FS_FILE_LIST_SCRUBBED} ${FS_FILE_LIST_P1} ${FS_FILE_LIST_P2})
set(FS_FILES)
foreach(pf ${FS_FILE_LIST})
if(NOT "${pf}" MATCHES ".*\\.svn/.*")
if(CPACK_IGNORE_BUILD_PATH)
if(NOT "${pf}" MATCHES "^${CPACK_IGNORE_BUILD_PATH}.*")
list(APPEND FS_FILES ${pf})
endif(NOT "${pf}" MATCHES "^${CPACK_IGNORE_BUILD_PATH}.*")
else(CPACK_IGNORE_BUILD_PATH)
list(APPEND FS_FILES ${pf})
endif(CPACK_IGNORE_BUILD_PATH)
endif(NOT "${pf}" MATCHES ".*\\.svn/.*")
endforeach(pf ${FS_FILE_LIST})
set(FS_FILE_LIST ${FS_FILES})
if(NOT FS_FILE_LIST)
message(FATAL_ERROR "FATAL: No files found in file system search?? ")
endif(NOT FS_FILE_LIST)
# Generate a sorted text file with the results of the CMake build system list processing.
if(FS_FILE_LIST)
list(REMOVE_DUPLICATES FS_FILE_LIST)
list(SORT FS_FILE_LIST)
string(REGEX REPLACE ";" "\n" FS_FILE_LIST "${FS_FILE_LIST}")
file(WRITE "@CMAKE_BINARY_DIR@/distcheck_fs_file_list.txt" "${FS_FILE_LIST}")
else(FS_FILE_LIST)
message("No files found in file system search?? ")
endif(FS_FILE_LIST)
list(REMOVE_DUPLICATES FS_FILE_LIST)
list(SORT FS_FILE_LIST)
message(" --- Building list of files actually present in source tree: Done")
# To generate lists of "interesting" files - things the build system knows about but
# subversion doesn't, files the Subversion system knows about that the build system
# doesn't, and files present in the source tree that *neither* system knows about,
@@ -238,79 +199,43 @@ message(" --- Building list of files actually present in source tree: Done")
# http://www.cmake.org/pipermail/cmake/2011-September/046214.html
message(" --- Performing comparisons...")
# Read in the text files as lists
file(STRINGS "${DISTCHECK_CMAKE_FILE_LIST}" BUILD_FILES)
if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
file(STRINGS "${DISTCHECK_SVN_FILE_LIST}" SVN_FILES)
endif(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
file(STRINGS "${DISTCHECK_FS_FILE_LIST}" FS_FILE_LIST)
list(REMOVE_DUPLICATES BUILD_FILES)
# If we have Subversion, we can do lots more interesting comparisons.
# Otherwise, just look for files the build system doesn't know about.
if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
if(SVN_FILES)
set(BUILD_FILES_NOT_IN_SVN ${BUILD_FILES})
set(SVN_FILES_NOT_IN_BUILD ${SVN_FILES})
if(BUILD_FILES)
list(REMOVE_ITEM BUILD_FILES_NOT_IN_SVN ${SVN_FILES})
endif(BUILD_FILES)
list(REMOVE_ITEM FS_FILE_LIST ${SVN_FILES})
endif(SVN_FILES)
if(SVN_FILES_NOT_IN_BUILD AND BUILD_FILES)
list(REMOVE_ITEM SVN_FILES_NOT_IN_BUILD ${BUILD_FILES})
endif(SVN_FILES_NOT_IN_BUILD AND BUILD_FILES)
endif(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
list(REMOVE_ITEM FS_FILE_LIST ${BUILD_FILES})
# Report file in Subversion but not the build logic:
if(SVN_FILES_NOT_IN_BUILD)
string(REPLACE ";" "\n" SVN_FILES_NOT_IN_BUILD "${SVN_FILES_NOT_IN_BUILD}")
message("\nFiles in repository are not accounted for in build logic: \n${SVN_FILES_NOT_IN_BUILD}\n")
endif(SVN_FILES_NOT_IN_BUILD)
# Report file in Subversion but not the build logic:
set(SVN_FILES_NOT_IN_BUILD ${SVN_FILES})
list(REMOVE_ITEM SVN_FILES_NOT_IN_BUILD ${BUILD_FILES})
if(SVN_FILES_NOT_IN_BUILD)
string(REPLACE ";" "\n" SVN_FILES_NOT_IN_BUILD "${SVN_FILES_NOT_IN_BUILD}")
message("\nFiles known to subversion are not accounted for in build logic: \n${SVN_FILES_NOT_IN_BUILD}\n")
endif(SVN_FILES_NOT_IN_BUILD)
# Report file in the build logic but not Subversion:
if(BUILD_FILES_NOT_IN_SVN)
string(REPLACE ";" "\n" BUILD_FILES_NOT_IN_SVN "${BUILD_FILES_NOT_IN_SVN}")
message("\nFiles mentioned in build logic are not checked into the repository: \n${BUILD_FILES_NOT_IN_SVN}\n")
endif(BUILD_FILES_NOT_IN_SVN)
# Report file in the build logic but not Subversion:
set(BUILD_FILES_NOT_IN_SVN ${BUILD_FILES})
list(REMOVE_ITEM BUILD_FILES_NOT_IN_SVN ${SVN_FILES})
if(BUILD_FILES_NOT_IN_SVN)
string(REPLACE ";" "\n" BUILD_FILES_NOT_IN_SVN "${BUILD_FILES_NOT_IN_SVN}")
message("\nFiles mentioned in build logic are not checked into the repository: \n${BUILD_FILES_NOT_IN_SVN}\n")
endif(BUILD_FILES_NOT_IN_SVN)
# Either of the previous two cases halts distcheck until fixed.
mark_as_advanced(FORCE_DISTCHECK)
if (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
if (NOT FORCE_DISTCHECK)
message(FATAL_ERROR "ERROR: Distcheck cannot proceed until build files and repo are in sync (set -DFORCE_DISTCHECK=ON to override)")
endif (NOT FORCE_DISTCHECK)
endif (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
# OK, no fatal errors - clean up the text files
file(REMOVE "${DISTCHECK_CMAKE_FILE_LIST}")
file(REMOVE "${DISTCHECK_SVN_FILE_LIST}")
file(REMOVE "${DISTCHECK_FS_FILE_LIST}")
# If we have subversion, we need one type of error message
if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
if(FS_FILE_LIST)
string(REPLACE ";" "\n" FS_FILE_LIST "${FS_FILE_LIST}")
message("\nFiles unknown to both Subversion and the Build logic (will not be incorporated into dist):\n${FS_FILE_LIST}\n")
endif(FS_FILE_LIST)
# Write out ignored file list for subsequent CPack use
file(WRITE @CMAKE_BINARY_DIR@/cpack_ignore.cmake ${FS_FILE_LIST})
else(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
# Different error message - in fact, without Subversion to keep us straight, this is a fatal error.
if(FS_FILE_LIST)
string(REPLACE ";" "\n" FS_FILE_LIST "${FS_FILE_LIST}")
message("\nFiles unknown to the Build logic (will not be incorporated into dist):\n${FS_FILE_LIST}\n")
else(FS_FILE_LIST)
message("\nWarning: Distcheck is being performed without subversion. Temporary files and other unknown files present in directories marked by distcheck as ignore-in-toto will be incorporated into the source archives by CPack. If building archives for distribution, using a Subversion checkout is recommended.\n")
endif(FS_FILE_LIST)
# Either of the previous two cases halts distcheck until fixed.
mark_as_advanced(FORCE_DISTCHECK)
if (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
if (NOT FORCE_DISTCHECK)
message(FATAL_ERROR "ERROR: Distcheck cannot proceed until build files and repo are in sync (set -DFORCE_DISTCHECK=ON to override)")
endif (NOT FORCE_DISTCHECK)
endif (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
endif(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
set(IGNORED_FS_FILES ${FS_FILE_LIST})
list(REMOVE_ITEM IGNORED_FS_FILES ${BUILD_FILES})
if(IGNORED_FS_FILES)
string(REPLACE ";" "\n" IGNORED_FS_FILES "${IGNORED_FS_FILES}")
message("\nFiles unknown to both Subversion and the Build logic (will not be incorporated into dist):\n${IGNORED_FS_FILES}\n")
endif(IGNORED_FS_FILES)
# Write out the archive status so the build targets can see it later.
if(NOT_DISTCHECK_READY)
if("${NOT_DISTCHECK_READY}" STREQUAL "1")
@@ -321,7 +246,7 @@ if(NOT_DISTCHECK_READY)
file(APPEND "@CMAKE_BINARY_DIR@/CMakeTmp/distcheck_remove_archives_if_invalid" "execute_process(COMMAND @CMAKE_COMMAND@ -E remove \"${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip\")\n")
else(NOT_DISTCHECK_READY)
if(NOT SVN_EXEC OR NOT EXISTS "@CMAKE_SOURCE_DIR@/.svn")
file(WRITE "@CMAKE_BINARY_DIR@/CMakeTmp/distcheck_remove_archives_if_invalid" "execute_process(COMMAND @CMAKE_COMMAND@ -E echo \"Note: Archive files were generated without being able to compare them to the Subversion archive master file lists. Under these conditions, it is not possible for distcheck to verify the contents of directories marked as 'ignore' by the build system.\")\n")
file(WRITE "@CMAKE_BINARY_DIR@/CMakeTmp/distcheck_remove_archives_if_invalid" "execute_process(COMMAND @CMAKE_COMMAND@ -E echo \"Note: Archive files were generated without being able to compare them to the Subversion archive master file lists..\")\n")
else(NOT SVN_EXEC OR NOT EXISTS "@CMAKE_SOURCE_DIR@/.svn")
file(WRITE "@CMAKE_BINARY_DIR@/CMakeTmp/distcheck_remove_archives_if_invalid" "")
endif(NOT SVN_EXEC OR NOT EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+10 -48
View File
@@ -52,62 +52,25 @@ endfunction(FIND_ALL_DIRS)
if(NOT EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/create_builddir_source_archive.done")
file(GLOB_RECURSE pre_existing_files "@CMAKE_BINARY_DIR@/source_archive_contents/*")
file(STRINGS "@CMAKE_BINARY_DIR@/cmakefiles.cmake" source_tree_files)
file(STRINGS "@CMAKE_BINARY_DIR@/cmakedirs.cmake" ignored_dirctories)
if(EXISTS "@CMAKE_BINARY_DIR@/cpack_ignore.cmake")
file(STRINGS "@CMAKE_BINARY_DIR@/cpack_ignore.cmake" ignored_src_files)
endif(EXISTS "@CMAKE_BINARY_DIR@/cpack_ignore.cmake")
file(STRINGS "@CMAKE_BINARY_DIR@/cmakefiles.cmake" source_tree_files_raw)
message("Preparing file list...")
# Remove duplicates and scrub directories out of source_tree_files
# Remove duplicates and resolve relative paths
set(source_tree_files)
foreach(SF ${source_tree_files_raw})
get_filename_component(SFA "${SF}" ABSOLUTE)
list(APPEND source_tree_files ${SFA})
endforeach(SF ${source_tree_files_raw})
list(SORT source_tree_files)
list(REMOVE_DUPLICATES source_tree_files)
foreach(ITEM ${source_tree_files})
if(IS_DIRECTORY ${ITEM})
list(REMOVE_ITEM source_tree_files ${ITEM})
endif(IS_DIRECTORY ${ITEM})
endforeach(ITEM ${source_tree_files})
# Collect all files from ignored directories
set(dir_filelist)
foreach(ITEM ${ignored_dirctories})
file(GLOB_RECURSE dir_files "${ITEM}/*")
foreach(DITEM ${dir_files})
if(NOT IS_DIRECTORY ${DITEM} AND NOT "${DITEM}" MATCHES ".svn/")
list(APPEND dir_filelist ${DITEM})
endif(NOT IS_DIRECTORY ${DITEM} AND NOT "${DITEM}" MATCHES ".svn/")
endforeach(DITEM ${dir_files})
endforeach(ITEM ${ignored_dirctories})
if(ignored_src_files)
message("Removing ignored files...")
endif(ignored_src_files)
# If we have a list of files to ignore from repo-verify, build it
# into full paths
set(ignored_srcs_full)
foreach(ITEM ${ignored_src_files})
list(APPEND ignored_srcs_full "@CMAKE_SOURCE_DIR@/${ITEM}")
endforeach(ITEM ${ignored_src_files})
# Remove the ignored files from the globbed file list, which is where
# they might have crept in
if(ignored_srcs_full)
list(REMOVE_ITEM dir_filelist ${ignored_srcs_full})
endif(ignored_srcs_full)
# Combine the source lists into the final list
set(final_list ${source_tree_files} ${dir_filelist})
list(SORT final_list)
list(REMOVE_DUPLICATES final_list)
# Do the actual copy
message("Copying files...")
set(processed_files)
set(processed 0)
list(LENGTH final_list file_count)
foreach(source_file ${final_list})
list(LENGTH source_tree_files file_count)
foreach(source_file ${source_tree_files})
string(REPLACE "@CMAKE_SOURCE_DIR@/" "@CMAKE_BINARY_DIR@/source_archive_contents/" outfile "${source_file}")
if(EXISTS ${outfile})
if("${source_file}" IS_NEWER_THAN ${outfile})
@@ -158,7 +121,6 @@ if(NOT EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/create_builddir_source_archive.done")
endforeach(candidate ${dir_list})
endwhile(HAVE_EMPTY_DIRS)
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/CMakeTmp/create_builddir_source_archive.done")
# Local Variables:
@@ -1,9 +0,0 @@
#include <alloca.h>
int
main ()
{
char *p = (char *) alloca (2 * sizeof (int));
if (p) return 0;
;
return 0;
}
-29
View File
@@ -1,29 +0,0 @@
#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# ifdef _MSC_VER
# include <malloc.h>
# define alloca _alloca
# else
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
# endif
#endif
int
main ()
{
char *p = (char *) alloca (1);
if (p) return 0;
;
return 0;
}
-113
View File
@@ -1,113 +0,0 @@
#define _CRT_SECURE_NO_WARNINGS 1
#include <time.h>
#include <stdio.h>
void
printtime(int tdiff)
{
int d_mins, d_hrs, d_days;
d_days = 0;
d_hrs = 0;
d_mins = 0;
if (tdiff > 86400) {/* get days */
d_days = tdiff / 86400;
tdiff = tdiff % 86400;
}
if (tdiff > 3600) { /* get hours */
d_hrs = tdiff / 3600;
tdiff = tdiff % 3600;
}
if (tdiff > 60) { /* get minutes */
d_mins = tdiff / 60;
tdiff = tdiff % 60;
}
if (d_days > 0) {
if (d_days == 1) {
printf("%d day ", d_days);
} else {
printf("%d days ", d_days);
}
}
if (d_hrs > 0) {
if (d_hrs == 1) {
printf("%d hour ", d_hrs);
} else {
printf("%d hours ", d_hrs);
}
}
if (d_mins > 0) {
if (d_mins == 1) {
printf("%d minute ", d_mins);
} else {
printf("%d minutes ", d_mins);
}
}
if (tdiff > 0) {
if (tdiff == 1) {
printf("%d second ", tdiff);
} else {
printf("%d seconds ", tdiff);
}
}
if (tdiff == 0 && d_mins == 0 && d_hrs == 0 && d_days == 0) {
printf("0 seconds ");
}
}
int
main(void)
{
FILE *infp = NULL;
time_t t, ts, te;
struct tm *currenttime;
struct tm starttime;
int tdiff;
double tdiff_tmp;
t = time(NULL);
currenttime = localtime(&t);
infp = fopen("${BUILD_DELTA_START}", "r");
if(!fscanf(infp, "%d/%d/%d/%d/%d/%d/%d/%d/%d", &(starttime.tm_sec), &(starttime.tm_min), &(starttime.tm_hour), &(starttime.tm_mday), &(starttime.tm_mon), &(starttime.tm_year), &(starttime.tm_wday), &(starttime.tm_yday), &(starttime.tm_isdst)))
printf("scan error\n");
fclose(infp);
ts = mktime(&starttime);
te = mktime(currenttime);
printf("Done.\n\n");
printf("BRL-CAD Release ${BRLCAD_VERSION}, Build ${CONFIG_DATE}\n\n");
printf("Elapsed compilation time: ");
tdiff_tmp = difftime(te, ts);
tdiff = (int)tdiff_tmp; /* intentionally truncates */
printtime(tdiff);
printf("\nElapsed time since configuration: ");
infp = fopen("${DELTA_START}", "r");
if(!fscanf(infp, "%d/%d/%d/%d/%d/%d/%d/%d/%d", &(starttime.tm_sec), &(starttime.tm_min), &(starttime.tm_hour), &(starttime.tm_mday), &(starttime.tm_mon), &(starttime.tm_year), &(starttime.tm_wday), &(starttime.tm_yday), &(starttime.tm_isdst)))
printf("scan error\n");
fclose(infp);
ts = mktime(&starttime);
tdiff_tmp = difftime(te, ts);
tdiff = (int)tdiff_tmp; /* intentionally truncates */
printtime(tdiff);
printf("\n---\n");
printf("${INSTALL_LINE}\n");
printf("${BENCHMARK_LINE}\n");
printf("\n");
return 0;
}
@@ -1,26 +0,0 @@
#define _CRT_SECURE_NO_WARNINGS 1
#include <time.h>
#include <stdio.h>
int main(void)
{
FILE *outfp = NULL;
time_t t;
struct tm *currenttime;
t = time(NULL);
currenttime = localtime(&t);
outfp = fopen("${BUILD_DELTA_FILE}", "w");
fprintf(outfp, "%d/", currenttime->tm_sec); /* seconds after the minute [0-60] */
fprintf(outfp, "%d/", currenttime->tm_min); /* minutes after the hour [0-59] */
fprintf(outfp, "%d/", currenttime->tm_hour); /* hours since midnight [0-23] */
fprintf(outfp, "%d/", currenttime->tm_mday); /* day of the month [1-31] */
fprintf(outfp, "%d/", currenttime->tm_mon); /* months since January [0-11] */
fprintf(outfp, "%d/", currenttime->tm_year); /* years since 1900 */
fprintf(outfp, "%d/", currenttime->tm_wday); /* days since Sunday [0-6] */
fprintf(outfp, "%d/", currenttime->tm_yday); /* days since January 1 [0-365] */
fprintf(outfp, "%d", currenttime->tm_isdst); /* Daylight Savings Time flag */
fclose(outfp);
return 0;
}
-24
View File
@@ -1,24 +0,0 @@
#include <ctype.h>
#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR(islower(i), ISLOWER(i))
|| toupper(i) != TOUPPER(i))
return 2;
return 0;
}
-18
View File
@@ -1,18 +0,0 @@
%%
a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
e { yyless (input () != 0); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
#ifdef YYTEXT_POINTER
extern char *yytext;
#endif
int
main (void)
{
return ! yylex () + ! yywrap ();
}
-14
View File
@@ -1,14 +0,0 @@
#define _CRT_SECURE_NO_WARNINGS 1
#include <time.h>
#include <stdio.h>
int main(void)
{
time_t t;
struct tm *currenttime;
t = time(NULL);
currenttime = localtime(&t);
printf("\nBuild Time: %s\n", asctime(currenttime));
return 0;
}

Some files were not shown because too many files have changed in this diff Show More