Compare commits

...
Author SHA1 Message Date
Clifford Yapp 168063679f extbuild has taken over this effort - delete old branch (svn branch delete)
svn:revision:77772
svn:branch:thirdparty_rework
svn:account:starseeker
2020-11-20 22:33:37 +00:00
Clifford Yapp 0898f4319b Relocate superbuild dir to src/other/ext
svn:revision:77563
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-23 01:16:07 +00:00
Clifford Yapp c8bae4ee3d Merge from trunk through r77549 to make comparisons easier
svn:revision:77550
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-22 17:43:07 +00:00
Clifford Yapp 31831c1bc0 Shouldn't need the parent dir lookup with the approach we ended up with - pull in the simpler trunk version of this logic.
svn:revision:77526
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-22 00:00:14 +00:00
Clifford Yapp 6b6d1197b6 Work around lack of $<CONFIG> generator expression support in add_custom_command OUTPUT specifications by using the same mechanism originally devised for the multiconfig install path fixing - use the CMAKE_CFG_INTDIR variable to generate the config specific path.
svn:revision:77513
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-20 17:00:17 +00:00
Clifford Yapp d0f78ab2bb Fix Iwidgets directory name.
svn:revision:77512
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-20 16:45:24 +00:00
Clifford Yapp 4821ab8cbc Be more specific about the issue observed.
svn:revision:77510
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 22:26:55 +00:00
Clifford Yapp 84ba6e5af1 Clean up the iwidgets CMake a bit.
svn:revision:77509
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 22:26:38 +00:00
Clifford Yapp 21e2a005f6 Check for null next and prev entries before doing access. Still not sure why the ninja multiconfig Release build was hitting this when nothing else does...
svn:revision:77508
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 22:11:04 +00:00
Clifford Yapp fafa1bab89 Don't skip libexppp in dependency setup.
svn:revision:77507
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 19:26:26 +00:00
Clifford Yapp f740ef29f4 Use CMAKE_EXECUTABLE_SUFFIX here
svn:revision:77506
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 16:45:11 +00:00
Clifford Yapp 3d88203ca0 The MSVC prefix handling breaks down for libexppp, which is special cased so the CMake target doesn't conflict with the exppp executable. Should probably rename one or the other...
svn:revision:77505
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 16:25:44 +00:00
Clifford Yapp 5fb8634e85 tkWinInt.h needs tkInt.h
svn:revision:77504
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 16:11:38 +00:00
Clifford Yapp 4e8fc99163 Not that simple - try an include
svn:revision:77503
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 16:06:49 +00:00
Clifford Yapp 87ccf08c44 Reference our local copy of the internal header.
svn:revision:77502
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 16:04:17 +00:00
Clifford Yapp fdae0ec453 This Tk header isn't installed by default, but build seems to complete without it...
svn:revision:77501
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 15:38:03 +00:00
Clifford Yapp 2b613f8222 Add include for cmake check state management macros.
svn:revision:77500
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 15:36:52 +00:00
Clifford Yapp 814653fd47 The manual variable interventions needed for find_package + custom lib names don't fly on Windows, since the linking library is a different file... see if we can adjust.
svn:revision:77499
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 15:24:14 +00:00
Clifford Yapp edaee0a61d See if not prefixing can make things more consistent/simpler
svn:revision:77498
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 15:11:13 +00:00
Clifford Yapp 080be8ebbf Correct property setting for MSVC case
svn:revision:77497
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 14:34:35 +00:00
Clifford Yapp d37374946e Try specifying configurations on the target (MSVC isn't finding the right thing to link for zlib building openNURBS, and I'm not sure yet why...
svn:revision:77496
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 13:59:23 +00:00
Clifford Yapp 374e95018d zlib's naming tricks complicate life for the build system - skip
svn:revision:77495
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 13:07:44 +00:00
Clifford Yapp 1634d1082d Fix variable
svn:revision:77494
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 04:34:57 +00:00
Clifford Yapp ed73d8312c More adjustments
svn:revision:77493
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 04:21:49 +00:00
Clifford Yapp 059b579557 Not sure how this will work, but see if we can put the dlls in a subdir.
svn:revision:77492
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 04:11:30 +00:00
Clifford Yapp 48f6f54984 Fix input string, and it's OK if we don't have Tk for itcl.
svn:revision:77491
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 04:04:54 +00:00
Clifford Yapp cf626d17ea More Windows specific fun - dll files aren't enough for building, we also need to grab the lib files. Add some notional logic for how to do that...
svn:revision:77490
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 03:48:31 +00:00
Clifford Yapp 7cde3887c8 Add more dependencies
svn:revision:77489
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 02:54:29 +00:00
Clifford Yapp 20c601ee27 Vanilla iwidgets build expects outputs of vanilla Itcl/Itk builds, so do the same thing for Iwidgets and put back a simplified CMake build. This gets us back up and building again.
svn:revision:77488
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 00:22:05 +00:00
Clifford Yapp 141d0a918b Put back (simplified) versions of the CMake builds for Itcl/Itk - if we're going to have to do something anyway for Windows, this is easier.
svn:revision:77487
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-19 00:00:26 +00:00
Clifford Yapp 2549cfb090 Itcl3 build system doesn't work with modern MSVC, looks like... see if a naive adaptation of the itcl4 build will work...
svn:revision:77484
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-18 20:58:02 +00:00
Clifford Yapp bba28c0d0d No wonder the ninja multiconfig builds seemed fast in Release - we're not propagating the build flags for multiconfig setups, and for the first time that's now a real issue. May explain why the step-g fails in multiconfig release and works in single config release with Ninja, but regardless we'll have to sort this out before we can compare apples to apples even if that's not the problem...
svn:revision:77483
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-18 15:47:10 +00:00
Clifford Yapp 84399882e9 Use variable CMAKE_BINARY_ROOT - still have some problem with Ninja Multi-Config Release config where step-g crashes, but plain Ninja now builds in Release config...
svn:revision:77482
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-18 15:19:10 +00:00
Clifford Yapp 040a242d6d It will be better if we can define this once at a toplevel and use it throughout...
svn:revision:77481
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-18 14:08:58 +00:00
Clifford Yapp bd653c6ac9 Ah, right - $<CONFIG> gets set even in single build configs, so we can't just use it willy-nilly everywhere to cover both single and multibuild directory structures. Blast. Will have to update all the logic again...
svn:revision:77476
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-18 03:05:56 +00:00
Clifford Yapp 590653d263 Specify some dependencies
svn:revision:77474
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-17 16:24:12 +00:00
Clifford Yapp d08b726ce7 Merge from trunk - r77320 through r77472
svn:revision:77473
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-17 16:19:38 +00:00
Clifford Yapp 0978ce793d Wrapping functions as we do here is discouraged (https://crascit.com/2018/09/14/do-not-redefine-cmake-commands/) but we've not been able to replace some of the functionality using other means. Since we'll need to require 3.14 for this new setup to work, and ExternalProject_Add approaches remove some of the incentive to override 'standard' functions for bookkeeping purposes, it may not be practical to eliminate such usages.
svn:revision:77467
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-17 04:41:17 +00:00
Clifford Yapp 22fc8ba821 Try to work around an issue with the Ninja Multi-Config generator - the combination of wrapping configure_file and setting source file properties is causing an issue with the 3.19 release candidate. Don't know if other verisons have this issue, but for testing see if we can just dodge it - once upstream resolves this can go away. Reported upstream as Issue 21325.
svn:revision:77466
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-17 01:23:35 +00:00
Clifford Yapp 1062e95d88 More work on multiconfig. For some reason the tests subdirs aren't happy with the Ninja MultiConfig generator - need to look more closely at that.
svn:revision:77465
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-16 21:32:51 +00:00
Clifford Yapp 7c156aba9b Fix RPATH setting for parent BRL-CAD build outputs.
svn:revision:77464
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-16 20:45:58 +00:00
Clifford Yapp 3958b99b46 Fix install RPATH setting for 3rd party builds
svn:revision:77463
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-16 20:45:33 +00:00
Clifford Yapp 02a1815aab Actually we don't want to use MAKE_ARCHIVE_OUTPUT_DIRECTORY and friends here, since they're full path and don't work for multiconfig...
svn:revision:77462
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-16 20:24:59 +00:00
Clifford Yapp f0c9be00b9 Dependencies on the stage targets...
svn:revision:77461
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-16 20:23:02 +00:00
Clifford Yapp 60abcce258 Try to clean up, simplify and reorganize this logic.
svn:revision:77460
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-16 04:24:56 +00:00
Clifford Yapp b690e518ba Tweak generated target properties - this probably needs one more cleanup refactor.
svn:revision:77459
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-15 18:34:28 +00:00
Clifford Yapp 39bb2c1c90 Need Tk X11 headers with MSVC.
svn:revision:77458
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-15 17:19:06 +00:00
Clifford Yapp de3ec222f9 ditto tkAppInit.c - not on Windows
svn:revision:77457
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-15 17:12:38 +00:00
Clifford Yapp 2c8d10b4f0 MSVC doesn't appear to generate tkConfig.sh
svn:revision:77456
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-15 17:08:31 +00:00
Clifford Yapp 371d588890 Start working on handling Windows special case for bin/lib
svn:revision:77435
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-15 01:57:58 +00:00
Clifford Yapp 373d7e675f Guard check_compiler_flag macro
svn:revision:77434
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-15 01:49:03 +00:00
Clifford Yapp b5e5ed6c53 Need to properly abstract this - have the right idea, but needs to be baked in all the way down.
svn:revision:77430
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 01:35:29 +00:00
Clifford Yapp 31c2ab4ed8 Don't want the suffix on Tk either...
svn:revision:77429
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 01:28:47 +00:00
Clifford Yapp 2e3c353b6e Presumably Tk will be similar to Tcl...
svn:revision:77428
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 01:19:02 +00:00
Clifford Yapp 8dea18c1bf sqlite isn't happy on Windows and we're not using it - skip.
svn:revision:77427
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 01:16:15 +00:00
Clifford Yapp b9df4af13a Same deal with the exe name
svn:revision:77426
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 01:11:42 +00:00
Clifford Yapp 0e1bc283e0 No dot in name on Windows...
svn:revision:77425
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 01:07:06 +00:00
Clifford Yapp b4809e94d7 For now just do the simple thing to see if a) it works and b) what else we're dealing with...
svn:revision:77424
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 01:02:43 +00:00
Clifford Yapp ae98fd2c5a Whoops, don't want unix prefix here
svn:revision:77423
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 00:55:43 +00:00
Clifford Yapp 39846ec1f3 Start figuring out the particular incantations we'll need for Tcl building on Windows...
svn:revision:77422
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 00:54:45 +00:00
Clifford Yapp a58873bd60 We want to copy the source directory if the build expects to take place IN the source directory, to avoid altering the BRL-CAD source tree during build.
svn:revision:77421
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-14 00:21:48 +00:00
Clifford Yapp 1191344099 Can do something like this to keep the stand-alone capability and still integrate with the parent build (this isn't working right now, but illustrates the idea.)
svn:revision:77418
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-13 19:42:37 +00:00
Clifford Yapp ab2d88dc87 Update summary reporting
svn:revision:77416
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-13 19:27:37 +00:00
Clifford Yapp 9f413a52ca Add reset variables for flipping between configurations.
svn:revision:77414
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-13 19:00:33 +00:00
Clifford Yapp 8d7c64f696 Update the gdal build for the OBJECT issue as well, add a comment to the section in BRLCAD_Targets.cmake that handles this for our targets.
svn:revision:77413
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-13 18:11:14 +00:00
Clifford Yapp 7b087d1026 Ah! Need to let the obj build target know that it too depends on any targets in the lib list. Makes sense in retrospect - object target is a separate target, and it doesn't automatically depend on what its 'parent' linking target depended on.
svn:revision:77412
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-13 17:38:26 +00:00
Clifford Yapp 4576ab316d Adjust include dirs and the management of -isystem.
svn:revision:77411
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-13 17:22:33 +00:00
Clifford Yapp 22ec958816 Checkpoint. Using this approach the isystem marking for external includes won't work - we need to list external dirs explicitly somehow so that mechanism is less fragile. Also, still have some ordering issue where openNURBS is getting system zlib instead of local zlib sometimes.
svn:revision:77410
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-13 15:30:02 +00:00
Clifford Yapp cfaba5b2cd Try to collect the various FindPERPLEX changes and consolidate them.
svn:revision:77407
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-11 15:29:53 +00:00
Clifford Yapp a30aa0d96f Try to collect the various FindLEMON changes and consolidate them.
svn:revision:77406
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-11 15:25:38 +00:00
Clifford Yapp ef6aa3cbaa Start setting up to deal with stepcode. This will require a proper FindSTEPCODE.cmake to work as intended, as well as updating the step converter CMake codes to actually use library variables rather than the build targets.
svn:revision:77405
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 19:49:24 +00:00
Clifford Yapp 83118041bc Add a NOINSTALL option to ExternalProject_ByProducts so we can stage in the build dir but not install in the final distribution.
svn:revision:77404
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 19:47:59 +00:00
Clifford Yapp dc977012bd Set include dirs and position headers so the gdal plugin builds.
svn:revision:77403
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 15:54:40 +00:00
Clifford Yapp 04f8ab37bf Set variables for the parent builds. GDAL and STEPCODE are going to need some more work, and we'll need to either install headers or point to the source trees...
svn:revision:77402
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 15:47:19 +00:00
Clifford Yapp 686d460fcc Report what's going on if the initialization fails.
svn:revision:77401
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 15:46:11 +00:00
Clifford Yapp 3afab3b8ee Ah - tkhtml using static stubs was exercising otherwise dormant (and incorrect) portions of the logic. Also wasn't getting Tk setup on reconfigure because TK_LIBRARY was set - will need some better when-to-build logic, but for now get it running.
svn:revision:77400
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 03:42:43 +00:00
Clifford Yapp 3152d5b140 Very important flag we weren't setting to get working linking, apparently. Per https://stackoverflow.com/a/49390802 set IMPORTED_NO_SONAME to true. Using the targets now seems to produce correct links, at least in the initial test.
svn:revision:77399
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 03:01:43 +00:00
Clifford Yapp b2be09c186 More 3rd party work. Moderately maddening - if I use the full path variable setting the linking works but the dependencies don't trigger, but if I go the other way and use the imported targets the libtcl.so linkage is wrong.
svn:revision:77398
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-10 02:45:34 +00:00
Clifford Yapp f54b44f5b9 Start working on FindTCL
svn:revision:77397
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 20:39:24 +00:00
Clifford Yapp 4038e46ab6 Right, no longer magically picking up the Z_PREFIX define from a zlib build higher up the src/other CMakeLists.txt... there must be a better way to manage this...
svn:revision:77396
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 19:57:08 +00:00
Clifford Yapp 2046888a57 More adjustments to targets. Probably need to revisit the ET_target_props logic, or at least make the relocation logic respect the higher level variables rather than just LIB_DIR and BIN_DIR...
svn:revision:77395
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 19:44:40 +00:00
Clifford Yapp 3f54657b56 Use of this is isolated now, remove higher level copy.
svn:revision:77394
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 19:31:02 +00:00
Clifford Yapp 7eb5aa56b8 Spoof FindPNG.cmake - since we're back to a non-superbuild setup (will need to rename things accordingly) we're back to needing to satisfy the Find packages with the imported targets. Need to systematically review once things stablize a bit.
svn:revision:77393
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 19:27:35 +00:00
Clifford Yapp 4255844cf9 Couple adjustments
svn:revision:77392
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 19:23:20 +00:00
Clifford Yapp 6fcd3233ef Start working on integrating the new superbuild setup back into the parent build.
svn:revision:77391
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 19:14:02 +00:00
Clifford Yapp 2068f3d92d Stubs are the Tcl 'static' libs, which we do want.
svn:revision:77390
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 18:24:04 +00:00
Clifford Yapp 4e17cf07a0 Fix file lists
svn:revision:77389
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 17:15:12 +00:00
Clifford Yapp 4ceef24515 Working on install behavior
svn:revision:77388
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 16:59:55 +00:00
Clifford Yapp 98417cfeeb Don't make install rules if we're not using the target.
svn:revision:77387
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 16:43:00 +00:00
Clifford Yapp 584a78bad7 Enable the remainder of the itcl/itk packages.
svn:revision:77386
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 15:12:44 +00:00
Clifford Yapp 9b908dddee Fix typo in stepcode.cmake
svn:revision:77385
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 14:49:04 +00:00
Clifford Yapp 53e8059696 Enable itcl
svn:revision:77384
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 14:41:29 +00:00
Clifford Yapp e2bcf5f617 Enable tk
svn:revision:77383
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 14:33:33 +00:00
Clifford Yapp 73ca3398ce Don't want one target per file unless that proves necessary for things to work...
svn:revision:77382
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 14:20:15 +00:00
Clifford Yapp d3c82fbe74 Get Tcl building, at least with a basic setup.
svn:revision:77381
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 14:13:29 +00:00
Clifford Yapp 6c119bae38 Hmm. Multi-Config is going to be a problem for Tcl and other non-CMake builds...
svn:revision:77380
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 14:01:53 +00:00
Clifford Yapp 633b267f23 Make some adjustments to get png using local zlibd definitions (we're not getting the zlib prefixes through add_subdirectory any more, so we have to teach the png build itself how to add them).
svn:revision:77379
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 13:29:51 +00:00
Clifford Yapp b5d2c0d97e Adjust dependency setup for file copying
svn:revision:77378
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 13:17:05 +00:00
Clifford Yapp 4918f23ca3 Start working on gdal
svn:revision:77377
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 12:55:20 +00:00
Clifford Yapp 095d64b641 Enable proj-4
svn:revision:77376
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 12:41:17 +00:00
Clifford Yapp e7f0908ac0 Get stepcode to build, fix ordering issue with png and zlib. As we're adding more components, we're starting to stress the dependency system a bit more.
svn:revision:77375
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 03:30:43 +00:00
Clifford Yapp a35928fd82 Get png building.
svn:revision:77374
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 01:02:03 +00:00
Clifford Yapp f572b0f921 Grr - these two settings in png's build are problematic for Ninja Multi-Config.
svn:revision:77373
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-09 01:00:35 +00:00
Clifford Yapp ed20eaf1d2 Enable netpbm
svn:revision:77372
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-08 22:24:45 +00:00
Clifford Yapp 806ec1ed10 turn on regex build
svn:revision:77371
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-08 21:52:21 +00:00
Clifford Yapp cab2cd01f2 Start roughing out another approach, this time trying to plan ahead a bit more for multiconfig (in particular the new Ninja multiconfig, which requires multiconfig RPath handling...)
svn:revision:77370
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-08 20:23:14 +00:00
Clifford Yapp a980bf7d4b Fix variable name
svn:revision:77361
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-07 20:12:49 +00:00
Clifford Yapp 0f45aea0ee Use variable, not hardcoded path
svn:revision:77360
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-07 20:10:56 +00:00
Clifford Yapp 37c16dc776 Back out experiment.
svn:revision:77359
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-07 19:24:07 +00:00
Clifford Yapp f8290c5ea1 Checkpoint. Need to stop and rethink again. Previous approach woudl work for single config setups, but will not work for multiconfig. Need multiple 'installed' copies in the build dir in the multiconfig setup, which isn't what the build systems are designed for - they expect one final install dir.
svn:revision:77355
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-07 14:43:16 +00:00
Clifford Yapp f1a15b678e Need to redo summary printing.
svn:revision:77354
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 22:28:42 +00:00
Clifford Yapp 5a00c05490 use the printtime.cmake script
svn:revision:77348
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 20:00:18 +00:00
Clifford Yapp 3a5468d6ef CMake version required is new enough now... significant simplification of the timing code used by BRL-CAD's CMake build system.
svn:revision:77346
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 18:33:20 +00:00
Clifford Yapp 1bcf47829c Correct path being set after .
svn:revision:77345
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 17:24:56 +00:00
Clifford Yapp 196a501a2d Getting close to a successful make install
svn:revision:77344
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 16:45:52 +00:00
Clifford Yapp a55e9411be It will be the parent build that needs to do these extensions
svn:revision:77343
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 16:18:33 +00:00
Clifford Yapp e2a853e9ca Ah - need to pass the CMAKE_BUILD_RPATH from the main build to the src/superbuild subconfigure
svn:revision:77342
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 13:53:51 +00:00
Clifford Yapp 3070cbf783 simplify
svn:revision:77341
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 13:31:07 +00:00
Clifford Yapp 11cfd080f2 Need to explore more precise control of per-target RPATH properties, see if it can improve their management...
svn:revision:77337
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 01:24:51 +00:00
Clifford Yapp 3f41a4df5c Adjustments... going to need to look at the rpath handling to make this work, needs updating.
svn:revision:77336
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-06 00:39:30 +00:00
Clifford Yapp 994fa74225 Checkpoint work on an approach that incorporates the superbuild builds into the configure step, rather than the build step. Has the considerable advantage of allowing us to keep most of the BRL-CAD build logic intact, but shifts most of the build time for third party deps into configure.
svn:revision:77335
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-05 17:16:38 +00:00
Clifford Yapp cf523886ef Checkpoint work on an approach that incorporates the superbuild builds into the configure step, rather than the build step. Has the considerable advantage of allowing us to keep most of the BRL-CAD build logic intact, but shifts most of the build time for third party deps into configure. (preliminary file move commit) 2020-10-05 17:16:38 +00:00
Clifford Yapp a7a5e5a337 Experiment with particular roles for src/other and src/superbuild
svn:revision:77323
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-02 15:37:12 +00:00
Clifford Yapp 4913a83082 Starting to see a logical grouping here. src/superbuild will hold logic for third party components we can actually use the system version of, if it exists. Builds where we know we can't use a system version or are one-offs in some other sense will remain in src/other and will be handled more simply, since we already know the answer.
svn:revision:77322
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-02 14:06:39 +00:00
Clifford Yapp 2fbc1ab963 Merge from trunk - r77303 through r77320
svn:revision:77321
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-02 13:26:00 +00:00
Clifford Yapp ffb25ab39e Merge from trunk - r77233 through r77302
svn:revision:77304
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-01 13:18:29 +00:00
Clifford Yapp 4231025196 List other itk files
svn:revision:77301
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-01 12:16:59 +00:00
Clifford Yapp 30d7f06e36 various fixes to superbuild project values
svn:revision:77300
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-01 12:05:10 +00:00
Clifford Yapp b972b7f1e7 Need tkhtml and tktable as well here for Archer.
svn:revision:77299
svn:branch:thirdparty_rework
svn:account:starseeker
2020-10-01 10:58:21 +00:00
Clifford Yapp 601c598b31 Whoops, using wrong path prefix.
svn:revision:77296
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 22:11:27 +00:00
Clifford Yapp d8e66da9a7 Actually, I think this requires a BRLCAD_BLD dependency, not just deps, to make sure everything is set up correctly...
svn:revision:77295
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 21:51:44 +00:00
Clifford Yapp 67511415db To make sure the steps execute in series in the cmake --build, make two separate targets.
svn:revision:77294
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 21:48:01 +00:00
Clifford Yapp 04c58aa68c Add a 'brlcad' custom target with ALL set, that depends on the deps target and triggers the BRL-CAD subbuild. This has the effect of making BRL-CAD building a 'top-level' action for the superbuild project. I.e., editing a source file in (say) libbu and then typing 'make' will rebuild the relevant portions of BRL-CAD, whereas with just the BRLCAD_BLD external project it would view the external project as 'complete' and not rebuild it. The build will still not trigger on changes to the src/other files, which is a departure from the integrated src/other build but is apparently typical of ExternalProject_Add setups. In particular, with non-CMake build systems possibly in use in external projects, the behavior we would see may be less than ideal in a rebuild scenario - it may be preferable to require a manual build+install step on the relatively rare occasions we need to change src/other files.
svn:revision:77293
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 21:43:42 +00:00
Clifford Yapp 6cc242488a Fix Tk stub naming, disable debug msgs. MGED and Archer now launch 'installed' into the superbuild directory. The question now becomes, how to create a superbuild install.
svn:revision:77292
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 21:04:56 +00:00
Clifford Yapp 1a6948a794 Need the TCL_ROOT enabled FindTCL.cmake files in src/other
svn:revision:77291
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 20:53:17 +00:00
Clifford Yapp 2957276c54 init.c is the key place to specify the version
svn:revision:77290
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 19:30:13 +00:00
Clifford Yapp 528d80cc73 Redo the tclcad auto_path setup, be more agressive in init about setting tcl_library. Gets closer to building and running, but vanilla Tcl/Tk 8.6 installs Itcl 4, and most of our Tcl code doesn't explicitly call out version 3 when doing a package require.
svn:revision:77288
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 19:13:07 +00:00
Clifford Yapp f1d85efbe5 Report what happened if Tcl or Tk didn't initialize
svn:revision:77286
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 15:24:43 +00:00
Clifford Yapp 493fbcd249 Switch auto_path to using a vls for the buffer
svn:revision:77285
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 15:24:05 +00:00
Clifford Yapp 2e1fcc4d57 Add a 'deps' target so we can build just the dependencies ahead of doing the main build. Also, always check locally first for Tcl related libraries - the possible target set coverted by FindTCL is larger than just TCL_BLD.
svn:revision:77284
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 14:49:37 +00:00
Clifford Yapp 03f00e6f41 Make a stab at updating FindTCL to respect TCL_ROOT
svn:revision:77283
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 14:45:00 +00:00
Clifford Yapp f397de1676 Still need to restore build flags, adjust PROJ4 finding to support _ROOT specifier.
svn:revision:77282
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 12:51:05 +00:00
Clifford Yapp a5a1462f09 Add note about a tricky problem...
svn:revision:77281
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 12:40:32 +00:00
Clifford Yapp 330920904c Fix misc/tools, rename unclear variable that pertained to both misc/tools and src/other.
svn:revision:77280
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-30 00:19:06 +00:00
Clifford Yapp b45e9c6558 Whole lot of weird things going on, but checkpoint first compile of BRL-CAD with new setup.
svn:revision:77279
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 21:55:16 +00:00
Clifford Yapp 0caca59e29 Start unwiring old src/other setup.
svn:revision:77278
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 21:13:18 +00:00
Clifford Yapp a96cb882e4 Going this route, we're going to have to properly figure out how to feed find_package for all of these. Will also have to turn back on a bunch of header installation logic in the external builds, since we need it to set the state for BRL-CAD compilation now and we're no longer suppressing it to keep them out of the install.
svn:revision:77277
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 18:55:20 +00:00
Clifford Yapp 8f294d5246 Get as far as starting to do a BRL-CAD build (with system libs).
svn:revision:77276
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 18:47:02 +00:00
Clifford Yapp 3ec3a568dd Add Iwidgets
svn:revision:77271
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 17:24:34 +00:00
Clifford Yapp b72130f96c remove debug msg
svn:revision:77270
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 15:40:39 +00:00
Clifford Yapp 5e52227365 Tk may be using a system Tcl
svn:revision:77269
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 15:39:22 +00:00
Clifford Yapp 663c856c61 Shouldn't need this any more
svn:revision:77268
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 15:25:11 +00:00
Clifford Yapp d0dd08eacd Enable Itk build
svn:revision:77267
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 15:16:47 +00:00
Clifford Yapp 370f85f152 Enable Itcl compilation.
svn:revision:77266
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 14:42:12 +00:00
Clifford Yapp e8767857af Add vanilla IWidgets 4.1.1
svn:revision:77265
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 13:00:33 +00:00
Clifford Yapp fa46d9684d Add vanilla Itk 3.4.2
svn:revision:77264
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 12:51:41 +00:00
Clifford Yapp 7333549c81 Add vanilla Itcl 3.4.3
svn:revision:77263
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 12:48:22 +00:00
Clifford Yapp e417413e78 Get Tk building with the new setup.
svn:revision:77262
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 12:31:42 +00:00
Clifford Yapp 7d19a99321 Put in vanilla Tk 8.6.10
svn:revision:77261
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 12:28:22 +00:00
Clifford Yapp 2b69b7c047 32 vs 64 bit must be decided very early in the process.
svn:revision:77260
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-29 12:09:14 +00:00
Clifford Yapp 0b0328afa5 Have to do a bit more rewriting to handle zlib naming, but the basic Tcl building structure put in place earlier seems to still be working (at least on Linux.)
svn:revision:77256
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-28 19:03:14 +00:00
Clifford Yapp 4d7c171d7e Put the vanilla tcl 8.6.10 in for testing.
svn:revision:77255
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-28 17:38:12 +00:00
Clifford Yapp efbc543372 Add a few more superbuild projects
svn:revision:77254
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-28 15:02:44 +00:00
Clifford Yapp ba86e0cd1a This is going to get incomprehensible as one file - have CMakeLists.txt serve as the overall organizer and break each component's specific logic into an individual file.
svn:revision:77253
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-28 14:33:26 +00:00
Clifford Yapp 3fa78f4e4b If this works out, most of the messy pieces of 3rd party libs will be pushed down into the superbuild. In an ideal world, as far as the main BRL-CAD logic is concerned, there shouldn't really be any difference between the local superbuild supplied version of the lib and a system version. What to detect with find_package will be handled by the *_ROOT settings passed in at configure time from the superbuild. It will be the superbuild's problem to produce the final installers and packages (which *will* be a problem) but it should no longer be necessary to handle it at this level. In face, we may ultimately be able to transition these find_package calls to the portions of the code that are actually using them.
svn:revision:77252
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-27 18:59:31 +00:00
Clifford Yapp 43d4b260df The guard we put in so long ago to prevent detecting an already installed BRL-CAD works against us in the superbuild, since we actually do want to be searching CMAKE_INSTALL_PREFIX now (it is the equivalent of the CMAKE_BINARY_DIR as far as being the intermediate staging area for the subbuilds - assembling the final bundle for actual installation will have to be a separate step.) Accordingly, we no longer want to filter on CMAKE_INSTALL_PREFIX here - it actually breaks what we're trying to do. We do, however, still want to prevent any searching in the final (i.e. /usr/brlcad/...) locations. Variable names may shift over time, but for now get CMAKE_INSTALL_PREFIX out of the filtering and stub in a notional BRLCAD_INSTALL_PREFIX so we can proceed.
svn:revision:77251
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-27 18:52:31 +00:00
Clifford Yapp b77395509d More work on superbuilding
svn:revision:77250
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-27 17:43:58 +00:00
Clifford Yapp 37a6e5dcb5 Get as far as building stepcode
svn:revision:77249
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-27 17:00:36 +00:00
Clifford Yapp ae251e779e Checkpoint. lemon and perplex will need to be part of the superbuild for stepcode...
svn:revision:77248
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-27 15:27:03 +00:00
Clifford Yapp a28c83ea74 Add utahrle
svn:revision:77247
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 19:10:08 +00:00
Clifford Yapp 4b62517a61 Found a way to be less verbose about conditionally pointing builds to local copies.
svn:revision:77246
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 19:02:26 +00:00
Clifford Yapp 59e4a1c217 Work on building a few more libraries. Still need to figure out how to handle non-standard lib name package finding...
svn:revision:77245
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 18:32:02 +00:00
Clifford Yapp eb71222457 Replace hardcoding with variables, try to minimize MSVC conditionals in higher level code.
svn:revision:77244
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 17:41:28 +00:00
Clifford Yapp 7df3e731cb Rename impacts Windows names as well.
svn:revision:77243
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 15:50:10 +00:00
Clifford Yapp 4f68d9ec95 Ugh. Fancy ExternalProject tricks are going to need some rethinking for the superbuild.
svn:revision:77242
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 01:34:38 +00:00
Clifford Yapp 8e91f0b91a The zlib name is a pain...
svn:revision:77241
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 01:26:24 +00:00
Clifford Yapp 6220ea39e2 First steps towards having the superbuild build something.
svn:revision:77240
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-26 01:20:57 +00:00
Clifford Yapp d15971695c Whoops, missed one
svn:revision:77236
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-25 19:05:28 +00:00
Clifford Yapp 8623563528 Not functional, but pull in some of the trunk changes so we match more closely.
svn:revision:77235
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-25 19:03:11 +00:00
Clifford Yapp 953816293c Need to double check, but I think the preferentially local includes are still be what we want in this scenario...
svn:revision:77234
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-25 18:34:02 +00:00
Clifford Yapp 8826aab16d Merge trunk changes r76150 through r77232 - needs some repair work, just getting the bulk of it pulled in here.
svn:revision:77233
svn:branch:thirdparty_rework
svn:account:starseeker
2020-09-25 18:19:35 +00:00
Clifford Yapp 0d1662efa8 Merge trunk changes from r75818 through r76150, sans src/other
svn:revision:76151
svn:branch:thirdparty_rework
svn:account:starseeker
2020-06-18 12:57:41 +00:00
Clifford Yapp 973c43abb3 Merge trunk changes through r75818 - src/other will need manual update, diverged too significantly for merge.
svn:revision:75819
svn:branch:thirdparty_rework
svn:account:starseeker
2020-05-15 14:34:42 +00:00
Clifford Yapp bcc4da58b5 Merge trunk changes through r75612 - src/other logic in trunk shifted, so the branch src/other logic will need manual adjustment.
svn:revision:75613
svn:branch:thirdparty_rework
svn:account:starseeker
2020-04-26 19:24:08 +00:00
Clifford Yapp 6a055e48d4 Got the Tcl/Tk 8.6 build up and running, so immedate impetus for ExternalProject_Add work is alleviated. Make a note about where to start if/when this is revisited - would still be better long term (particularly if we shift to even larger non-CMake dependencies) but a full shift to the superbuild pattern would be very disruptive to all the custom magic we've put in for our main CMake build. Worth doing, but will be a significant chunk of time to do right.
svn:revision:75240
svn:branch:thirdparty_rework
svn:account:starseeker
2020-04-01 21:59:50 +00:00
Clifford Yapp b1736fcb1a Among the other implications, we'll have to rethink how make install and CPack are handled...
svn:revision:75173
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-31 11:55:24 +00:00
Clifford Yapp 35b1fd6d84 Demonstrate fundamentally the triggering a build of a project from that same project with ExternalProject_Add.
svn:revision:75172
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-31 02:15:28 +00:00
Clifford Yapp efb6ad2549 My the toplevel CMakeLists.txt file has gotten long over the years. See if we can break some of this out into logical groupings to make the toplevel flow easier to follow. Some of this needs to happen at the superbuild stage prior to src/other builds getting kicked off...
svn:revision:75171
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-31 01:51:10 +00:00
Clifford Yapp e62fa90322 Trying a hack-and-slash build of trunk on Windows with system libs, it looks like we're going to have to go with our CMake builds for a couple of the Tcl/Tk packages in addition to Tkhtml...
svn:revision:75170
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-30 14:43:13 +00:00
Clifford Yapp 09cd303acc Checkpoint some exploratory work on a radical experiment.
svn:revision:75169
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-28 23:26:59 +00:00
Clifford Yapp d5797bb39d checkpoint
svn:revision:75168
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-28 22:06:02 +00:00
Clifford Yapp 22695e2cf7 use new includes
svn:revision:75167
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-28 20:55:21 +00:00
Clifford Yapp e4ffa75314 revert
svn:revision:75166
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-28 20:54:44 +00:00
Clifford Yapp 5472ff260e A significant bump in the road - CMake's dependency resolution doesn't include completing external projects before building main build source files. It'll try to build in anticipation of linking, but if the headers haven't been positioned by the external project's install step the build just fails. Apparently this is a known issue - see https://blog.kitware.com/cmake-superbuilds-git-submodules/ - and the normal fix is that there is one parent build whose job it is to manage all the others. I'm not at all sure yet what this would look like for a BRL-CAD build...
svn:revision:75165
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-28 19:57:02 +00:00
Clifford Yapp 15046b98b9 Start turning back on some of the BRL-CAD main compilation. Adjustments will be needed...
svn:revision:75164
svn:branch:thirdparty_rework
svn:account:starseeker
2020-03-28 19:07:33 +00:00
6677 changed files with 904923 additions and 13101 deletions
+189 -1261
View File
File diff suppressed because it is too large Load Diff
+41 -112
View File
@@ -530,6 +530,16 @@ first for a system version if BRLCAD_BUNDLED_LIBS is also AUTO.
Aliases: ENABLE_ZLIB, ENABLE_LIBZ
--- BRLCAD_NETPBM ---
Option for enabling and disabling compilation of the netpbm 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_NETPBM
--- BRLCAD_PNG ---
Option for enabling and disabling compilation of the Portable Network
@@ -541,16 +551,6 @@ AUTO.
Aliases: ENABLE_PNG
--- BRLCAD_NETPBM ---
Option for enabling and disabling compilation of the netpbm 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_NETPBM
--- BRLCAD_UTAHRLE ---
Option for enabling and disabling compilation of the Utah Raster
@@ -561,96 +561,6 @@ first for a system version if BRLCAD_BUNDLED_LIBS is also AUTO.
Aliases: ENABLE_UTAHRLE
--- BRLCAD_TCL ---
Option for enabling and disabling compilation of the Tcl 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_TCL
--- BRLCAD_TK ---
Option for enabling and disabling compilation of the Tk library
provided with BRL-CAD's source code. Default is AUTO, responsive to
the BRLCAD_TCL option and testing first for a system version if
BRLCAD_BUNDLED_LIBS is also AUTO. Option for enabling and disabling
compilation of the Tk graphics package for Tcl provided with BRL-CAD's
source distribution. Default is AUTO, auto-enabling if the BRLCAD_TCL
option is set to BUNDLED and testing first for a system version if
BRLCAD_TCL is set to AUTO or SYSTEM. If BRLCAD_TK is set to BUNDLED,
local copy is built even if a system version is present. This option
also depends on BRLCAD_ENABLE_TK being ON.
Aliases: ENABLE_TK
--- BRLCAD_ITCL ---
Option for enabling and disabling compilation of the IncrTcl package
for Tcl objects provided with BRL-CAD's source distribution. Default
is AUTO, auto-enabling if the BRLCAD_TCL option is set to BUNDLED and
testing first for a system version if BRLCAD_TCL is set to AUTO or
SYSTEM. If BRLCAD_ITCL is set to BUNDLED, local copy is built even if
a system version is present.
Aliases: ENABLE_ITCL
--- BRLCAD_ITK ---
Option for enabling and disabling compilation of the IncrTcl itk
package for Tk objects provided with BRL-CAD's source distribution.
Default is AUTO, auto-enabling if the BRLCAD_TCL option is set to
BUNDLED and testing first for a system version if BRLCAD_TCL is set to
AUTO or SYSTEM. If BRLCAD_ITK is set to BUNDLED, local copy is built
even if a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
Aliases: ENABLE_ITK
--- BRLCAD_IWIDGETS ---
Option for enabling and disabling compilation of the IWidgets Tk
widget package provided with BRL-CAD's source distribution. Default
is AUTO, auto-enabling if the BRLCAD_TCL option is set to BUNDLED and
testing first for a system version if BRLCAD_TCL is set to AUTO or
SYSTEM. If BRLCAD_IWIDGETS is set to BUNDLED, local copy is built even if
a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
Aliases: ENABLE_IWIDGETS
--- BRLCAD_TKHTML ---
Option for enabling and disabling compilation of the Tkhtml HTML
viewing package provided with BRL-CAD's source distribution. Default
is AUTO, auto-enabling if the BRLCAD_TCL option is set to BUNDLED and
testing first for a system version if BRLCAD_TCL is set to AUTO or
SYSTEM. If BRLCAD_TKHTML is set to BUNDLED, local copy is built even if
a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
Aliases: ENABLE_TKHTML
--- BRLCAD_TKTABLE ---
Option for enabling and disabling compilation of the Tktable graphical
table widget package provided with BRL-CAD's source distribution.
Default is AUTO, auto-enabling if the BRLCAD_TCL option is set to
BUNDLED and testing first for a system version if BRLCAD_TCL is set to
AUTO or SYSTEM. If BRLCAD_TKTABLE is set to BUNDLED, local copy is built
even if a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
Aliases: ENABLE_TKTABLE
--- BRLCAD_OPENNURBS ---
Option for enabling and disabling compilation of the openNURBS library
@@ -661,24 +571,33 @@ version if BRLCAD_BUNDLED_LIBS is also AUTO.
Aliases: ENABLE_OPENNURBS
--- BRLCAD_SC ---
--- BRLCAD_BSON ---
Option for enabling and disabling compilation of the NIST Step Class
Libraries 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.
Option for enabling and disabling compilation of the Libbson library
provided with BRL-CAD's source code. Default is BUNDLED, using
the included other/src version.
Aliases: ENABLE_SCL, ENABLE_STEP, ENABLE_STEP_CLASS_LIBRARIES
Aliases: ENABLE_BSON
--- BRLCAD_OSG ---
--- BRLCAD_POLY2TRI ---
Option for enabling and disabling compilation of the OpenSceneGraph
libraries 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.
Option for enabling and disabling compilation of the poly2tri 2D constrained
Delaunay triangulation 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_OPENSCENEGRAPH
Aliases: ENABLE_POLY2TRI
--- BRLCAD_RPLY ---
Option for enabling and disabling compilation of the RPly library for PLY file
input and ouput 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_RPLY
--- BRLCAD_PROJ4 ---
@@ -703,6 +622,16 @@ AUTO.
Aliases: ENABLE_GDAL
--- BRLCAD_TCL ---
Option for enabling and disabling compilation of the Tcl 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_TCL
*** Note - Do not add or edit configuration option descriptions and alias
lists in this file - those entries are auto-generated from information in
Vendored
+20 -40
View File
@@ -118,65 +118,41 @@ do
shift;;
--disable-libz) options="$options -DBRLCAD_ZLIB=SYSTEM";
shift;;
--enable-png) options="$options -DBRLCAD_PNG=BUNDLED";
shift;;
--disable-png) options="$options -DBRLCAD_PNG=SYSTEM";
shift;;
--enable-netpbm) options="$options -DBRLCAD_NETPBM=BUNDLED";
shift;;
--disable-netpbm) options="$options -DBRLCAD_NETPBM=SYSTEM";
shift;;
--enable-png) options="$options -DBRLCAD_PNG=BUNDLED";
shift;;
--disable-png) options="$options -DBRLCAD_PNG=SYSTEM";
shift;;
--enable-utahrle) options="$options -DBRLCAD_UTAHRLE=BUNDLED";
shift;;
--disable-utahrle) options="$options -DBRLCAD_UTAHRLE=SYSTEM";
shift;;
--enable-tcl) options="$options -DBRLCAD_TCL=BUNDLED";
shift;;
--disable-tcl) options="$options -DBRLCAD_TCL=SYSTEM";
shift;;
--enable-tk) options="$options -DBRLCAD_TK=BUNDLED";
shift;;
--disable-tk) options="$options -DBRLCAD_TK=SYSTEM";
shift;;
--enable-itcl) options="$options -DBRLCAD_ITCL=BUNDLED";
shift;;
--disable-itcl) options="$options -DBRLCAD_ITCL=SYSTEM";
shift;;
--enable-itk) options="$options -DBRLCAD_ITK=BUNDLED";
shift;;
--disable-itk) options="$options -DBRLCAD_ITK=SYSTEM";
shift;;
--enable-iwidgets) options="$options -DBRLCAD_IWIDGETS=BUNDLED";
shift;;
--disable-iwidgets) options="$options -DBRLCAD_IWIDGETS=SYSTEM";
shift;;
--enable-tkhtml) options="$options -DBRLCAD_TKHTML=BUNDLED";
shift;;
--disable-tkhtml) options="$options -DBRLCAD_TKHTML=SYSTEM";
shift;;
--enable-tktable) options="$options -DBRLCAD_TKTABLE=BUNDLED";
shift;;
--disable-tktable) options="$options -DBRLCAD_TKTABLE=SYSTEM";
shift;;
--enable-opennurbs) options="$options -DBRLCAD_OPENNURBS=BUNDLED";
shift;;
--disable-opennurbs) options="$options -DBRLCAD_OPENNURBS=SYSTEM";
shift;;
--enable-scl) options="$options -DBRLCAD_SC=BUNDLED";
--enable-bson) options="$options -DBRLCAD_BSON=BUNDLED";
shift;;
--disable-scl) options="$options -DBRLCAD_SC=SYSTEM";
--disable-bson) options="$options -DBRLCAD_BSON=SYSTEM";
shift;;
--enable-step) options="$options -DBRLCAD_SC=BUNDLED";
--enable-vds) options="$options -DBRLCAD_VDS=BUNDLED";
shift;;
--disable-step) options="$options -DBRLCAD_SC=SYSTEM";
--disable-vds) options="$options -DBRLCAD_VDS=SYSTEM";
shift;;
--enable-step-class-libraries) options="$options -DBRLCAD_SC=BUNDLED";
--enable-gdiam) options="$options -DBRLCAD_GDIAM=BUNDLED";
shift;;
--disable-step-class-libraries) options="$options -DBRLCAD_SC=SYSTEM";
--disable-gdiam) options="$options -DBRLCAD_GDIAM=SYSTEM";
shift;;
--enable-openscenegraph) options="$options -DBRLCAD_OSG=BUNDLED";
--enable-poly2tri) options="$options -DBRLCAD_POLY2TRI=BUNDLED";
shift;;
--disable-openscenegraph) options="$options -DBRLCAD_OSG=SYSTEM";
--disable-poly2tri) options="$options -DBRLCAD_POLY2TRI=SYSTEM";
shift;;
--enable-rply) options="$options -DBRLCAD_RPLY=BUNDLED";
shift;;
--disable-rply) options="$options -DBRLCAD_RPLY=SYSTEM";
shift;;
--enable-proj4) options="$options -DBRLCAD_PROJ4=BUNDLED";
shift;;
@@ -186,6 +162,10 @@ do
shift;;
--disable-gdal) options="$options -DBRLCAD_GDAL=SYSTEM";
shift;;
--enable-tcl) options="$options -DBRLCAD_TCL=BUNDLED";
shift;;
--disable-tcl) options="$options -DBRLCAD_TCL=SYSTEM";
shift;;
--prefix=*) inputstr=$1;
options="$options -DCMAKE_INSTALL_PREFIX=${inputstr#--prefix=}";
shift;;
+49
View File
@@ -0,0 +1,49 @@
Some design notes for CMake build logic:
Generator expressions have the potential (I think) to at least conceptually
clean up some of our mult-config aware logic. The key is to make logic that
can write the necessary text files (pkgindex files for Tcl, for example) at
build time.
The below example generates a file with file paths at build
time based on the current configuration:
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/info.txt
COMMAND ${CMAKE_COMMAND} -DOUT_DIR=${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR} -DCURR_CONFIG="$<CONFIG>" -P ${CMAKE_CURRENT_SOURCE_DIR}/info.cmake
)
add_custom_target(info DEPENDS ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/info.txt)
info.cmake contains:
set(OUTFILE "${OUT_DIR}/info.txt")
#get_filename_component(OUTFILE "${OUT_DIR}/info.txt" REALPATH)
function(WRITE_INFO_FILE)
file(WRITE "${OUTFILE}" "Current config: ${CURR_CONFIG}")
message("Wrote ${OUTFILE}")
endfunction(WRITE_INFO_FILE)
WRITE_INFO_FILE()
The "get_filename_component" call is not strictly necessary but can be used for
path outputs that are easier to read.
For outputs needing to know specific target file locations:
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib.txt
COMMAND ${CMAKE_COMMAND} -DOUT_DIR=${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR} -DLIB_FILE="$<TARGET_FILE:zlib>" -P ${CMAKE_CURRENT_SOURCE_DIR}/lib.cmake
)
add_custom_target(lib DEPENDS ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib.txt)
with lib.cmake:
set(OUTFILE "${OUT_DIR}/lib.txt")
#get_filename_component(OUTFILE "${OUT_DIR}/info.txt" REALPATH)
function(WRITE_LIB_INFO_FILE)
file(WRITE "${OUTFILE}" "Current library output location: ${LIB_FILE}")
message("Wrote ${OUTFILE}")
endfunction(WRITE_LIB_INFO_FILE)
WRITE_LIB_INFO_FILE()
+1
View File
@@ -237,6 +237,7 @@ typedef enum {
BU_DIR_DATA, /**< (read-only) data files (share) */
BU_DIR_DOC, /**< (read-only) documentation, (DATA/doc) */
BU_DIR_MAN, /**< (read-only) manual pages, (DATA/man) */
BU_DIR_INSTALL, /**< (read-only) root dir of install target */
BU_DIR_TEMP, /**< (read/write) temporary files (TEMP) */
BU_DIR_HOME, /**< (read/write) user home directory (HOME) */
BU_DIR_CACHE, /**< (read/write) user cache directory (BU_CACHE_DIR) */
+66
View File
@@ -0,0 +1,66 @@
#---------------------------------------------------------------------
# CMake by default provides four different configurations for multi-
# configuration build tools. We want only two - Debug and Release.
if(NOT ENABLE_ALL_CONFIG_TYPES)
if(CMAKE_CONFIGURATION_TYPES AND NOT "${CMAKE_CONFIGURATION_TYPES}" STREQUAL "Debug;Release")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Allowed BRL-CAD configuration types" FORCE)
endif(CMAKE_CONFIGURATION_TYPES AND NOT "${CMAKE_CONFIGURATION_TYPES}" STREQUAL "Debug;Release")
endif(NOT ENABLE_ALL_CONFIG_TYPES)
# Normalize the build type capitalization
if(CMAKE_BUILD_TYPE)
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_UPPER)
if ("${BUILD_TYPE_UPPER}" STREQUAL "RELEASE")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE)
endif ("${BUILD_TYPE_UPPER}" STREQUAL "RELEASE")
if ("${BUILD_TYPE_UPPER}" STREQUAL "DEBUG")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE)
endif ("${BUILD_TYPE_UPPER}" STREQUAL "DEBUG")
endif(CMAKE_BUILD_TYPE)
# Stash the build type so we can set up a drop-down menu in the gui
if(NOT BRLCAD_IS_SUBBUILD)
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "BRL-CAD high level build configuration")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "" Debug Release)
endif(NOT BRLCAD_IS_SUBBUILD)
if(CMAKE_CONFIGURATION_TYPES)
mark_as_advanced(CMAKE_BUILD_TYPE)
else(CMAKE_CONFIGURATION_TYPES)
mark_as_advanced(CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES)
#------------------------------------------------------------------------------
# For multi-configuration builds, we frequently need to know the run-time build
# directory. Confusingly, we need to do different things for install commands
# and custom command definitions. To manage this, we define
# CMAKE_CURRENT_BUILD_DIR_SCRIPT and CMAKE_CURRENT_BUILD_DIR_INSTALL once at
# the top level, then use them when we need the configuration-dependent path.
#
# Note that neither of these will work when we need to generate a .cmake file
# that does runtime detection of the current build configuration. CMake
# scripts run using "cmake -P script.cmake" style invocation are independent of
# the "main" build system and will not know how to resolve either of the below
# variables correctly. In that case, the script itself must check the current
# file in CMakeTmp/CURRENT_PATH (TODO - need to better organize and document
# this mechanism, given how critical it is proving... possible convention will
# be to have the string CURRENT_BUILD_DIR in any path that needs the relevant
# logic in a script, and a standard substitution routine...) and set any
# necessary path variables accordingly. (TODO - make a standard function to do
# that the right way that scripts can load and use - right now that logic is
# scattered all over the code and if we wanted to change where those files went
# it would be a lot of work.)
# TODO - in principle, this mechanism should be replaced with generator
# expressions
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CURRENT_BUILD_DIR_SCRIPT "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
set(CMAKE_CURRENT_BUILD_DIR_INSTALL "${CMAKE_BINARY_DIR}/\${BUILD_TYPE}")
else(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CURRENT_BUILD_DIR_SCRIPT "${CMAKE_BINARY_DIR}")
set(CMAKE_CURRENT_BUILD_DIR_INSTALL "${CMAKE_BINARY_DIR}")
endif(CMAKE_CONFIGURATION_TYPES)
# Mark CMAKE_CONFIGURATION_TYPES as advanced - users shouldn't be adjusting this
# directly.
mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
+187
View File
@@ -0,0 +1,187 @@
# Setup and checks related to system environment settings
#---------------------------------------------------------------------
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
# and set them to "C" so things like date output are as expected.
set(_orig_lc_all $ENV{LC_ALL})
set(_orig_lc_messages $ENV{LC_MESSAGES})
set(_orig_lang $ENV{LANG})
if(_orig_lc_all)
set(ENV{LC_ALL} C)
endif(_orig_lc_all)
if(_orig_lc_messages)
set(ENV{LC_MESSAGES} C)
endif(_orig_lc_messages)
if(_orig_lang)
set(ENV{LANG} C)
endif(_orig_lang)
#---------------------------------------------------------------------
# Package creation with CMake depends on the value of umask - if permissions
# are such that temporary files are created without permissions needed for
# generated packages, the resulting packages may behave badly when installed.
# In particular, RPM packages may improperly reset permissions on core
# directories such as /usr.
function(check_umask umask_val status_var)
string(REGEX REPLACE "[^x]" "" umask_x "${umask_val}")
string(REGEX REPLACE "[^r]" "" umask_r "${umask_val}")
string(LENGTH "${umask_r}" UMASK_HAVE_R)
set(${status_var} 0 PARENT_SCOPE)
if(UMASK_HAVE_R AND "${umask_x}" STREQUAL "xxx")
set(${status_var} 1 PARENT_SCOPE)
endif(UMASK_HAVE_R AND "${umask_x}" STREQUAL "xxx")
endfunction(check_umask)
# Note - umask is not always an executable, so find_program wont' necessarily
# determine whether the umask check is appropriate. If we don't find an
# executable, follow up to see if we can use sh to get the info.
find_program(UMASK_EXEC umask)
mark_as_advanced(UMASK_EXEC)
if(NOT UMASK_EXEC)
# If we don't have a umask cmd, see if sh -c "umask -S" works
execute_process(COMMAND sh -c "umask -S" OUTPUT_VARIABLE umask_out)
# Check if we've got something that looks like a umask output
if("${umask_out}" MATCHES "^u=.*g=.*o=.*")
set(UMASK_EXEC sh)
set(UMASK_EXEC_ARGS -c "umask -S")
endif("${umask_out}" MATCHES "^u=.*g=.*o=.*")
else(NOT UMASK_EXEC)
set(UMASK_EXEC_ARGS -S)
endif(NOT UMASK_EXEC)
if(UMASK_EXEC)
execute_process(COMMAND ${UMASK_EXEC} ${UMASK_EXEC_ARGS} OUTPUT_VARIABLE umask_curr)
string(STRIP "${umask_curr}" umask_curr)
check_umask("${umask_curr}" UMASK_OK)
if(NOT UMASK_OK)
message(" ")
message(WARNING "umask is set to ${umask_curr} - this setting is not recommended if one of the goals of this build is to generate packages. Use 'umask 022' for improved package behavior.")
if(SLEEP_EXEC)
execute_process(COMMAND ${SLEEP_EXEC} 1)
endif(SLEEP_EXEC)
endif(NOT UMASK_OK)
endif(UMASK_EXEC)
#---------------------------------------------------------------------
# Allow the BRLCAD_ROOT environment variable to set during build, but be noisy
# about it unless we're specifically told this is intentional. Having this
# happen by accident is generally not a good idea.
find_program(SLEEP_EXEC sleep)
mark_as_advanced(SLEEP_EXEC)
if(NOT "$ENV{BRLCAD_ROOT}" STREQUAL "" AND NOT BRLCAD_ROOT_OVERRIDE)
message(WARNING "\nBRLCAD_ROOT is presently set to \"$ENV{BRLCAD_ROOT}\"\nBRLCAD_ROOT should typically be used only when needed as a runtime override, not during compilation. Building with BRLCAD_ROOT set may produce unexpected behavior during both compilation and subsequent program execution. It is *highly* recommended that BRLCAD_ROOT be unset and not used.\n")
if(SLEEP_EXEC)
execute_process(COMMAND ${SLEEP_EXEC} 2)
endif(SLEEP_EXEC)
endif(NOT "$ENV{BRLCAD_ROOT}" STREQUAL "" AND NOT BRLCAD_ROOT_OVERRIDE)
#---------------------------------------------------------------------
# Characterize the system as 32 or 64 bit - this has an impact on many
# of the subsequent operations, including find_package results, so it
# must be done up front.
set(WORD_SIZE_LABEL "Compile as 32BIT or 64BIT?")
if(NOT BRLCAD_WORD_SIZE)
set(BRLCAD_WORD_SIZE "AUTO" CACHE STRING WORD_SIZE_LABEL)
endif(NOT BRLCAD_WORD_SIZE)
set_property(CACHE BRLCAD_WORD_SIZE PROPERTY STRINGS AUTO 32BIT 64BIT)
string(TOUPPER "${BRLCAD_WORD_SIZE}" BRLCAD_WORD_SIZE_UPPER)
set(BRLCAD_WORD_SIZE "${BRLCAD_WORD_SIZE_UPPER}" CACHE STRING WORD_SIZE_LABEL FORCE)
if(NOT BRLCAD_WORD_SIZE MATCHES "AUTO" AND NOT BRLCAD_WORD_SIZE MATCHES "64BIT" AND NOT BRLCAD_WORD_SIZE MATCHES "32BIT")
message(WARNING "Unknown value ${BRLCAD_WORD_SIZE} supplied for BRLCAD_WORD_SIZE - defaulting to AUTO")
message(WARNING "Valid options are AUTO, 32BIT and 64BIT")
set(BRLCAD_WORD_SIZE "AUTO" CACHE STRING WORD_SIZE_LABEL FORCE)
endif(NOT BRLCAD_WORD_SIZE MATCHES "AUTO" AND NOT BRLCAD_WORD_SIZE MATCHES "64BIT" AND NOT BRLCAD_WORD_SIZE MATCHES "32BIT")
# On Windows, we can't set word size at CMake configure time - the
# compiler chosen at the beginning dictates the result. Mark as
# advanced in that situation.
if(MSVC)
mark_as_advanced(BRLCAD_WORD_SIZE)
endif(MSVC)
# calculate the size of a pointer if we haven't already
include(CheckTypeSize)
check_type_size("void *" CMAKE_SIZEOF_VOID_P)
# still not defined?
if(NOT CMAKE_SIZEOF_VOID_P)
message(WARNING "CMAKE_SIZEOF_VOID_P is not defined - assuming 32 bit platform")
set(CMAKE_SIZEOF_VOID_P 4)
endif(NOT CMAKE_SIZEOF_VOID_P)
if(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
if(${CMAKE_SIZEOF_VOID_P} MATCHES "^8$")
set(CMAKE_WORD_SIZE "64BIT")
set(BRLCAD_WORD_SIZE "64BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
else(${CMAKE_SIZEOF_VOID_P} MATCHES "^8$")
if(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$")
set(CMAKE_WORD_SIZE "32BIT")
set(BRLCAD_WORD_SIZE "32BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
else(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$")
if(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$")
set(CMAKE_WORD_SIZE "16BIT")
set(BRLCAD_WORD_SIZE "16BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
else(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$")
set(CMAKE_WORD_SIZE "8BIT")
set(BRLCAD_WORD_SIZE "8BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$")
endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$")
endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^8$")
else(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
set(CMAKE_WORD_SIZE "${BRLCAD_WORD_SIZE}")
endif(${BRLCAD_WORD_SIZE} MATCHES "AUTO")
# Enable/disable 64-bit build settings for MSVC, which is apparently
# determined at the CMake generator level - need to override other
# settings if the compiler disagrees with them.
if(MSVC)
if(CMAKE_CL_64)
if(NOT ${CMAKE_WORD_SIZE} MATCHES "64BIT")
set(CMAKE_WORD_SIZE "64BIT")
if(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
message(WARNING "Selected MSVC compiler is 64BIT - setting word size to 64BIT. To perform a 32BIT MSVC build, select the 32BIT MSVC CMake generator.")
set(BRLCAD_WORD_SIZE "64BIT" CACHE STRING WORD_SIZE_LABEL FORCE)
endif(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
endif(NOT ${CMAKE_WORD_SIZE} MATCHES "64BIT")
add_definitions("-D_WIN64")
else(CMAKE_CL_64)
set(CMAKE_SIZEOF_VOID_P 4)
if(NOT ${CMAKE_WORD_SIZE} MATCHES "32BIT")
set(CMAKE_WORD_SIZE "32BIT")
if(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
message(WARNING "Selected MSVC compiler is 32BIT - setting word size to 32BIT. To perform a 64BIT MSVC build, select the 64BIT MSVC CMake generator.")
set(BRLCAD_WORD_SIZE "32BIT" CACHE STRING WORD_SIZE_LABEL FORCE)
endif(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
endif(NOT ${CMAKE_WORD_SIZE} MATCHES "32BIT")
endif(CMAKE_CL_64)
endif(MSVC)
if (APPLE)
if (${CMAKE_WORD_SIZE} MATCHES "32BIT")
set(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Building for i386" FORCE)
endif (${CMAKE_WORD_SIZE} MATCHES "32BIT")
endif (APPLE)
# Based on what we are doing, we may need to constrain our search paths
#
# NOTE: Ideally we would set a matching property for 32 bit paths
# on systems that default to 64 bit - as of 2.8.8 CMake doesn't yet
# support FIND_LIBRARY_USE_LIB32_PATHS. There is a bug report on the
# topic here: http://www.cmake.org/Bug/view.php?id=11260
#
if(${CMAKE_WORD_SIZE} MATCHES "32BIT")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
else(${CMAKE_WORD_SIZE} MATCHES "32BIT")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
endif(${CMAKE_WORD_SIZE} MATCHES "32BIT")
# One of the problems with 32/64 building is we need to search anew
# for 64 bit libs after a 32 bit configure, or vice versa.
if(PREVIOUS_CONFIGURE_TYPE)
if(NOT ${PREVIOUS_CONFIGURE_TYPE} MATCHES ${CMAKE_WORD_SIZE})
include(ResetCache)
RESET_CACHE_file()
endif(NOT ${PREVIOUS_CONFIGURE_TYPE} MATCHES ${CMAKE_WORD_SIZE})
endif(PREVIOUS_CONFIGURE_TYPE)
set(PREVIOUS_CONFIGURE_TYPE ${CMAKE_WORD_SIZE} CACHE STRING "Previous configuration word size" FORCE)
mark_as_advanced(PREVIOUS_CONFIGURE_TYPE)
+159
View File
@@ -0,0 +1,159 @@
#---------------------------------------------------------------------
# Searching the system for packages presents something of a dilemma -
# in most situations it is Very Bad for a BRL-CAD build to be using
# older versions of libraries in install directories as search results.
# Generally, the desired behavior is to ignore whatever libraries are
# in the install directories, and only use external library results if
# they are something already found on the system due to non-BRL-CAD
# installation (source compile, package managers, etc.). Unfortunately,
# CMake's standard behavior is to add CMAKE_INSTALL_PREFIX to the search
# path once defined, resulting in (for us) the unexpected behavior of
# returning old installed libraries when CMake is re-run in a directory.
#
# To work around this, there are two possible approaches. One,
# identified by Maik Beckmann, operates on CMAKE_SYSTEM_PREFIX_PATH:
#
# http://www.cmake.org/pipermail/cmake/2010-October/040292.html
#
# The other, pointed out by Michael Hertling, uses the
# CMake_[SYSTEM_]IGNORE_PATH variables.
#
# http://www.cmake.org/pipermail/cmake/2011-May/044503.html
#
# BRL-CAD initially operated on CMAKE_SYSTEM_PREFIX_PATH, but has
# switched to using the *_IGNORE_PATH variables. This requires
# CMake 2.8.3 or later.
#
# The complication with ignoring install paths is if we are
# installing to a "legitimate" system search path - i.e. our
# CMAKE_INSTALL_PREFIX value is standard enough that it is a legitimate
# search target for find_package. In this case, we can't exclude
# accidental hits on our libraries without also excluding legitimate
# find_package results. So the net results are:
#
# 1. If you are planning to install to a system directory (typically
# a bad idea but the settings are legal) clean out the old system
# first or accept that the old libraries will be found and used.
#
# 2. For more custom paths, the logic below will avoid the value
# of CMAKE_INSTALL_PREFIX in find_package searches
#
# (Note: CMAKE_INSTALL_PREFIX must be checked in the case where someone
# sets it on the command line prior to CMake being run. BRLCAD_PREFIX
# preserves the CMAKE_INSTALL_PREFIX setting from the previous CMake run.
# CMAKE_INSTALL_PREFIX does not seem to be immediately set in this context
# when CMake is re-run unless specified explicitly on the command line.
# To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value
# is available, BRLCAD_PREFIX is used to store the value in the cache.)
if(CMAKE_INSTALL_PREFIX)
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
get_filename_component(PATH_NORMALIZED "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}" ABSOLUTE)
set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
endif(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
endif(CMAKE_INSTALL_PREFIX)
if(BRLCAD_PREFIX)
if(NOT "${BRLCAD_PREFIX}" STREQUAL "/usr" AND NOT "${BRLCAD_PREFIX}" STREQUAL "/usr/local")
get_filename_component(PATH_NORMALIZED "${BRLCAD_PREFIX}/${LIB_DIR}" ABSOLUTE)
set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
endif(NOT "${BRLCAD_PREFIX}" STREQUAL "/usr" AND NOT "${BRLCAD_PREFIX}" STREQUAL "/usr/local")
endif(BRLCAD_PREFIX)
mark_as_advanced(CMAKE_SYSTEM_IGNORE_PATH)
#---------------------------------------------------------------------
# We want to check /usr/local by default, so add it if it exists
if (IS_DIRECTORY /usr/local)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local)
if (IS_DIRECTORY /usr/local/include)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} /usr/local/include)
include_directories(AFTER SYSTEM /usr/local/include)
endif (IS_DIRECTORY /usr/local/include)
endif (IS_DIRECTORY /usr/local)
#---------------------------------------------------------------------
# The location in which to install BRL-CAD. Only do this if
# CMAKE_INSTALL_PREFIX hasn't been set already, to try and allow
# parent builds (if any) some control.
# TODO - generator expressions may be a way to replace some of this logic (or
# improve it) by letting us ditch the logic tracking whether the path is
# initialized to default - that's used to know whether or not it is safe to
# override CMAKE_INSTALL_PREFIX based on build type. If we use the generator
# expressions, we won't have to be concerned about that - problem is that
# change will require updating all the install commands in the build target
# functions. Third party logic will probably need to shift over to the new
# ExternalProject_Add approach first as well - that way unmodified install
# commands in 3rd party CMake files will be moot.
#
# if (NOT CMAKE_INSTALL_PREFIX)
# set(CMAKE_INSTALL_PREFIX "/usr/brlcad/")
# if (NOT MSVC)
# set(gen_exp $<IF:$<CONFIG:Debug>,dev-${BRLCAD_VERSION}/,$<IF:$<CONFIG:Release>,rel-${BRLCAD_VERSION}/${BRLCAD_VERSION},>>)
# else (NOT MSVC)
# set(gen_exp)
# if(CMAKE_CL_64)
# set(CMAKE_INSTALL_PREFIX "C:/Program Files/BRL-CAD ${BRLCAD_VERSION}")
# else(CMAKE_CL_64)
# set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD ${BRLCAD_VERSION}")
# endif(CMAKE_CL_64)
# endif (NOT MSVC)
# endif (NOT CMAKE_INSTALL_PREFIX)
# install(TARGETS mged DESTINATION ${gen_exp}${BIN_DIR})
#
# Another (maybe better) option instead of generators might be to use the CONFIGURATIONS
# option in our macros and the ExternalProject_Add management:
# https://cmake.org/cmake/help/latest/command/install.html
#
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
if(NOT CMAKE_CONFIGURATION_TYPES)
if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
set(CMAKE_INSTALL_PREFIX "/usr/brlcad/rel-${BRLCAD_VERSION}")
else("${CMAKE_BUILD_TYPE}" MATCHES "Release")
set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
endif("${CMAKE_BUILD_TYPE}" MATCHES "Release")
else(NOT CMAKE_CONFIGURATION_TYPES)
if(MSVC)
if(CMAKE_CL_64)
set(CMAKE_INSTALL_PREFIX "C:/Program Files/BRL-CAD ${BRLCAD_VERSION}")
else(CMAKE_CL_64)
set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD ${BRLCAD_VERSION}")
endif(CMAKE_CL_64)
else(MSVC)
set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
endif(MSVC)
endif(NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "BRL-CAD install prefix" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
set(BRLCAD_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "BRL-CAD install prefix")
mark_as_advanced(BRLCAD_PREFIX)
# If we've a Release build with a Debug path or vice versa, warn about
# it. A "make install" of a Release build into a dev install
# directory or vice versa is going to result in an install that
# doesn't respect BRL-CAD standard naming conventions.
if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set to /usr/brlcad/dev-${BRLCAD_VERSION}, but build type is set to Release!\n")
endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set to /usr/brlcad/rel-${BRLCAD_VERSION}, but build type is set to Debug!\n")
endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
#------------------------------------------------------------------------------
# If CMAKE_INSTALL_PREFIX is "/usr", be VERY noisy about it - a make install in
# this location is dangerous/destructive on some systems.
find_program(SLEEP_EXEC sleep)
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT BRLCAD_ALLOW_INSTALL_TO_USR)
message(WARNING "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\nIt is STRONGLY recommended that you DO NOT install BRL-CAD into /usr as BRL-CAD provides several libraries that may conflict with other libraries (e.g. librt, libbu, libbn) on certain system configurations.\nSince our libraries predate all those that we're known to conflict with and are at the very core of our geometry services and project heritage, we have no plans to change the names of our libraries at this time.\nINSTALLING INTO /usr CAN MAKE A SYSTEM COMPLETELY UNUSABLE. If you choose to continue installing into /usr, you do so entirely at your own risk. You have been warned.\n}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}")
if(SLEEP_EXEC)
execute_process(COMMAND ${SLEEP_EXEC} 15)
endif(SLEEP_EXEC)
message(FATAL_ERROR "If you wish to proceed using /usr as your prefix, define BRLCAD_ALLOW_INSTALL_TO_USR=1 for CMake")
endif("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT BRLCAD_ALLOW_INSTALL_TO_USR)
#------------------------------------------------------------------------------
# Now that we know the install prefix, generate the binary for calculating
# and reporting time deltas
generate_dreport()
+3
View File
@@ -32,6 +32,9 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# We will need to define a number of dependent options early on
include(CMakeDependentOption)
#-----------------------------------------------------------------------------
# For "top-level" BRL-CAD options, some extra work is in order - descriptions and
# lists of aliases are supplied, and those are automatically addressed by this
+9 -8
View File
@@ -33,6 +33,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
#
# This file contains the CMake routines that summarize the results
# of the BRL-CAD configure process.
@@ -252,6 +253,7 @@ function(BRLCAD_Summary)
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")
@@ -276,8 +278,7 @@ function(BRLCAD_Summary)
# Make sets to use for iteration over all report items
set(BUILD_REPORT_ITEMS
TCL TK INCRTCL IWIDGETS TKHTML TKTABLE PNG REGEX ZLIB
UTAHRLE OPENNURBS SC)
TCL TK INCRTCL IWIDGETS PNG REGEX ZLIB SC)
set(FEATURE_REPORT_ITEMS
BRLCAD_ENABLE_OPENGL
@@ -359,18 +360,18 @@ function(BRLCAD_Summary)
# 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)
get_directory_property(BRLCAD_${ITEM}_BUILD DIRECTORY src/superbuild DEFINITION BRLCAD_${ITEM}_BUILD)
get_directory_property(BRLCAD_${ITEM}_NOTFOUND DIRECTORY src/superbuild 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})
# 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)
get_directory_property(BRLCAD_ITCL_BUILD DIRECTORY src/superbuild DEFINITION BRLCAD_ITCL_BUILD)
get_directory_property(BRLCAD_ITK_BUILD DIRECTORY src/superbuild DEFINITION BRLCAD_ITK_BUILD)
get_directory_property(BRLCAD_ITCL_NOTFOUND DIRECTORY src/superbuild DEFINITION BRLCAD_ITCL_NOTFOUND)
get_directory_property(BRLCAD_ITK_NOTFOUND DIRECTORY src/superbuild 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)
+26 -15
View File
@@ -448,6 +448,20 @@ function(BRLCAD_ADDLIB libname srcslist libslist)
set_property(TARGET ${libname}-obj APPEND PROPERTY COMPILE_DEFINITIONS "${UPPER_CORE}_DLL_EXPORTS")
endif(HIDE_INTERNAL_SYMBOLS)
# If the library depends on other targets in this build, not just system
# libraries, make sure the object targets depends them as well. In
# principle this isn't always required - object compilation may be
# independent of the dependencies needed at link time - but if compilation
# DOES depends on those targets having first performed some action (like
# staging a header in an expected location) NOT setting this dependency
# explicitly will eventually cause build failures.
#
# Without setting the OBJECT dependencies, success in the above case would
# depend on whether or not the high level build ordering happened to run
# the required targets before performing this step. That failure mode is
# semi-random and intermittent (top level build ordering without explicit
# dependencies varies depending on -j flag values) making it hard to debug.
# Ask me how I know.
if(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
foreach(ll ${libslist})
if (TARGET ${ll})
@@ -655,24 +669,21 @@ function(BRLCAD_INCLUDE_DIRS DIR_LIST)
if (NOT IS_LOCAL)
IS_SUBPATH("${BRLCAD_BINARY_DIR}" "${abs_inc_dir}" IS_LOCAL)
endif (NOT IS_LOCAL)
if("${inc_dir}" MATCHES "other" OR NOT IS_LOCAL)
# Unfortunately, a bug in the CMake SYSTEM option to
# include_directories requires that these variables
# be explicitly set on OSX until we can require CMake
# version 3.6 - see
# https://public.kitware.com/Bug/view.php?id=15953
if(APPLE)
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
endif(APPLE)
if("${inc_dir}" MATCHES "other")
set(IS_SYSPATH 0)
foreach(sp ${SYS_INCLUDE_PATTERNS})
if("${inc_dir}" MATCHES "${sp}")
set(IS_SYSPATH 1)
endif("${inc_dir}" MATCHES "${sp}")
endforeach(sp ${SYS_INCLUDE_PATTERNS})
if(IS_SYSPATH OR NOT IS_LOCAL)
if(IS_SYSPATH)
include_directories(SYSTEM ${inc_dir})
else("${inc_dir}" MATCHES "other")
else(IS_SYSPATH)
include_directories(AFTER SYSTEM ${inc_dir})
endif("${inc_dir}" MATCHES "other")
else("${inc_dir}" MATCHES "other" OR NOT IS_LOCAL)
endif(IS_SYSPATH)
else(IS_SYSPATH OR NOT IS_LOCAL)
include_directories(BEFORE ${inc_dir})
endif("${inc_dir}" MATCHES "other" OR NOT IS_LOCAL)
endif(IS_SYSPATH OR NOT IS_LOCAL)
endforeach(inc_dir ${ALL_INCLUDES})
endfunction(BRLCAD_INCLUDE_DIRS DIR_LIST)
+193
View File
@@ -0,0 +1,193 @@
# "make check" runs all of the tests (unit, benchmark, and regression) that are expected to work.
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
math(EXPR NC "${N} / 2")
if(${NC} GREATER 1)
set(JFLAG "-j${NC}")
else(${NC} GREATER 1)
set(JFLAG)
endif(${NC} GREATER 1)
else(NOT N EQUAL 0)
# Huh? No j flag if we can't get a processor count
set(JFLAG)
endif(NOT N EQUAL 0)
if(CMAKE_CONFIGURATION_TYPES)
set(CONFIG $<CONFIG>)
else(CMAKE_CONFIGURATION_TYPES)
if ("${CONFIG}" STREQUAL "")
set(CONFIG "\"\"")
endif ("${CONFIG}" STREQUAL "")
endif(CMAKE_CONFIGURATION_TYPES)
add_custom_target(check
COMMAND ${CMAKE_COMMAND} -E echo "\"**********************************************************************\""
COMMAND ${CMAKE_COMMAND} -E echo "NOTE: The \\\"check\\\" a.k.a. \\\"BRL-CAD Validation Testing\\\" target runs"
COMMAND ${CMAKE_COMMAND} -E echo " BRL-CAD\\'s unit, system, integration, benchmark \\(performance\\), and"
COMMAND ${CMAKE_COMMAND} -E echo " regression tests. To consider a build viable for production use,"
COMMAND ${CMAKE_COMMAND} -E echo " these tests must pass. Dependencies are compiled automatically."
COMMAND ${CMAKE_COMMAND} -E echo "\"**********************************************************************\""
COMMAND ${CMAKE_CTEST_COMMAND} -C ${CONFIG} -LE \"Regression|NOT_WORKING\" -E \"^regress-|NOTE|benchmark|slow-\" --output-on-failure ${JFLAG}
COMMAND ${CMAKE_CTEST_COMMAND} -C ${CONFIG} -R \"benchmark\" --output-on-failure ${JFLAG}
COMMAND ${CMAKE_CTEST_COMMAND} -C ${CONFIG} -L \"Regression\" --output-on-failure ${JFLAG}
)
set_target_properties(check PROPERTIES FOLDER "BRL-CAD Validation Testing")
# To support "make unit" (which will build the required targets for testing
# in the style of GNU Autotools "make check") we define a "unit" target per
# http://www.cmake.org/Wiki/CMakeEmulateMakeCheck and have add_test
# automatically assemble its targets into the unit dependency list.
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
math(EXPR NC "${N} / 2")
if(${NC} GREATER 1)
set(JFLAG "-j${NC}")
else(${NC} GREATER 1)
set(JFLAG)
endif(${NC} GREATER 1)
else(NOT N EQUAL 0)
# Huh? No j flag if we can't get a processor count
set(JFLAG)
endif(NOT N EQUAL 0)
if(CMAKE_CONFIGURATION_TYPES)
set(CONFIG $<CONFIG>)
else(CMAKE_CONFIGURATION_TYPES)
if ("${CONFIG}" STREQUAL "")
set(CONFIG "\"\"")
endif ("${CONFIG}" STREQUAL "")
endif(CMAKE_CONFIGURATION_TYPES)
add_custom_target(unit
COMMAND ${CMAKE_COMMAND} -E echo "\"**********************************************************************\""
COMMAND ${CMAKE_COMMAND} -E echo "NOTE: The \\\"unit\\\" a.k.a. \\\"BRL-CAD Unit Testing\\\" target runs the"
COMMAND ${CMAKE_COMMAND} -E echo " subset of BRL-CAD\\'s API unit tests that are expected to work \\(i.e.,"
COMMAND ${CMAKE_COMMAND} -E echo " tests not currently under development\\). All dependencies required"
COMMAND ${CMAKE_COMMAND} -E echo " by the tests are compiled automatically."
COMMAND ${CMAKE_COMMAND} -E echo "\"**********************************************************************\""
COMMAND ${CMAKE_CTEST_COMMAND} -C ${CONFIG} -LE \"Regression|NOT_WORKING\" -E \"^regress-|NOTE|benchmark|slow-\" ${JFLAG}
)
set_target_properties(unit PROPERTIES FOLDER "BRL-CAD Validation Testing")
# we wrap the CMake add_test() function in order to automatically
# set up test dependencies for the 'unit' and 'check' test targets.
#
# this function extravagantly tries to work around a bug in CMake
# where we cannot pass an empty string through this wrapper to
# _add_test()/add_test(). passed as a list (e.g., via ARGN, ARGV,
# or manually composed), the empty string is skipped(!). passed as
# a string, it is all treated as command name with no arguments.
#
# manual workaround used here involves invoking _add_test() with all
# args individually recreated/specified (i.e., not as a list) as
# this preserves empty strings. this approach means we cannot
# generalize and only support a limited variety of empty string
# arguments, but we do test and halt if someone unknowingly tries.
function(add_test NAME test_name COMMAND test_prog)
# find any occurrences of empty strings
set(idx 0)
set(matches)
foreach (ARG IN LISTS ARGV)
# need 'x' to avoid older cmake seeing "COMMAND" "STREQUAL" ""
if ("x${ARG}" STREQUAL "x")
list(APPEND matches ${idx})
endif ("x${ARG}" STREQUAL "x")
math(EXPR idx "${idx} + 1")
endforeach()
# make sure we don't exceed current support
list(LENGTH matches cnt)
if ("${cnt}" GREATER 1)
message(FATAL_ERROR "ERROR: encountered ${cnt} > 1 empty string being passed to add_test(${test_name}). Expand support in the top-level CMakeLists.txt file (grep add_test) or pass fewer empty strings.")
endif ("${cnt}" GREATER 1)
# if there are empty strings, we need to manually recreate their calling
if ("${cnt}" GREATER 0)
list(GET matches 0 empty)
if ("${empty}" EQUAL 4)
foreach (i 1)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} "" ${ARGN})
elseif ("${empty}" EQUAL 5)
foreach (i 1 2)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGV4} "" ${ARGN})
elseif ("${empty}" EQUAL 6)
foreach (i 1 2 3)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGV4} ${ARGV5} "" ${ARGN})
elseif ("${empty}" EQUAL 7)
foreach (i 1 2 3 4)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGV4} ${ARGV5} ${ARGV6} "" ${ARGN})
elseif ("${empty}" EQUAL 8)
foreach (i 1 2 3 4 5)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGV4} ${ARGV5} ${ARGV6} ${ARGV7} "" ${ARGN})
elseif ("${empty}" EQUAL 9)
foreach (i 1 2 3 4 5 6)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGV4} ${ARGV5} ${ARGV6} ${ARGV7} ${ARGV8} "" ${ARGN})
elseif ("${empty}" EQUAL 10)
foreach (i 1 2 3 4 5 6)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGV4} ${ARGV5} ${ARGV6} ${ARGV7} ${ARGV8} ${ARGV9} "" ${ARGN})
elseif ("${empty}" EQUAL 11)
foreach (i 1 2 3 4 5 6)
if (ARGN)
list(REMOVE_AT ARGN 0)
endif (ARGN)
endforeach ()
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGV4} ${ARGV5} ${ARGV6} ${ARGV7} ${ARGV8} ${ARGV9} ${ARGV10} "" ${ARGN})
# ADD_EMPTY_HERE: insert support for addition argv positions
# as extra elseif tests here using the preceding pattern. be
# sure to update the index in the following else clause fatal
# error message too.
else ("${empty}" EQUAL 4)
message(FATAL_ERROR "ERROR: encountered an empty string passed to add_test(${test_name}) as ARGV${empty} > ARGV9. Expand support in the top-level CMakeLists.txt file (grep ADD_EMPTY_HERE).")
endif ("${empty}" EQUAL 4)
else ("${cnt}" GREATER 0)
# no empty strings, no worries
_add_test(NAME ${test_name} COMMAND ${test_prog} ${ARGN})
endif ("${cnt}" GREATER 0)
# add test to unit and check targets
if (NOT "${test_name}" MATCHES ^regress- AND NOT "${test_prog}" MATCHES ^regress- AND NOT "${test_name}" MATCHES ^slow- AND NOT "${test_name}" STREQUAL "benchmark" AND NOT "${test_name}" MATCHES ^NOTE:)
add_dependencies(unit ${test_prog})
add_dependencies(check ${test_prog})
endif (NOT "${test_name}" MATCHES ^regress- AND NOT "${test_prog}" MATCHES ^regress- AND NOT "${test_name}" MATCHES ^slow- AND NOT "${test_name}" STREQUAL "benchmark" AND NOT "${test_name}" MATCHES ^NOTE:)
endfunction(add_test NAME test_name COMMAND test_prog)
+453
View File
@@ -0,0 +1,453 @@
# Build shared libs by default. Mark this as advanced - turning off
# ALL shared library building is unlikely to result in a working build
# and is not a typical configuration. Note that turning this option off
# will not disable libraries specifically added as SHARED.
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
mark_as_advanced(BUILD_SHARED_LIBS)
# Build static libs by default unless we're debugging. Note: this
# option will not disable libraries specifically added as STATIC even
# when OFF. For multi-configuration options the build type determination
# is made at build time, so just default to "ON".
cmake_dependent_option(BUILD_STATIC_LIBS "Build static libraries" ON "CMAKE_CONFIGURATION_TYPES OR NOT \"${CMAKE_BUILD_TYPE}\" STREQUAL Debug" OFF)
# Turn off the brlcad.dll build.
# It's an expert's setting at the moment.
option(BRLCAD_ENABLE_BRLCAD_LIBRARY "Build the brlcad.dll" OFF)
mark_as_advanced(BRLCAD_ENABLE_BRLCAD_LIBRARY)
# Global third party controls - these options enable and disable ALL
# local copies of libraries in src/other. Forcing all local
# libraries off is not usually recommended unless attempting to
# build packages for a distribution. If both of these options are
# on the enabling of local packages is the "senior" option and will
# force the system libs option to off.
set(BRLCAD_BUNDLED_LIBS_DESCRIPTION "
Enables compilation of all 3rd party sources that are provided within a BRL-CAD
source distribution. If used this option sets all other 3rd party library
build flags to ON by default. However, that setting can be overridden by
manually setting individual variables. Default is \"AUTO\" - 3rd party sources
are compiled only if they are not detected as being available and functioning
as expected.
")
if(MSVC)
set(BRLCAD_BUNDLED_LIBS_DEFAULT "BUNDLED")
else(MSVC)
set(BRLCAD_BUNDLED_LIBS_DEFAULT "AUTO")
endif(MSVC)
BRLCAD_OPTION(BRLCAD_BUNDLED_LIBS ${BRLCAD_BUNDLED_LIBS_DEFAULT}
TYPE ABS
ALIASES ENABLE_ALL
DESCRIPTION BRLCAD_BUNDLED_LIBS_DESCRIPTION)
if(NOT BRLCAD_BUNDLED_LIBS MATCHES "AUTO" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "BUNDLED" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "SYSTEM")
message(WARNING "Unknown value BRLCAD_BUNDLED_LIBS supplied for BRLCAD_BUNDLED_LIBS (${BRLCAD_BUNDLED_LIBS}) - defaulting to AUTO")
message(WARNING "Valid options are AUTO, BUNDLED and SYSTEM")
set(BRLCAD_BUNDLED_LIBS "AUTO" CACHE STRING "Build bundled libraries." FORCE)
endif(NOT BRLCAD_BUNDLED_LIBS MATCHES "AUTO" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "BUNDLED" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "SYSTEM")
# Enable Aqua widgets on Mac OSX. This impacts Tcl/Tk building and OpenGL
# building. Not currently working - needs work in at least Tk
# CMake logic (probably more), and the display manager/framebuffer codes are known to depend
# on either GLX or WGL specifically in their current forms.
option(BRLCAD_ENABLE_AQUA "Use Aqua instead of X11 whenever possible on OSX." OFF)
mark_as_advanced(BRLCAD_ENABLE_AQUA)
# Single flag for disabling GUI instead of 5.
option(BRLCAD_ENABLE_MINIMAL "Skip GUI support and docs. Faster builds." OFF)
mark_as_advanced(BRLCAD_ENABLE_MINIMAL)
if(BRLCAD_ENABLE_MINIMAL)
set(BRLCAD_ENABLE_OPENGL "OFF")
set(BRLCAD_ENABLE_X11 "OFF")
set(BRLCAD_ENABLE_TK "OFF")
set(BRLCAD_ENABLE_QT "OFF")
set(BRLCAD_ENABLE_AQUA "OFF")
set(BRLCAD_EXTRADOCS "OFF")
endif(BRLCAD_ENABLE_MINIMAL)
# Install example BRL-CAD Geometry Files
option(BRLCAD_INSTALL_EXAMPLE_GEOMETRY "Install the example BRL-CAD geometry files." ON)
# test for X11 on all platforms since we don't know when/where we'll find it, unless
# we've indicated we *don't* want an X11 build
if(NOT BRLCAD_ENABLE_AQUA AND NOT BRLCAD_ENABLE_MINIMAL)
find_package(X11)
endif(NOT BRLCAD_ENABLE_AQUA AND NOT BRLCAD_ENABLE_MINIMAL)
# make sure Xi is included in the list of X11 libs
# (Xext is automatically added during FindX11)
if(X11_Xi_FOUND)
set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xi_LIB})
endif(X11_Xi_FOUND)
# Set whether X11 is enabled or disabled by default
if(WIN32)
# even if there is x11, we default to native
option(BRLCAD_ENABLE_X11 "Use X11." OFF)
elseif(BRLCAD_ENABLE_AQUA)
# aqua implies no X11
option(BRLCAD_ENABLE_X11 "Use X11." OFF)
else(WIN32)
# make everywhere else depend on whether we found a suitable X11
# X11_Xext_LIB AND X11_Xi_LIB AND
if(X11_FOUND AND NOT BRLCAD_ENABLE_MINIMAL)
option(BRLCAD_ENABLE_X11 "Use X11." ON)
else(X11_FOUND AND NOT BRLCAD_ENABLE_MINIMAL)
option(BRLCAD_ENABLE_X11 "Use X11." OFF)
endif(X11_FOUND AND NOT BRLCAD_ENABLE_MINIMAL)
endif(WIN32)
mark_as_advanced(BRLCAD_ENABLE_X11)
# if X11 is enabled, make sure aqua is off
if(BRLCAD_ENABLE_X11)
set(BRLCAD_ENABLE_AQUA OFF CACHE STRING "Don't use Aqua if we're doing X11" FORCE)
set(OPENGL_USE_AQUA OFF CACHE STRING "Don't use Aqua if we're doing X11" FORCE)
endif(BRLCAD_ENABLE_X11)
mark_as_advanced(OPENGL_USE_AQUA)
# Enable/disable features requiring the Tcl/Tk toolkit - usually this should
# be on, as a lot of functionality in BRL-CAD depends on Tcl/Tk
option(BRLCAD_ENABLE_TCL "Enable features requiring the Tcl toolkit" ON)
cmake_dependent_option(BRLCAD_ENABLE_TK "Enable features requiring the Tk toolkit" ON "BRLCAD_ENABLE_TCL" OFF)
mark_as_advanced(BRLCAD_ENABLE_TCL BRLCAD_ENABLE_TK)
if(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32)
set(BRLCAD_ENABLE_TK OFF)
endif(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32)
if(BRLCAD_ENABLE_X11)
set(TK_X11_GRAPHICS ON CACHE STRING "Need X11 Tk" FORCE)
endif(BRLCAD_ENABLE_X11)
# Enable features requiring OPENGL
# Be smart about this - if we don't have X11 or Aqua and we're
# not on Windows, we're non-graphical and that means OpenGL is
# a no-go. The Windows version would have to be some sort of
# option for the WIN32 graphics layer? Should probably think
# about that... for now, on Win32 don't try OpenGL if Tk is
# off. That'll hold until we get a non-Tk based GUI - then
# setting non-graphical on Windows will take more thought.
if(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32)
set(OPENGL_FOUND OFF)
set(BRLCAD_ENABLE_OPENGL OFF CACHE BOOL "Disabled - NOT BRLCAD_ENABLE_X11 and NOT BRLCAD_ENABLE_AQUA" FORCE)
else(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32)
include(FindGL)
endif(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32)
set(BRLCAD_ENABLE_OPENGL_DESCRIPTION "
Enable support for OpenGL based Display Managers in BRL-CAD.
Default depends on whether OpenGL is successfully detected -
if it is, default is to enable.
")
BRLCAD_OPTION(BRLCAD_ENABLE_OPENGL ${OPENGL_FOUND}
TYPE BOOL
ALIASES ENABLE_OPENGL
DESCRIPTION BRLCAD_ENABLE_OPENGL_DESCRIPTION)
# Enable RTGL. Requires an enabled OpenGL.
option(BRLCAD_ENABLE_RTGL "Enable experimental RTGL code." OFF)
mark_as_advanced(BRLCAD_ENABLE_RTGL)
if(NOT BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_RTGL)
message("RTGL requested, but OpenGL is not enabled - disabling")
set(BRLCAD_ENABLE_RTGL OFF CACHE BOOL "Enable experimental RTGL code." FORCE)
endif(NOT BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_RTGL)
if(NOT BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_RTGL)
message("RTGL currently works only with GLX, and X11 is not enabled - disabling")
set(BRLCAD_ENABLE_RTGL OFF CACHE BOOL "Enable experimental RTGL code." FORCE)
endif(NOT BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_RTGL)
if(BRLCAD_ENABLE_AQUA)
set(OPENGL_USE_AQUA ON CACHE STRING "Aqua enabled - use Aqua OpenGL" FORCE)
endif(BRLCAD_ENABLE_AQUA)
# Enable features requiring Bullet Physics SDK
option(BRLCAD_ENABLE_BULLET "Enable features requiring the Bullet Physics Library" OFF)
if(BRLCAD_ENABLE_BULLET)
message("Bullet support is not currently working - disabling.")
set(BRLCAD_ENABLE_BULLET OFF CACHE BOOL "Currently broken" FORCE)
endif(BRLCAD_ENABLE_BULLET)
mark_as_advanced(BRLCAD_ENABLE_BULLET)
# Enable features requiring STEPcode library
option(BRLCAD_ENABLE_STEP "Enable features requiring the STEP support libraries" ON)
mark_as_advanced(BRLCAD_ENABLE_STEP)
# Enable features requiring GDAL geospatial library
option(BRLCAD_ENABLE_GDAL "Enable features requiring the Geospatial Data Abstraction Library" ON)
mark_as_advanced(BRLCAD_ENABLE_GDAL)
# Enable features requiring Qt
# TODO - try COMPONENTS search: https://blog.kitware.com/cmake-finding-qt5-the-right-way/
find_package(Qt5Widgets QUIET)
option(BRLCAD_ENABLE_QT "Enable features requiring Qt" OFF)
mark_as_advanced(BRLCAD_ENABLE_QT)
mark_as_advanced(Qt5Core_DIR)
mark_as_advanced(Qt5Gui_DIR)
if(NOT Qt5Widgets_FOUND AND BRLCAD_ENABLE_QT)
message("QT interface requested, but QT5 is not found - disabling")
set(BRLCAD_ENABLE_QT OFF)
endif(NOT Qt5Widgets_FOUND AND BRLCAD_ENABLE_QT)
mark_as_advanced(Qt5Widgets_DIR)
# Enable features requiring OpenSceneGraph
option(BRLCAD_ENABLE_OSG "Enable features requiring OpenSceneGraph" OFF)
mark_as_advanced(BRLCAD_ENABLE_OSG)
if(BRLCAD_ENABLE_OSG)
if(APPLE AND NOT BRLCAD_ENABLE_AQUA)
set(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Use X11" FORCE)
endif(APPLE AND NOT BRLCAD_ENABLE_AQUA)
endif(BRLCAD_ENABLE_OSG)
# Enable features requiring GCT
option(BRLCAD_ENABLE_GCT "Enable features requiring GCT" ON)
mark_as_advanced(BRLCAD_ENABLE_GCT)
# Enable features requiring OpenCL
option(BRLCAD_ENABLE_OPENCL "Enable features requiring OpenCL" OFF)
mark_as_advanced(BRLCAD_ENABLE_OPENCL)
if(BRLCAD_ENABLE_OPENCL)
find_package(OpenCL)
if(NOT OPENCL_FOUND)
message("OpenCL enablement requested, but OpenCL is not found - disabling")
set(BRLCAD_ENABLE_OPENCL OFF)
endif(NOT OPENCL_FOUND)
endif(BRLCAD_ENABLE_OPENCL)
# Enable features requiring OpenVDB
option(BRLCAD_ENABLE_OPENVDB "Enable features requiring OpenVDB" OFF)
mark_as_advanced(BRLCAD_ENABLE_OPENVDB)
if(BRLCAD_ENABLE_OPENVDB)
find_package(OpenVDB)
if(NOT OpenVDB_FOUND)
message("OpenVDB enablement requested, but OpenVDB is not found - disabling")
set(BRLCAD_ENABLE_OPENVDB OFF)
endif(NOT OpenVDB_FOUND)
endif(BRLCAD_ENABLE_OPENVDB)
# Enable experimental support for binary attributes
option(BRLCAD_ENABLE_BINARY_ATTRIBUTES "Enable support for binary attributes" OFF)
mark_as_advanced(BRLCAD_ENABLE_BINARY_ATTRIBUTES)
#----------------------------------------------------------------------
# The following are fine-grained options for enabling/disabling compiler
# and source code definition settings. Typically these are set to
# various configurations by the toplevel CMAKE_BUILD_TYPE setting, but
# can also be individually set.
# Enable/disable runtime debugging - these are protections for
# minimizing the possibility of corrupted data files. Generally
# speaking these should be left on.
set(BRLCAD_ENABLE_RUNTIME_DEBUG_ALIASES
ENABLE_RUNTIME_DEBUG
ENABLE_RUN_TIME_DEBUG
ENABLE_RUNTIME_DEBUGGING
ENABLE_RUN_TIME_DEBUGGING)
set(BRLCAD_ENABLE_RUNTIME_DEBUG_DESCRIPTION "
Enables support for application and library debugging facilities.
Disabling the run-time debugging facilities can provide a significant
(10%-30%) performance boost at the expense of extensive error
checking (that in turn help prevent corruption of your data).
Default is \"ON\", and should only be disabled for read-only render
work where performance is critical.
")
BRLCAD_OPTION(BRLCAD_ENABLE_RUNTIME_DEBUG ON
TYPE BOOL
ALIASES ${BRLCAD_ENABLE_RUNTIME_DEBUG_ALIASES}
DESCRIPTION BRLCAD_ENABLE_RUNTIME_DEBUG_DESCRIPTION)
mark_as_advanced(BRLCAD_ENABLE_RUNTIME_DEBUG)
# Enable debug flags during compilation - we always want to use these
# unless explicitly told not to.
set(BRLCAD_FLAGS_DEBUG_DESCRIPTION "
Add compiler flags to aid in program debugging. Defaults to ON.
")
BRLCAD_OPTION(BRLCAD_FLAGS_DEBUG ON
TYPE BOOL
ALIASES ENABLE_DEBUG ENABLE_FLAGS_DEBUG ENABLE_DEBUG_FLAGS
DESCRIPTION BRLCAD_FLAGS_DEBUG_DESCRIPTION)
# Build with compiler warning flags
set(BRLCAD_ENABLE_COMPILER_WARNINGS_DESCRIPTION "
Use extra compiler warning flags when compiling C/C++ code. Defaults to ON.
")
BRLCAD_OPTION(BRLCAD_ENABLE_COMPILER_WARNINGS ON
TYPE BOOL
ALIASES ENABLE_WARNINGS ENABLE_COMPILER_WARNINGS
DESCRIPTION BRLCAD_ENABLE_COMPILER_WARNINGS_DESCRIPTION)
mark_as_advanced(BRLCAD_ENABLE_COMPILER_WARNINGS)
# Enable/disable strict compiler settings - these are used for building
# BRL-CAD by default, but not src/other code. Always used for BRL-CAD
# code unless the NO_STRICT option is specified when defining a target
# with BRLCAD_ADDEXEC or BRLCAD_ADDLIB. If only C++ files in a target
# are not compatible with strict, the NO_STRICT_CXX option can be used.
set(BRLCAD_ENABLE_STRICT_DESCRIPTION "
Causes all compilation warnings for C code to be treated as errors. This is now
the default for BRL-CAD source code, and developers should address issues
discovered by these flags whenever possible rather than disabling strict
mode.
")
BRLCAD_OPTION(BRLCAD_ENABLE_STRICT ON
TYPE BOOL
ALIASES ENABLE_STRICT ENABLE_STRICT_COMPILE ENABLE_STRICT_COMPILE_FLAGS
DESCRIPTION BRLCAD_ENABLE_STRICT_DESCRIPTION)
if(BRLCAD_ENABLE_STRICT)
mark_as_advanced(BRLCAD_ENABLE_STRICT)
endif(BRLCAD_ENABLE_STRICT)
# Build with compiler optimization flags. This should normally be on for
# release builds and off otherwise, unless the user specifically enables it.
# For multi-config build tools, this is managed on a per-configuration basis.
if(CMAKE_BUILD_TYPE)
cmake_dependent_option(BRLCAD_OPTIMIZED_BUILD "Enable optimized build flags" ON "${CMAKE_BUILD_TYPE} STREQUAL Release" OFF)
else(CMAKE_BUILD_TYPE)
# Note: the cmake_dependent_option test doesn't work if CMAKE_BUILD_TYPE isn't set.
option(BRLCAD_OPTIMIZED_BUILD "Enable optimized build flags" OFF)
endif(CMAKE_BUILD_TYPE)
mark_as_advanced(BRLCAD_OPTIMIZED_BUILD)
# Build with full compiler lines visible by default (won't need make
# VERBOSE=1) on command line
option(BRLCAD_ENABLE_VERBOSE_PROGRESS "verbose output" OFF)
mark_as_advanced(BRLCAD_ENABLE_VERBOSE_PROGRESS)
if(BRLCAD_ENABLE_VERBOSE_PROGRESS)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif(BRLCAD_ENABLE_VERBOSE_PROGRESS)
# Build with profile-guided optimization support. this requires a
# two-pass compile, once with BRLCAD_PGO=ON on a location that did not
# exist beforehand (specified via the PGO_PATH environment variable),
# and again to use profiling metrics captured on "typical" operations
# and data. By default, path is BUILDDIR/profiling
option(BRLCAD_PGO "Enable profile-guided optimization (set PGO_PATH environment variable)")
mark_as_advanced(BRLCAD_PGO)
#====== ALL CXX COMPILE ===================
# Build all C and C++ files with a C++ compiler
set(ENABLE_ALL_CXX_COMPILE_DESCRIPTION "
Build all C and C++ files with a C++ compiler. Defaults to OFF.
EXPERIMENTAL!
")
BRLCAD_OPTION(ENABLE_ALL_CXX_COMPILE OFF
TYPE BOOL
ALIASES ENABLE_ALL_CXX
DESCRIPTION ENABLE_ALL_CXX_COMPILE_DESCRIPTION)
mark_as_advanced(ENABLE_ALL_CXX_COMPILE)
# Build with coverage enabled
option(BRLCAD_ENABLE_COVERAGE "Build with coverage enabled" OFF)
mark_as_advanced(BRLCAD_ENABLE_COVERAGE)
# Build with dtrace support
option(BRLCAD_ENABLE_DTRACE "Build with dtrace support" OFF)
mark_as_advanced(BRLCAD_ENABLE_DTRACE)
if(BRLCAD_ENABLE_DTRACE)
BRLCAD_INCLUDE_FILE(sys/sdt.h HAVE_SYS_SDT_H)
if(NOT HAVE_SYS_SDT_H)
set(BRLCAD_ENABLE_DTRACE OFF)
endif(NOT HAVE_SYS_SDT_H)
endif(BRLCAD_ENABLE_DTRACE)
# Take advantage of parallel processors if available - highly recommended
option(BRLCAD_ENABLE_SMP "Enable SMP architecture parallel computation support" ON)
mark_as_advanced(BRLCAD_ENABLE_SMP)
#----------------------------------------------------------------------
# There are extra documentation files available requiring DocBook
# They are quite useful in graphical interfaces, but also add considerably
# to the overall build time. If necessary BRL-CAD provides its own
# xsltproc (see src/other/xmltools), so the html and man page
# outputs are always potentially available. PDF output, on the other hand,
# needs Apache FOP. FOP is not a candidate for bundling with BRL-CAD for
# a number of reasons, so we simply check to see if it is present and set
# the options accordingly.
# Do we have the environment variable set locally?
if(NOT "$ENV{APACHE_FOP}" STREQUAL "")
set(APACHE_FOP "$ENV{APACHE_FOP}")
endif(NOT "$ENV{APACHE_FOP}" STREQUAL "")
if(NOT APACHE_FOP)
find_program(APACHE_FOP fop DOC "path to the exec script for Apache FOP")
endif(NOT APACHE_FOP)
mark_as_advanced(APACHE_FOP)
# We care about the FOP version, unfortunately - find out what we have.
if(APACHE_FOP)
execute_process(COMMAND ${APACHE_FOP} -v OUTPUT_VARIABLE APACHE_FOP_INFO ERROR_QUIET)
string(REGEX REPLACE "FOP Version ([0-9\\.]*)" "\\1" APACHE_FOP_VERSION_REGEX "${APACHE_FOP_INFO}")
if(APACHE_FOP_VERSION_REGEX)
string(STRIP ${APACHE_FOP_VERSION_REGEX} APACHE_FOP_VERSION_REGEX)
endif(APACHE_FOP_VERSION_REGEX)
if(NOT "${APACHE_FOP_VERSION}" STREQUAL "${APACHE_FOP_VERSION_REGEX}")
message("-- Found Apache FOP: version ${APACHE_FOP_VERSION_REGEX}")
set(APACHE_FOP_VERSION ${APACHE_FOP_VERSION_REGEX} CACHE STRING "Apache FOP version" FORCE)
mark_as_advanced(APACHE_FOP_VERSION)
endif(NOT "${APACHE_FOP_VERSION}" STREQUAL "${APACHE_FOP_VERSION_REGEX}")
endif(APACHE_FOP)
# Toplevel variable that controls all DocBook based documentation. Key it off
# of what target level is enabled.
if(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2)
set(EXTRADOCS_DEFAULT "ON")
else(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2)
set(EXTRADOCS_DEFAULT "OFF")
endif(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2)
set(BRLCAD_EXTRADOCS_DESCRIPTION "
The core option that enables and disables building of BRL-CAD's
DocBook based documentation (includes manuals and man pages for
commands, among other things). Defaults to ON, but only HTML and MAN
formats are enabled by default - PDF must be enabled separately by use
of this option or one of its aliases. Note that you may set
environment variable APACHE_FOP to point to your locally installed fop
executable file (which on Linux is usually a shell script with 0755
permissions).
")
BRLCAD_OPTION(BRLCAD_EXTRADOCS ${EXTRADOCS_DEFAULT}
TYPE BOOL
ALIASES ENABLE_DOCS ENABLE_EXTRA_DOCS ENABLE_DOCBOOK
DESCRIPTION BRLCAD_EXTRADOCS_DESCRIPTION)
# The HTML output is used in the graphical help browsers in MGED and Archer,
# as well as being the most likely candidate for external viewers. Turn this
# on unless explicitly instructed otherwise by the user or all extra
# documentation is disabled.
CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_HTML "Build MAN page output from DocBook documentation" ON "BRLCAD_EXTRADOCS" OFF)
mark_as_advanced(BRLCAD_EXTRADOCS_HTML)
CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_PHP "Build MAN page output from DocBook documentation" OFF "BRLCAD_EXTRADOCS" OFF)
mark_as_advanced(BRLCAD_EXTRADOCS_PHP)
CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_PPT "Build MAN page output from DocBook documentation" ON "BRLCAD_EXTRADOCS" OFF)
mark_as_advanced(BRLCAD_EXTRADOCS_PPT)
# Normally, we'll turn on man page output by default, but there is
# no point in doing man page output for a Visual Studio build - the
# files aren't useful and it *seriously* increases the target build
# count/build time. Conditionalize on the CMake MSVC variable NOT
# being set.
CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_MAN "Build MAN page output from DocBook documentation" ON "BRLCAD_EXTRADOCS;NOT MSVC" OFF)
mark_as_advanced(BRLCAD_EXTRADOCS_MAN)
# Don't do PDF by default because it's pretty expensive, and hide the
# option unless the tools to do it are present.
set(BRLCAD_EXTRADOCS_PDF_DESCRIPTION "
Option that enables building of BRL-CAD's DocBook PDF-based documentation
(includes manuals and man pages for commands, among
other things.) Defaults to OFF.
Note that you may set environment variable APACHE_FOP
to point to your locally installed fop executable file (which on Linux is
usually a shell script with 0755 permissions).
")
CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_PDF "Build PDF output from DocBook documentation" OFF "BRLCAD_EXTRADOCS;APACHE_FOP" OFF)
# Provide an option to enable/disable XML validation as part
# of the DocBook build - sort of a "strict flags" mode for DocBook.
# By default, this will be enabled when extra docs are built and
# the toplevel BRLCAD_ENABLE_STRICT setting is enabled.
# Unfortunately, Visual Studio 2010 seems to have issues when we
# enable validation on top of everything else... not clear why,
# unless build target counts >1800 are beyond MSVC's practical
# limit. Until we either find a resolution or a way to reduce
# the target count on MSVC, disable validation there.
CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_VALIDATE "Perform validation for DocBook documentation" ON "BRLCAD_EXTRADOCS;BRLCAD_ENABLE_STRICT" OFF)
mark_as_advanced(BRLCAD_EXTRADOCS_VALIDATE)
+1 -1
View File
@@ -556,7 +556,7 @@ int main(int argc, const char **argv) {
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}")
COPY_FILE "${CMAKE_BINARY_DIR}/CMakeTmp/dreport${CMAKE_EXECUTABLE_SUFFIX}")
if(NOT dreport_build)
message(FATAL_ERROR "Could not build time delta reporting utility: ${FREPORT_BUILD_INFO}")
endif(NOT dreport_build)
-5
View File
@@ -35,11 +35,9 @@ set(cmake_ignore_files
FindOpenVDB.cmake
FindPERPLEX.cmake
FindPkgMacros.cmake
FindPROJ4.cmake
FindRE2C.cmake
FindREGEX.cmake
FindSCL.cmake
FindSSE.cmake
FindSTL.cmake
FindShellDeps.cmake
FindTBB.cmake
@@ -57,8 +55,6 @@ set(cmake_ignore_files
RPath_Setup.cmake
ResetCache.cmake
TCL_PKGINDEX.cmake
ThirdParty.cmake
ThirdParty_TCL.cmake
compat/README
compat/README.compat
compat/README.compat.c99
@@ -94,7 +90,6 @@ set(cmake_ignore_files
multiconfig_path_clean.cmake.in
multiconfig_path_read.cmake.in
source_archive_setup.cmake.in
tcltest.tcl.in
scripts/timestamp.cmake
scripts/printtime.cmake
)
+35 -5
View File
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
set(_LEMON_SEARCHES)
# Search LEMON_ROOT first if it is set.
if(LEMON_ROOT)
set(_LEMON_SEARCH_ROOT PATHS ${LEMON_ROOT} NO_DEFAULT_PATH)
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_ROOT)
endif()
# Normal search.
set(_LEMON_x86 "(x86)")
set(_LEMON_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/lemon"
"$ENV{ProgramFiles${_LEMON_x86}}/lemon")
unset(_LEMON_x86)
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_NORMAL)
set(LEMON_NAMES lemon)
# Try each search configuration.
foreach(search ${_LEMON_SEARCHES})
find_program(LEMON_EXECUTABLE lemon ${${search}} PATH_SUFFIXES bin)
endforeach()
mark_as_advanced(LEMON_EXECUTABLE)
foreach(search ${_LEMON_SEARCHES})
find_file(LEMON_TEMPLATE lempar.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/lemon)
endforeach()
mark_as_advanced(LEMON_TEMPLATE)
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
# look for the template in share
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
@@ -113,6 +139,10 @@ if(NOT COMMAND LEMON_TARGET)
CMAKE_PARSE_ARGUMENTS(${LVAR_PREFIX} "" "OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR;EXTRA_ARGS" "" ${ARGN})
endif(${ARGC} GREATER 3)
if (TARGET perplex_stage)
set(DEPS_TARGET perplex_stage)
endif (TARGET perplex_stage)
# Need a working directory
if("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
set(${LVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LVAR_PREFIX}")
@@ -160,8 +190,8 @@ if(NOT COMMAND LEMON_TARGET)
add_custom_command(
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
COMMAND ${CMAKE_COMMAND} -E copy ${lemon_in_file} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}
COMMAND ${LEMON_EXECUTABLE} -l -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
DEPENDS ${Input} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
DEPENDS ${Input} ${LEMON_EXECUTABLE_TARGET} ${DEPS_TARGET}
WORKING_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR}
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
)
@@ -171,7 +201,7 @@ if(NOT COMMAND LEMON_TARGET)
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${${LVAR_PREFIX}_OUT_SRC_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE} ${DEPS_TARGET}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_SRC_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
@@ -179,7 +209,7 @@ if(NOT COMMAND LEMON_TARGET)
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_HDR_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${${LVAR_PREFIX}_OUT_HDR_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER} ${DEPS_TARGET}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_HDR_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
+97 -54
View File
@@ -1,59 +1,102 @@
# F I N D N E T P B M . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# - Find netpbm library and headers
#
# The following variables are set:
#
# NETPBM_LIBRARIES - libnetpbm
# NETPBM_INCLUDE_DIRS - where to find ppm.h, pam.h, pbm.h, etc.
# NETPBM_FOUND - True if libnetpbm and header found.
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
find_path(NETPBM_INCLUDE_DIR pam.h)
find_library(NETPBM_LIBRARY NAMES netpbm)
#[=======================================================================[.rst:
FindNETPBM
--------
Find the native NETPBM includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``NETPBM::NETPBM``, if
NETPBM has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
NETPBM_INCLUDE_DIRS - where to find pam.h, etc.
NETPBM_LIBRARIES - List of libraries when using netpbm.
NETPBM_FOUND - True if netpbm found.
Hints
^^^^^
A user may set ``NETPBM_ROOT`` to a netpbm installation root to tell this
module where to look.
#]=======================================================================]
set(_NETPBM_SEARCHES)
# Search NETPBM_ROOT first if it is set.
if(NETPBM_ROOT)
set(_NETPBM_SEARCH_ROOT PATHS ${NETPBM_ROOT} NO_DEFAULT_PATH)
list(APPEND _NETPBM_SEARCHES _NETPBM_SEARCH_ROOT)
endif()
# Normal search.
set(_NETPBM_x86 "(x86)")
set(_NETPBM_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/netpbm"
"$ENV{ProgramFiles${_NETPBM_x86}}/netpbm")
unset(_NETPBM_x86)
list(APPEND _NETPBM_SEARCHES _NETPBM_SEARCH_NORMAL)
set(NETPBM_NAMES netpbm)
# Try each search configuration.
foreach(search ${_NETPBM_SEARCHES})
find_path(NETPBM_INCLUDE_DIR NAMES pam.h ${${search}} PATH_SUFFIXES include include/netpbm netpbm)
endforeach()
# Allow NETPBM_LIBRARY to be set manually, as the location of the netpbm library
if(NOT NETPBM_LIBRARY)
foreach(search ${_NETPBM_SEARCHES})
find_library(NETPBM_LIBRARY NAMES ${NETPBM_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
endforeach()
endif()
unset(NETPBM_NAMES)
mark_as_advanced(NETPBM_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETPBM DEFAULT_MSG NETPBM_LIBRARY NETPBM_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETPBM REQUIRED_VARS NETPBM_LIBRARY NETPBM_INCLUDE_DIR)
IF (NETPBM_FOUND)
set(NETPBM_INCLUDE_DIRS ${NETPBM_INCLUDE_DIR})
set(NETPBM_LIBRARIES ${NETPBM_LIBRARY})
if(NETPBM_FOUND)
set(NETPBM_INCLUDE_DIRS ${NETPBM_INCLUDE_DIR})
if(NOT NETPBM_LIBRARIES)
set(NETPBM_LIBRARIES ${NETPBM_LIBRARY})
endif()
if(NOT TARGET NETPBM::NETPBM)
add_library(NETPBM::NETPBM UNKNOWN IMPORTED)
set_target_properties(NETPBM::NETPBM PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${NETPBM_INCLUDE_DIRS}")
if(NETPBM_LIBRARY_RELEASE)
set_property(TARGET NETPBM::NETPBM APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(NETPBM::NETPBM PROPERTIES
IMPORTED_LOCATION_RELEASE "${NETPBM_LIBRARY_RELEASE}")
endif()
if(NETPBM_LIBRARY_DEBUG)
set_property(TARGET NETPBM::NETPBM APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(NETPBM::NETPBM PROPERTIES
IMPORTED_LOCATION_DEBUG "${NETPBM_LIBRARY_DEBUG}")
endif()
if(NOT NETPBM_LIBRARY_RELEASE AND NOT NETPBM_LIBRARY_DEBUG)
set_property(TARGET NETPBM::NETPBM APPEND PROPERTY
IMPORTED_LOCATION "${NETPBM_LIBRARY}")
endif()
endif()
endif()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+95 -56
View File
@@ -1,63 +1,102 @@
# F I N D O P E N N U R B S . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# - Find OpenNURBS
#
# The following variables are set:
#
# OPENNURBS_INCLUDE_DIRS - where to find opennurbs.h, etc.
# OPENNURBS_LIBRARIES - List of libraries when using openNURBS
# OPENNURBS_FOUND - True if openNURBS found.
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# OpenNURBS requires zlib
find_package(ZLIB)
#[=======================================================================[.rst:
FindOPENNURBS
--------
find_path(OPENNURBS_INCLUDE_DIR opennurbs.h)
find_library(OPENNURBS_LIBRARY NAMES opennurbs openNURBS OpenNURBS)
Find the native OPENNURBS includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``OPENNURBS::OPENNURBS``, if
OPENNURBS has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
OPENNURBS_INCLUDE_DIRS - where to find opennurbs.h, etc.
OPENNURBS_LIBRARIES - List of libraries when using openNURBS.
OPENNURBS_FOUND - True if openNURBS found.
Hints
^^^^^
A user may set ``OPENNURBS_ROOT`` to a openNURBS installation root to tell this
module where to look.
#]=======================================================================]
set(_OPENNURBS_SEARCHES)
# Search OPENNURBS_ROOT first if it is set.
if(OPENNURBS_ROOT)
set(_OPENNURBS_SEARCH_ROOT PATHS ${OPENNURBS_ROOT} NO_DEFAULT_PATH)
list(APPEND _OPENNURBS_SEARCHES _OPENNURBS_SEARCH_ROOT)
endif()
# Normal search.
set(_OPENNURBS_x86 "(x86)")
set(_OPENNURBS_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/openNURBS"
"$ENV{ProgramFiles${_OPENNURBS_x86}}/openNURBS")
unset(_OPENNURBS_x86)
list(APPEND _OPENNURBS_SEARCHES _OPENNURBS_SEARCH_NORMAL)
set(OPENNURBS_NAMES openNURBS)
# Try each search configuration.
foreach(search ${_OPENNURBS_SEARCHES})
find_path(OPENNURBS_INCLUDE_DIR NAMES opennurbs.h ${${search}} PATH_SUFFIXES include include/openNURBS openNURBS)
endforeach()
# Allow OPENNURBS_LIBRARY to be set manually, as the location of the openNURBS library
if(NOT OPENNURBS_LIBRARY)
foreach(search ${_OPENNURBS_SEARCHES})
find_library(OPENNURBS_LIBRARY NAMES ${OPENNURBS_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
endforeach()
endif()
unset(OPENNURBS_NAMES)
mark_as_advanced(OPENNURBS_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENNURBS DEFAULT_MSG OPENNURBS_LIBRARY OPENNURBS_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENNURBS REQUIRED_VARS OPENNURBS_LIBRARY OPENNURBS_INCLUDE_DIR)
if(OPENNURBS_FOUND)
set(OPENNURBS_INCLUDE_DIRS ${OPENNURBS_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
list(REMOVE_DUPLICATES OPENNURBS_INCLUDE_DIR)
set(OPENNURBS_LIBRARIES ${OPENNURBS_LIBRARY} ${ZLIB_LIBRARY})
set(OPENNURBS_INCLUDE_DIRS ${OPENNURBS_INCLUDE_DIR})
if(NOT OPENNURBS_LIBRARIES)
set(OPENNURBS_LIBRARIES ${OPENNURBS_LIBRARY})
endif()
if(NOT TARGET OPENNURBS::OPENNURBS)
add_library(OPENNURBS::OPENNURBS UNKNOWN IMPORTED)
set_target_properties(OPENNURBS::OPENNURBS PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENNURBS_INCLUDE_DIRS}")
if(OPENNURBS_LIBRARY_RELEASE)
set_property(TARGET OPENNURBS::OPENNURBS APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(OPENNURBS::OPENNURBS PROPERTIES
IMPORTED_LOCATION_RELEASE "${OPENNURBS_LIBRARY_RELEASE}")
endif()
if(OPENNURBS_LIBRARY_DEBUG)
set_property(TARGET OPENNURBS::OPENNURBS APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(OPENNURBS::OPENNURBS PROPERTIES
IMPORTED_LOCATION_DEBUG "${OPENNURBS_LIBRARY_DEBUG}")
endif()
if(NOT OPENNURBS_LIBRARY_RELEASE AND NOT OPENNURBS_LIBRARY_DEBUG)
set_property(TARGET OPENNURBS::OPENNURBS APPEND PROPERTY
IMPORTED_LOCATION "${OPENNURBS_LIBRARY}")
endif()
endif()
endif()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+34 -4
View File
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(PERPLEX_EXECUTABLE perplex DOC "path to the perplex executable")
set(_PERPLEX_SEARCHES)
# Search PERPLEX_ROOT first if it is set.
if(PERPLEX_ROOT)
set(_PERPLEX_SEARCH_ROOT PATHS ${PERPLEX_ROOT} NO_DEFAULT_PATH)
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_ROOT)
endif()
# Normal search.
set(_PERPLEX_x86 "(x86)")
set(_PERPLEX_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/perplex"
"$ENV{ProgramFiles${_PERPLEX_x86}}/perplex")
unset(_PERPLEX_x86)
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_NORMAL)
set(PERPLEX_NAMES perplex)
# Try each search configuration.
foreach(search ${_PERPLEX_SEARCHES})
find_program(PERPLEX_EXECUTABLE perplex ${${search}} PATH_SUFFIXES bin)
endforeach()
mark_as_advanced(PERPLEX_EXECUTABLE)
foreach(search ${_PERPLEX_SEARCHES})
find_file(PERPLEX_TEMPLATE perplex_template.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/perplex)
endforeach()
mark_as_advanced(PERPLEX_TEMPLATE)
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} PATH)
if(perplex_path)
@@ -141,6 +167,10 @@ if(NOT COMMAND PERPLEX_TARGET)
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
set(PVAR_PREFIX ${Name}_${IN_FILE_WE})
if (TARGET perplex_stage)
set(DEP_TARGET perplex_stage)
endif (TARGET perplex_stage)
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${PVAR_PREFIX} "" "TEMPLATE;OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR" "" ${ARGN})
endif(${ARGC} GREATER 3)
@@ -200,7 +230,7 @@ if(NOT COMMAND PERPLEX_TARGET)
OUTPUT ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${perplex_in_file} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${${PVAR_PREFIX}_OUT_HDR_FILE} -t ${${PVAR_PREFIX}_TEMPLATE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
DEPENDS ${Input} ${${PVAR_PREFIX}_TEMPLATE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
)
@@ -209,7 +239,7 @@ if(NOT COMMAND PERPLEX_TARGET)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
@@ -217,7 +247,7 @@ if(NOT COMMAND PERPLEX_TARGET)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
+102
View File
@@ -0,0 +1,102 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPOLY2TRI
--------
Find the native POLY2TRI includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``POLY2TRI::POLY2TRI``, if
POLY2TRI has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
POLY2TRI_INCLUDE_DIRS - where to find poly2tri/poly2tri.h, etc.
POLY2TRI_LIBRARIES - List of libraries when using poly2tri.
POLY2TRI_FOUND - True if poly2tri found.
Hints
^^^^^
A user may set ``POLY2TRI_ROOT`` to a poly2tri installation root to tell this
module where to look.
#]=======================================================================]
set(_POLY2TRI_SEARCHES)
# Search POLY2TRI_ROOT first if it is set.
if(POLY2TRI_ROOT)
set(_POLY2TRI_SEARCH_ROOT PATHS ${POLY2TRI_ROOT} NO_DEFAULT_PATH)
list(APPEND _POLY2TRI_SEARCHES _POLY2TRI_SEARCH_ROOT)
endif()
# Normal search.
set(_POLY2TRI_x86 "(x86)")
set(_POLY2TRI_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/poly2tri"
"$ENV{ProgramFiles${_POLY2TRI_x86}}/poly2tri")
unset(_POLY2TRI_x86)
list(APPEND _POLY2TRI_SEARCHES _POLY2TRI_SEARCH_NORMAL)
set(POLY2TRI_NAMES poly2tri)
# Try each search configuration.
foreach(search ${_POLY2TRI_SEARCHES})
find_path(POLY2TRI_INCLUDE_DIR NAMES poly2tri/poly2tri.h ${${search}} PATH_SUFFIXES include include/poly2tri poly2tri)
endforeach()
# Allow POLY2TRI_LIBRARY to be set manually, as the location of the poly2tri library
if(NOT POLY2TRI_LIBRARY)
foreach(search ${_POLY2TRI_SEARCHES})
find_library(POLY2TRI_LIBRARY NAMES ${POLY2TRI_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
endforeach()
endif()
unset(POLY2TRI_NAMES)
mark_as_advanced(POLY2TRI_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(POLY2TRI REQUIRED_VARS POLY2TRI_LIBRARY POLY2TRI_INCLUDE_DIR)
if(POLY2TRI_FOUND)
set(POLY2TRI_INCLUDE_DIRS ${POLY2TRI_INCLUDE_DIR})
if(NOT POLY2TRI_LIBRARIES)
set(POLY2TRI_LIBRARIES ${POLY2TRI_LIBRARY})
endif()
if(NOT TARGET POLY2TRI::POLY2TRI)
add_library(POLY2TRI::POLY2TRI UNKNOWN IMPORTED)
set_target_properties(POLY2TRI::POLY2TRI PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${POLY2TRI_INCLUDE_DIRS}")
if(POLY2TRI_LIBRARY_RELEASE)
set_property(TARGET POLY2TRI::POLY2TRI APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(POLY2TRI::POLY2TRI PROPERTIES
IMPORTED_LOCATION_RELEASE "${POLY2TRI_LIBRARY_RELEASE}")
endif()
if(POLY2TRI_LIBRARY_DEBUG)
set_property(TARGET POLY2TRI::POLY2TRI APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(POLY2TRI::POLY2TRI PROPERTIES
IMPORTED_LOCATION_DEBUG "${POLY2TRI_LIBRARY_DEBUG}")
endif()
if(NOT POLY2TRI_LIBRARY_RELEASE AND NOT POLY2TRI_LIBRARY_DEBUG)
set_property(TARGET POLY2TRI::POLY2TRI APPEND PROPERTY
IMPORTED_LOCATION "${POLY2TRI_LIBRARY}")
endif()
endif()
endif()
+29 -39
View File
@@ -11,45 +11,35 @@
#
# 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.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
###############################################################################
if (NOT PROJ4_FOUND)
set(_PROJ4_SEARCHES)
# 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()
# Search PROJ4_ROOT first if it is set.
if(PROJ4_ROOT)
set(_PROJ4_SEARCH_ROOT PATHS ${PROJ4_ROOT} NO_DEFAULT_PATH)
list(APPEND _PROJ4_SEARCHES _PROJ4_SEARCH_ROOT)
endif()
find_path(PROJ4_INCLUDE_DIR proj_api.h
PATHS ${PROJ4_ROOT}/include/proj ${PROJ4_OSGEO4W_HOME}/include
DOC "Path to PROJ.4 library include directory")
# Normal search.
set(_PROJ4_x86 "(x86)")
set(_PROJ4_SEARCH_NORMAL
PATHS
"$ENV{OSGEO4W_HOME}"
"C:/OSGeo4W"
"$ENV{ProgramFiles}/proj4"
"$ENV{ProgramFiles${_PROJ4_x86}}/proj4"
)
unset(_PROJ4_x86)
list(APPEND _PROJ4_SEARCHES _PROJ4_SEARCH_NORMAL)
# Try each search configuration.
foreach(search ${_PROJ4_SEARCHES})
find_path(PROJ4_INCLUDE_DIR NAMES proj_api.h ${${search}} PATH_SUFFIXES include include/proj4 proj4 include/proj proj)
endforeach()
if (PROJ4_INCLUDE_DIR)
# Extract version from proj_api.h (ex: 480)
@@ -63,10 +53,12 @@ if (PROJ4_INCLUDE_DIR)
endif()
set(PROJ4_NAMES ${PROJ4_NAMES} proj proj_i)
find_library(PROJ4_LIBRARY
NAMES ${PROJ4_NAMES}
PATHS ${PROJ4_ROOT}/lib64 ${PROJ4_ROOT}/lib ${PROJ4_OSGEO4W_HOME}/lib
DOC "Path to PROJ.4 library file")
if(NOT PROJ4_LIBRARY)
foreach(search ${_PROJ4_SEARCHES})
find_library(PROJ4_LIBRARY NAMES ${PROJ4_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
endforeach()
endif()
unset(PROJ4_NAMES)
if(PROJ4_LIBRARY)
set(PROJ4_LIBRARIES ${PROJ4_LIBRARY})
@@ -78,5 +70,3 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PROJ4 DEFAULT_MSG
PROJ4_LIBRARY
PROJ4_INCLUDE_DIR)
endif (NOT PROJ4_FOUND)
+23 -1
View File
@@ -3,7 +3,29 @@
#
#=============================================================================
find_program(RE2C_EXECUTABLE re2c DOC "path to the re2c executable")
set(_RE2C_SEARCHES)
# Search RE2C_ROOT first if it is set.
if(RE2C_ROOT)
set(_RE2C_SEARCH_ROOT PATHS ${RE2C_ROOT} NO_DEFAULT_PATH)
list(APPEND _RE2C_SEARCHES _RE2C_SEARCH_ROOT)
endif()
# Normal search.
set(_RE2C_x86 "(x86)")
set(_RE2C_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/re2c"
"$ENV{ProgramFiles${_RE2C_x86}}/re2c")
unset(_RE2C_x86)
list(APPEND _RE2C_SEARCHES _RE2C_SEARCH_NORMAL)
set(RE2C_NAMES re2c)
# Try each search configuration.
foreach(search ${_RE2C_SEARCHES})
find_program(RE2C_EXECUTABLE re2c ${${search}} PATH_SUFFIXES bin)
endforeach()
mark_as_advanced(RE2C_EXECUTABLE)
include(FindPackageHandleStandardArgs)
+4 -5
View File
@@ -46,14 +46,15 @@
# to include its own regex.h copy, check frameworks last - /usr/include
# is preferred to a package-specific copy for a generic regex search
set(CMAKE_FIND_FRAMEWORK LAST)
find_path(REGEX_INCLUDE_DIR regex.h)
find_path(REGEX_INCLUDE_DIRS regex.h)
set(REGEX_NAMES c regex compat)
foreach(rname ${REGEX_NAMES})
if(NOT REGEX_LIBRARY)
include(CheckLibraryExists)
check_library_exists(${rname} regcomp "" HAVE_REGEX_LIB)
if(HAVE_REGEX_LIB)
find_library(REGEX_LIBRARY NAMES ${rname})
find_library(REGEX_LIBRARIES NAMES ${rname})
endif(HAVE_REGEX_LIB)
endif(NOT REGEX_LIBRARY)
endforeach(rname ${REGEX_NAMES})
@@ -63,10 +64,8 @@ mark_as_advanced(REGEX_LIBRARY REGEX_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set REGEX_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(REGEX DEFAULT_MSG REGEX_INCLUDE_DIR REGEX_LIBRARY)
find_package_handle_standard_args(REGEX DEFAULT_MSG REGEX_INCLUDE_DIRS REGEX_LIBRARIES)
set(REGEX_INCLUDE_DIRS ${REGEX_INCLUDE_DIR})
set(REGEX_LIBRARIES ${REGEX_LIBRARY})
# Local Variables:
# tab-width: 8
+164
View File
@@ -0,0 +1,164 @@
# F I N D S T E P C O D E . C M A K E
# BRL-CAD
#
# Copyright (c) 2013-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# - Find STEPCODE
#
# The following variables are set:
#
# STEPCODE_INCLUDE_DIRS - where to find stepcode headers
# STEPCODE_LIBRARIES - List of libraries when using stepcode.
# STEPCODE_FOUND - True if stepcode found.
# A user may set ``STEPCODE_ROOT`` to a stepcode installation root to tell this
# module where to look.
# =============================================================================
# Check that each of the libraries has an expected header,
# as well as the toplevel defined headers. (TODO - are the
# latter needed beyond the stepcode build itself? Trim this
# to the minimum actually needed...)
set(STEPCODE_HDRS
base/sc_benchmark.h
cldai/sdaiObject.h
cleditor/STEPfile.h
clstepcore/sdai.h
clutils/gennodearray.h
exppp/exppp.h
express/express.h
sc_cf.h
)
set(STEPCODE_LIBS
base
express
exppp
stepcore
stepeditor
stepdai
steputils
)
set(STEPCODE_EXEC
exp2cxx
exppp
)
# Search STEPCODE_ROOT first if it is set.
set(_STEPCODE_SEARCHES)
if(STEPCODE_ROOT)
set(_STEPCODE_SEARCH_ROOT PATHS ${STEPCODE_ROOT} NO_DEFAULT_PATH)
list(APPEND _STEPCODE_SEARCHES _STEPCODE_SEARCH_ROOT)
endif()
# Try each search configuration.
foreach(search ${_STEPCODE_SEARCHES})
find_path(STEPCODE_BASE_DIR NAMES sc_benchmark.h ${${search}} PATH_SUFFIXES include include/stepcode/base)
find_path(STEPCODE_DAI_DIR NAMES sdaiObject.h ${${search}} PATH_SUFFIXES include include/stepcode/cldai)
find_path(STEPCODE_EDITOR_DIR NAMES STEPfile.h ${${search}} PATH_SUFFIXES include include/stepcode/cleditor)
find_path(STEPCODE_STEPCORE_DIR NAMES sdai.h ${${search}} PATH_SUFFIXES include include/stepcode/clstepcore)
find_path(STEPCODE_UTILS_DIR NAMES gennodearray.h ${${search}} PATH_SUFFIXES include include/stepcode/clutils)
find_path(STEPCODE_EXPPP_DIR NAMES exppp.h ${${search}} PATH_SUFFIXES include include/stepcode/exppp)
find_path(STEPCODE_EXPRESS_DIR NAMES express.h ${${search}} PATH_SUFFIXES include include/stepcode/express)
find_path(STEPCODE_INCLUDE_DIR NAMES sc_cf.h ${${search}} PATH_SUFFIXES include include/stepcode)
#TODO - should be an all-or-nothing for the set...
endforeach()
# Allow STEPCODE_LIBRARY to be set manually, as the location of the netpbm library
foreach(search ${_STEPCODE_SEARCHES})
find_library(STEPCODE_BASE_LIBRARY NAMES base NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
find_library(STEPCODE_EXPRESS_LIBRARY NAMES express NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
find_library(STEPCODE_EXPPP_LIBRARY NAMES exppp NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
find_library(STEPCODE_CORE_LIBRARY NAMES stepcore NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
find_library(STEPCODE_EDITOR_LIBRARY NAMES stepeditor NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
find_library(STEPCODE_DAI_LIBRARY NAMES stepdai NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
find_library(STEPCODE_UTILS_LIBRARY NAMES steputils NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
#TODO - should be an all-or-nothing for the set...
endforeach()
# Allow STEPCODE_LIBRARY to be set manually, as the location of the netpbm library
foreach(search ${_STEPCODE_SEARCHES})
find_program(EXP2CXX_EXECUTABLE exp2cxx ${${search}} PATH_SUFFIXES bin)
find_program(EXPPP_EXECUTABLE exppp ${${search}} PATH_SUFFIXES bin)
#TODO - should be an all-or-nothing for the set...
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(STEPCODE DEFAULT_MSG
STEPCODE_BASE_DIR
STEPCODE_DAI_DIR
STEPCODE_EDITOR_DIR
STEPCODE_STEPCORE_DIR
STEPCODE_UTILS_DIR
STEPCODE_EXPPP_DIR
STEPCODE_EXPRESS_DIR
STEPCODE_INCLUDE_DIR
STEPCODE_BASE_LIBRARY
STEPCODE_EXPRESS_LIBRARY
STEPCODE_EXPPP_LIBRARY
STEPCODE_CORE_LIBRARY
STEPCODE_EDITOR_LIBRARY
STEPCODE_DAI_LIBRARY
STEPCODE_UTILS_LIBRARY
EXP2CXX_EXECUTABLE
EXPPP_EXECUTABLE
)
if (STEPCODE_FOUND)
set(STEPCODE_INCLUDE_DIRS
${STEPCODE_INCLUDE_DIR}
${STEPCODE_BASE_DIR}
${STEPCODE_STEPCORE_DIR}
${STEPCODE_EDITOR_DIR}
${STEPCODE_UTILS_DIR}
${STEPCODE_DAI_DIR}
)
set(STEPCODE_LIBRARIES
${STEPCODE_BASE_LIBRARY}
${STEPCODE_EXPRESS_LIBRARY}
${STEPCODE_EXPPP_LIBRARY}
${STEPCODE_CORE_LIBRARY}
${STEPCODE_EDITOR_LIBRARY}
${STEPCODE_DAI_LIBRARY}
${STEPCODE_UTILS_LIBRARY}
)
endif()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+205 -103
View File
@@ -11,24 +11,32 @@ library is. This code sets the following variables:
::
TCL_FOUND = Tcl was found
TK_FOUND = Tk was found
TCLTK_FOUND = Tcl and Tk were found
TCLSH_FOUND = TRUE if tclsh has been found
TCL_LIBRARY = path to Tcl library (tcl tcl80)
TCL_INCLUDE_PATH = path to where tcl.h can be found
TCL_TCLSH = path to tclsh binary (tcl tcl80)
TK_LIBRARY = path to Tk library (tk tk80 etc)
TK_INCLUDE_PATH = path to where tk.h can be found
TK_WISH = full path to the wish executable
TCL_STUB_LIBRARY = path to Tcl stub library
TK_STUB_LIBRARY = path to Tk stub library
TTK_STUB_LIBRARY = path to ttk stub library
TCL_FOUND = Tcl was found
TK_FOUND = Tk was found
TCLTK_FOUND = Tcl and Tk were found
TCLSH_FOUND = TRUE if tclsh has been found
TCL_LIBRARY = path to Tcl library (tcl tcl80)
TCL_INCLUDE_PATH = path to where tcl.h can be found
TCL_TCLSH = path to tclsh binary (tcl tcl80)
TK_LIBRARY = path to Tk library (tk tk80 etc)
TK_INCLUDE_PATH = path to where tk.h can be found
TK_WISH = full path to the wish executable
TCL_STUB_LIBRARY = path to Tcl stub library
TK_STUB_LIBRARY = path to Tk stub library
TTK_STUB_LIBRARY = path to ttk stub library
#]=======================================================================]
include(CMakeFindFrameworks)
set(_TCL_SEARCHES)
# Search TCL_ROOT first if it is set.
if(TCL_ROOT)
set(_TCL_SEARCH_ROOT PATHS ${TCL_ROOT} NO_DEFAULT_PATH)
list(APPEND _TCL_SEARCHES _TCL_SEARCH_ROOT)
endif()
if(WIN32)
get_filename_component(
ActiveTcl_CurrentVersion
@@ -44,8 +52,8 @@ if(WIN32)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin"
)
get_filename_component(
ActiveTcl_CurrentVersion
get_filename_component(
ActiveTcl_CurrentVersion
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
NAME)
set(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
@@ -61,7 +69,7 @@ if(WIN32)
"C:/Tcl/lib"
)
set(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
set(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include"
@@ -87,14 +95,15 @@ set(TCL_TCLSH_NAMES
tclsh80 tclsh8.0
)
if(CYGWIN)
set(TCL_TCLSH_NAMES ${TCL_TCLSH_NAMES} cygtclsh83 cygtclsh80)
set(TCL_TCLSH_NAMES ${TCL_TCLSH_NAMES} cygtclsh83 cygtclsh80)
endif(CYGWIN)
find_program(TCL_TCLSH
NAMES ${TCL_TCLSH_NAMES}
HINTS ${TCLTK_POSSIBLE_BIN_PATHS}
)
foreach(search ${_TCL_SEARCHES})
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} ${${search}} PATH_SUFFIXES bin)
endforeach()
if (NOT TCL_TCLSH)
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
endif (NOT TCL_TCLSH)
set(TK_WISH_NAMES
wish
@@ -108,13 +117,15 @@ set(TK_WISH_NAMES
)
if(CYGWIN)
set(TK_WISH_NAMES ${TK_WISH_NAMES} cygwish80 )
set(TK_WISH_NAMES ${TK_WISH_NAMES} cygwish80 )
endif()
find_program(TK_WISH
NAMES ${TK_WISH_NAMES}
HINTS ${TCLTK_POSSIBLE_BIN_PATHS}
)
foreach(search ${_TCL_SEARCHES})
find_program(TK_WISH NAMES ${TK_WISH_NAMES} ${${search}} PATH_SUFFIXES bin)
endforeach()
if (NOT TK_WISH)
find_program(TK_WISH NAMES ${TK_WISH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
endif (NOT TK_WISH)
if(TCLSH_VERSION_STRING)
set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
@@ -132,9 +143,10 @@ set(TCLTK_POSSIBLE_LIB_PATHS
"${TK_LIBRARY_PATH}"
"${TCL_TCLSH_PATH_PARENT}/lib"
"${TK_WISH_PATH_PARENT}/lib"
)
)
set(TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
lib
lib/tcl
lib/tcl/tcl8.7
lib/tcl/tk8.7
lib/tcl/tcl8.6
@@ -143,10 +155,9 @@ set(TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
lib/tcl/tk8.5
lib/tcl/tcl8.4
lib/tcl/tk8.4
)
)
find_library(TCL_LIBRARY
NAMES
set(TCL_POSSIBLE_LIB_NAMES
tcl
tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION}
tcl87 tcl8.7 tcl87t tcl8.7t
@@ -156,12 +167,25 @@ find_library(TCL_LIBRARY
tcl83 tcl8.3
tcl82 tcl8.2
tcl80 tcl8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
find_library(TCL_STUB_LIBRARY
NAMES
if(NOT TCL_LIBRARY)
foreach(search ${_TCL_SEARCHES})
find_library(TCL_LIBRARY
NAMES ${TCL_POSSIBLE_LIB_NAMES}
NAMES_PER_DIR ${${search}}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES})
endforeach()
endif()
if(NOT TCL_LIBRARY)
find_library(TCL_LIBRARY
NAMES ${TCL_POSSIBLE_LIB_NAMES}
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
endif(NOT TCL_LIBRARY)
set(TCLSTUB_POSSIBLE_LIB_NAMES
tclstub
tclstub${TK_LIBRARY_VERSION} tclstub${TCL_TCLSH_VERSION} tclstub${TK_WISH_VERSION}
tclstub87 tclstub8.7
@@ -171,11 +195,24 @@ find_library(TCL_STUB_LIBRARY
tclstub83 tclstub8.3
tclstub82 tclstub8.2
tclstub80 tclstub8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
)
if(NOT TCL_STUB_LIBRARY)
foreach(search ${_TCL_SEARCHES})
find_library(TCL_STUB_LIBRARY
NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES}
NAMES_PER_DIR ${${search}}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
endforeach()
endif()
if(NOT TCL_STUB_LIBRARY)
find_library(TCL_STUB_LIBRARY
NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES}
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
endif()
find_library(TK_LIBRARY
NAMES
set(TK_POSSIBLE_LIB_NAMES
tk
tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION}
tk87 tk8.7 tk87t tk8.7t
@@ -185,12 +222,26 @@ find_library(TK_LIBRARY
tk83 tk8.3
tk82 tk8.2
tk80 tk8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
find_library(TK_STUB_LIBRARY
NAMES
if(NOT TK_LIBRARY)
foreach(search ${_TCL_SEARCHES})
find_library(TK_LIBRARY
NAMES ${TK_POSSIBLE_LIB_NAMES}
NAMES_PER_DIR ${${search}}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
endforeach()
endif()
if(NOT TK_LIBRARY)
find_library(TK_LIBRARY
NAMES ${TK_POSSIBLE_LIB_NAMES}
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
endif(NOT TK_LIBRARY)
set(TK_STUB_POSSIBLE_LIB_NAMES
tkstub
tkstub${TCL_LIBRARY_VERSION} tkstub${TCL_TCLSH_VERSION} tkstub${TK_WISH_VERSION}
tkstub87 tkstub8.7
@@ -200,19 +251,48 @@ find_library(TK_STUB_LIBRARY
tkstub83 tkstub8.3
tkstub82 tkstub8.2
tkstub80 tkstub8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
)
find_library(TTK_STUB_LIBRARY
NAMES
if(NOT TK_STUB_LIBRARY)
foreach(search ${_TCL_SEARCHES})
find_library(TK_STUB_LIBRARY
NAMES ${TK_STUB_POSSIBLE_LIB_NAMES}
NAMES_PER_DIR ${${search}}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
endforeach()
endif()
if(NOT TK_STUB_LIBRARY)
find_library(TK_STUB_LIBRARY
NAMES ${TK_STUB_POSSIBLE_LIB_NAMES}
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
endif()
set(TTK_STUB_POSSIBLE_LIB_NAMES
ttkstub
ttkstub${TCL_LIBRARY_VERSION} ttkstub${TCL_TCLSH_VERSION} ttkstub${TK_WISH_VERSION}
ttkstub88 ttkstub8.8
ttkstub87 ttkstub8.7
ttkstub86 ttkstub8.6
ttkstub85 ttkstub8.5
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
)
if(NOT TTK_STUB_LIBRARY)
foreach(search ${_TCL_SEARCHES})
find_library(TTK_STUB_LIBRARY
NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES}
NAMES_PER_DIR ${${search}}
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
endforeach()
endif()
if(NOT TTK_STUB_LIBRARY)
find_library(TTK_STUB_LIBRARY
NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES}
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
endif()
CMAKE_FIND_FRAMEWORKS(Tcl)
CMAKE_FIND_FRAMEWORKS(Tk)
@@ -231,7 +311,7 @@ if(Tk_FRAMEWORKS)
if(NOT TK_INCLUDE_PATH)
foreach(dir ${Tk_FRAMEWORKS})
set(TK_FRAMEWORK_INCLUDES ${TK_FRAMEWORK_INCLUDES}
${dir}/Headers ${dir}/PrivateHeaders)
${dir}/Headers ${dir}/PrivateHeaders)
endforeach()
endif()
endif()
@@ -263,75 +343,90 @@ set(TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
include/tcl8.0
)
find_path(TCL_INCLUDE_PATH
NAMES tcl.h
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
find_path(TK_INCLUDE_PATH
NAMES tk.h
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
foreach(search ${_TCL_SEARCHES})
find_path(TCL_INCLUDE_PATH
NAMES tcl.h ${${search}}
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
endforeach()
if (NOT TCL_INCLUDE_PATH)
find_path(TCL_INCLUDE_PATH
NAMES tcl.h
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
endif()
foreach(search ${_TCL_SEARCHES})
find_path(TK_INCLUDE_PATH
NAMES tk.h ${${search}}
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
endforeach()
if (NOT TK_INCLUDE_PATH)
find_path(TK_INCLUDE_PATH
NAMES tk.h
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
endif()
# IFF we have TCL_TK_SYSTEM_GRAPHICS set and have a system TK_WISH, check that the
# windowing system matches the specified type
if (NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
set(tkwin_script "
set filename \"${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM\"
set fileId [open $filename \"w\"]
set windowingsystem [tk windowingsystem]
puts $fileId $windowingsystem
close $fileId
exit
")
set(tkwin_scriptfile "${CMAKE_BINARY_DIR}/CMakeTmp/tk_windowingsystem.tcl")
set(WSYS "wm-NOTFOUND")
file(WRITE ${tkwin_scriptfile} ${tkwin_script})
execute_process(COMMAND ${TK_WISH} ${tkwin_scriptfile} OUTPUT_VARIABLE EXECOUTPUT)
if (EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM" readresultvar)
string(REGEX REPLACE "\n" "" WSYS "${readresultvar}")
endif (EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
set(tkwin_script "
set filename \"${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM\"
set fileId [open $filename \"w\"]
set windowingsystem [tk windowingsystem]
puts $fileId $windowingsystem
close $fileId
exit
")
set(tkwin_scriptfile "${CMAKE_BINARY_DIR}/CMakeTmp/tk_windowingsystem.tcl")
set(WSYS "wm-NOTFOUND")
file(WRITE ${tkwin_scriptfile} ${tkwin_script})
execute_process(COMMAND ${TK_WISH} ${tkwin_scriptfile} OUTPUT_VARIABLE EXECOUTPUT)
if (EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM" readresultvar)
string(REGEX REPLACE "\n" "" WSYS "${readresultvar}")
endif (EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
# If we have no information about the windowing system or it does not match
# a specified system, the find_package detection has failed
if (NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
unset(TCL_LIBRARY CACHE)
unset(TCL_STUB_LIBRARY CACHE)
unset(TK_LIBRARY CACHE)
unset(TK_STUB_LIBRARY CACHE)
unset(TCL_FOUND CACHE)
unset(TK_FOUND CACHE)
unset(TCLTK_FOUND CACHE)
unset(TCLSH_FOUND CACHE)
unset(TCL_LIBRARY CACHE)
unset(TCL_INCLUDE_PATH CACHE)
unset(TCL_TCLSH CACHE)
unset(TK_LIBRARY CACHE)
unset(TK_INCLUDE_PATH CACHE)
unset(TK_WISH CACHE)
unset(TCL_STUB_LIBRARY CACHE)
unset(TK_STUB_LIBRARY CACHE)
unset(TTK_STUB_LIBRARY CACHE)
endif (NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
# If we have no information about the windowing system or it does not match
# a specified system, the find_package detection has failed
if (NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
unset(TCL_LIBRARY CACHE)
unset(TCL_STUB_LIBRARY CACHE)
unset(TK_LIBRARY CACHE)
unset(TK_STUB_LIBRARY CACHE)
unset(TCL_FOUND CACHE)
unset(TK_FOUND CACHE)
unset(TCLTK_FOUND CACHE)
unset(TCLSH_FOUND CACHE)
unset(TCL_LIBRARY CACHE)
unset(TCL_INCLUDE_PATH CACHE)
unset(TCL_TCLSH CACHE)
unset(TK_LIBRARY CACHE)
unset(TK_INCLUDE_PATH CACHE)
unset(TK_WISH CACHE)
unset(TCL_STUB_LIBRARY CACHE)
unset(TK_STUB_LIBRARY CACHE)
unset(TTK_STUB_LIBRARY CACHE)
endif (NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
endif (NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TCL_TCLSH
VERSION_VAR TCLSH_VERSION_STRING)
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TCL_TCLSH
VERSION_VAR TCLSH_VERSION_STRING)
set(FPHSA_NAME_MISMATCHED 1)
set(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
set(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCLTK
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH)
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH)
set(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
set(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TK
REQUIRED_VARS TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH TK_WISH)
REQUIRED_VARS TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH TK_WISH)
unset(FPHSA_NAME_MISMATCHED)
mark_as_advanced(
@@ -346,3 +441,10 @@ mark_as_advanced(
TTK_STUB_LIBRARY
)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+97 -57
View File
@@ -1,62 +1,102 @@
# F I N D U T A H R L E . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# - Find UtahRLE libraries
#
# The following variables are set:
#
# UTAHRLE_LIBRARY
# The following variables are set:
#
# UTAHRLE_INCLUDE_DIRS - where to find zlib.h, etc.
# UTAHRLE_LIBRARIES - List of libraries when using zlib.
# UTAHRLE_FOUND - True if zlib found.
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
find_path(UTAHRLE_INCLUDE_DIR rle.h)
find_library(UTAHRLE_LIBRARY NAMES UTAHRLE)
#[=======================================================================[.rst:
FindUTAHRLE
--------
Find the native UTAHRLE includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``UTAHRLE::UTAHRLE``, if
UTAHRLE has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
UTAHRLE_INCLUDE_DIRS - where to find pam.h, etc.
UTAHRLE_LIBRARIES - List of libraries when using utahrle.
UTAHRLE_FOUND - True if utahrle found.
Hints
^^^^^
A user may set ``UTAHRLE_ROOT`` to a utahrle installation root to tell this
module where to look.
#]=======================================================================]
set(_UTAHRLE_SEARCHES)
# Search UTAHRLE_ROOT first if it is set.
if(UTAHRLE_ROOT)
set(_UTAHRLE_SEARCH_ROOT PATHS ${UTAHRLE_ROOT} NO_DEFAULT_PATH)
list(APPEND _UTAHRLE_SEARCHES _UTAHRLE_SEARCH_ROOT)
endif()
# Normal search.
set(_UTAHRLE_x86 "(x86)")
set(_UTAHRLE_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/utahrle"
"$ENV{ProgramFiles${_UTAHRLE_x86}}/utahrle")
unset(_UTAHRLE_x86)
list(APPEND _UTAHRLE_SEARCHES _UTAHRLE_SEARCH_NORMAL)
set(UTAHRLE_NAMES utahrle)
# Try each search configuration.
foreach(search ${_UTAHRLE_SEARCHES})
find_path(UTAHRLE_INCLUDE_DIR NAMES rle.h ${${search}} PATH_SUFFIXES include include/utahrle)
endforeach()
# Allow UTAHRLE_LIBRARY to be set manually, as the location of the utahrle library
if(NOT UTAHRLE_LIBRARY)
foreach(search ${_UTAHRLE_SEARCHES})
find_library(UTAHRLE_LIBRARY NAMES ${UTAHRLE_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
endforeach()
endif()
unset(UTAHRLE_NAMES)
mark_as_advanced(UTAHRLE_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(UTAHRLE DEFAULT_MSG UTAHRLE_LIBRARY UTAHRLE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(UTAHRLE REQUIRED_VARS UTAHRLE_LIBRARY UTAHRLE_INCLUDE_DIR)
IF (UTAHRLE_FOUND)
set(UTAHRLE_INCLUDE_DIRS ${UTAHRLE_INCLUDE_DIR})
set(UTAHRLE_LIBRARIES ${UTAHRLE_LIBRARY})
if(UTAHRLE_FOUND)
set(UTAHRLE_INCLUDE_DIRS ${UTAHRLE_INCLUDE_DIR})
if(NOT UTAHRLE_LIBRARIES)
set(UTAHRLE_LIBRARIES ${UTAHRLE_LIBRARY})
endif()
if(NOT TARGET UTAHRLE::UTAHRLE)
add_library(UTAHRLE::UTAHRLE UNKNOWN IMPORTED)
set_target_properties(UTAHRLE::UTAHRLE PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${UTAHRLE_INCLUDE_DIRS}")
if(UTAHRLE_LIBRARY_RELEASE)
set_property(TARGET UTAHRLE::UTAHRLE APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(UTAHRLE::UTAHRLE PROPERTIES
IMPORTED_LOCATION_RELEASE "${UTAHRLE_LIBRARY_RELEASE}")
endif()
if(UTAHRLE_LIBRARY_DEBUG)
set_property(TARGET UTAHRLE::UTAHRLE APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(UTAHRLE::UTAHRLE PROPERTIES
IMPORTED_LOCATION_DEBUG "${UTAHRLE_LIBRARY_DEBUG}")
endif()
if(NOT UTAHRLE_LIBRARY_RELEASE AND NOT UTAHRLE_LIBRARY_DEBUG)
set_property(TARGET UTAHRLE::UTAHRLE APPEND PROPERTY
IMPORTED_LOCATION "${UTAHRLE_LIBRARY}")
endif()
endif()
endif()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+179 -37
View File
@@ -29,56 +29,198 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include(CMakeParseArguments)
# Relative path specifiers are platform specific. Encapsulate them in a
# function to hide the details from other code.
function(relative_rpath outvar)
cmake_parse_arguments(R "" "SUFFIX;LEN" "" ${ARGN})
if (R_SUFFIX)
set(DPATH)
set(CPATH "${R_SUFFIX}")
while (NOT "${CPATH}" STREQUAL "")
set(DPATH "../${DPATH}")
get_filename_component(CPATH "${CPATH}" DIRECTORY)
endwhile()
else ()
set(DPATH "../")
endif (R_SUFFIX)
if (APPLE)
set(RELATIVE_RPATH ";@loader_path/${DPATH}${LIB_DIR}" PARENT_SCOPE)
else (APPLE)
set(RELATIVE_RPATH ":\$ORIGIN/${DPATH}${LIB_DIR}" PARENT_SCOPE)
endif (APPLE)
# IFF the caller tells us to, lengthen the relative path to a
# specified length. This is useful in scenarios where the relative
# path is the only viable option
if (R_LEN)
string(LENGTH "${RELATIVE_RPATH}" CURR_LEN)
while("${CURR_LEN}" LESS "${R_LEN}")
set(RELATIVE_RPATH "${RELATIVE_RPATH}:")
string(LENGTH "${RELATIVE_RPATH}" CURR_LEN)
endwhile("${CURR_LEN}" LESS "${R_LEN}")
endif (R_LEN)
set(${outvar} "${RELATIVE_RPATH}" PARENT_SCOPE)
endfunction(relative_rpath)
# Set (or restore) a standard BRL-CAD setting for CMAKE_BUILD_RPATH.
function(std_build_rpath)
# If we're in multiconfig mode, we need to look relative to the current
# build configuration, not the top level lib directory.
if (CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/$<CONFIG>/${LIB_DIR}")
else (CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/${LIB_DIR}")
endif (CMAKE_CONFIGURATION_TYPES)
# Done - let the parent know what the answers are
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" PARENT_SCOPE)
# Set the final install rpath
relative_rpath(RELPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}${RELPATH}" PARENT_SCOPE)
endfunction(std_build_rpath)
#---------------------------------------------------------------------
# The following logic is what allows binaries to run successfully in
# the build directory AND install directory. Thanks to plplot for
# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX.
# Documentation of these options is available at
# http://www.cmake.org/Wiki/CMake_RPATH_handling
# Settings for CMAKE_RPATH_BUILD that support custom manipulation of
# external project outputs.
if(NOT COMMAND cmake_set_rpath)
# TODO - investigate using BUILD_RPATH and INSTALL_RPATH on a per
# target basis for more precise control (for example, when setting
# up paths for libs in subdirs... not sure yet if it could be helpful
# but should be explored.
function(cmake_set_rpath)
# Note in particular that BUILD_RPATH supports generator expressions,
# in case that's of use to pull other properties on which to base
# rpaths...
if(NOT CMAKE_RPATH_SET)
# Can use set_property: https://stackoverflow.com/a/40147991
# 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)
# To allow CMake to manipulate RPaths, we need to make sure they are all the
# same length and long enough to hold the longest candidate path we will need.
#
# NOTE: Since we haven't yet created any lib subdirectories that may be created
# by 3rd party builds, we can't check them for explicit length - for now, we
# use 20 as an upper bound on how long a directory name we might need there,
# but that will need to be updated in the event a more verbosely named library
# subdirectory shows up.
function(longest_rpath outvar)
# 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)
cmake_parse_arguments(R "" "SUFFIX" "" ${ARGN})
# 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 "${BRLCAD_INSTALL_PREFIX}/${LIB_DIR}:\$ORIGIN/../${LIB_DIR}" PARENT_SCOPE)
else(NOT APPLE)
set(CMAKE_INSTALL_RPATH "${BRLCAD_INSTALL_PREFIX}/${LIB_DIR};@loader_path/../${LIB_DIR}" PARENT_SCOPE)
endif(NOT APPLE)
# Microsoft platforms don't do RPATH
if (MSVC)
return()
endif (MSVC)
# 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 "${BRLCAD_INSTALL_PREFIX}/${LIB_DIR}" PARENT_SCOPE)
endif ("${CMAKE_VERSION}" VERSION_LESS 3.0)
# The possible roots are CMAKE_INSTALL_PREFIX and CMAKE_BINARY_DIR.
# Find out which is longer
string(LENGTH "${CMAKE_INSTALL_PREFIX}" ILEN)
string(LENGTH "${CMAKE_BINARY_DIR}" BLEN)
if ("${ILEN}" GREATER "${BLEN}")
set(ROOT_LEN "${ILEN}")
else ("${ILEN}" GREATER "${BLEN}")
set(ROOT_LEN "${BLEN}")
endif ("${ILEN}" GREATER "${BLEN}")
# 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)
# Find the longest of the configuration string names
# (this will be zero in a non-multiconfig build)
set(CONF_LEN 0)
foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
string(LENGTH "/${cfg}" CLEN)
if ("${CLEN}" GREATER "${CONF_LEN}")
set(CONF_LEN ${CLEN})
endif ("${CLEN}" GREATER "${CONF_LEN}")
endforeach(cfg ${CMAKE_CONFIGURATION_TYPES})
# RPATH setup is now complete
set(CMAKE_RPATH_SET 1 PARENT_SCOPE)
# The length of LIB_DIR itself needs to be factored in
if (R_SUFFIX)
string(LENGTH "/${LIB_DIR}/${R_SUFFIX}" LIB_LEN)
else (R_SUFFIX)
string(LENGTH "/${LIB_DIR}" LIB_LEN)
endif (R_SUFFIX)
endif(NOT CMAKE_RPATH_SET)
# Hardcoded estimate of maximum lib subdir length
#
# *** UPDATE THIS IF UNABLE TO SET RPATH FOR LIBRARIES IN SUBDIRS ***
#
set(SUBLIB_LEN 20)
endfunction(cmake_set_rpath)
# Include the relative path specifier length:
if (R_SUFFIX)
relative_rpath(RELPATH SUFFIX "${R_SUFFIX}")
else (R_SUFFIX)
relative_rpath(RELPATH)
endif (R_SUFFIX)
string(LENGTH "${RELPATH}" REL_LEN)
endif(NOT COMMAND cmake_set_rpath)
math(EXPR len "${ROOT_LEN} + ${CONF_LEN} + ${LIB_LEN} + ${SUBLIB_LEN} + ${REL_LEN}")
set(${outvar} ${len} PARENT_SCOPE)
endfunction(longest_rpath)
function(ext_build_rpath)
# Microsoft platforms don't do RPATH
if (MSVC)
return()
endif (MSVC)
cmake_parse_arguments(R "" "SUFFIX" "" ${ARGN})
if (R_SUFFIX)
longest_rpath(LLEN SUFFIX "${R_SUFFIX}")
else (R_SUFFIX)
longest_rpath(LLEN)
endif (R_SUFFIX)
# If we're in multiconfig mode, we want to target the config subdir, not just
# the build dir itself.
if (CMAKE_CONFIGURATION_TYPES)
if (R_SUFFIX)
set(BUILD_RPATH "${CMAKE_BINARY_DIR}/$<CONFIG>/${LIB_DIR}/${R_SUFFIX}")
else (R_SUFFIX)
set(BUILD_RPATH "${CMAKE_BINARY_DIR}/$<CONFIG>/${LIB_DIR}")
endif (R_SUFFIX)
else (CMAKE_CONFIGURATION_TYPES)
if (R_SUFFIX)
set(BUILD_RPATH "${CMAKE_BINARY_DIR}/${LIB_DIR}/${R_SUFFIX}")
else (R_SUFFIX)
set(BUILD_RPATH "${CMAKE_BINARY_DIR}/${LIB_DIR}")
endif (R_SUFFIX)
endif (CMAKE_CONFIGURATION_TYPES)
# This is the key to the process - the ":" characters appended to the build
# time path result in a path string in the compile outputs that has
# sufficient length to hold the install directory, while is what allows
# CMake's file command to manipulate the paths. At the same time, the colon
# lengthened paths do not break the functioning of the shorter build path.
# Normally this is an internal CMake detail, but we need it to supply to
# external build systems so their outputs can be manipulated as if they were
# outputs of our own build.
string(LENGTH "${BUILD_RPATH}" CURR_LEN)
while("${CURR_LEN}" LESS "${LLEN}")
set(BUILD_RPATH "${BUILD_RPATH}:")
string(LENGTH "${BUILD_RPATH}" CURR_LEN)
endwhile("${CURR_LEN}" LESS "${LLEN}")
# Done - let the parent know what the answers are
set(CMAKE_BUILD_RPATH "${BUILD_RPATH}" PARENT_SCOPE)
# Set the final install rpath
relative_rpath(RELPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}${RELPATH}" PARENT_SCOPE)
endfunction(ext_build_rpath)
# Local Variables:
# tab-width: 8
+12 -29
View File
@@ -37,38 +37,21 @@
#============================================================
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}")
set(INST_DIR "${LIB_DIR}")
if(MSVC)
set(lld_install "${BIN_DIR}")
set(INST_DIR "${BIN_DIR}")
endif(MSVC)
if(NOT CMAKE_CONFIGURATION_TYPES)
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)
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(lld_build "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}}")
endif(MSVC)
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})
endif(NOT CMAKE_CONFIGURATION_TYPES)
# 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}")
set(WORKING_PKGFILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LIB_DIR}/${pkgname}${pkgversion}/pkgIndex.tcl)
set(INSTALL_PKGFILE ${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl)
add_custom_command(OUTPUT ${WORKING_PKGFILE} ${INSTALL_PKGFILE}
COMMAND ${CMAKE_COMMAND} -DWORKING_PKGFILE="${WORKING_PKGFILE}" -DINSTALL_PKGFILE="${INSTALL_PKGFILE}" -DTF_NAME="$<TARGET_FILE_NAME:${target}>" -DTF_DIR="$<TARGET_FILE_DIR:${target}>" -Dpkgname="${pkgname}" -Dpkgversion="${pkgversion}" -DINST_DIR="${INST_DIR}" -P ${BRLCAD_CMAKE_DIR}/scripts/tcl_mkindex.cmake
)
add_custom_target(${pkgname}_pkgIndex ALL DEPENDS ${WORKING_PKGFILE} ${INSTALL_PKGFILE})
DISTCLEAN("${WORKING_PKGFILE}")
DISTCLEAN("${INSTALL_PKGFILE}")
endfunction(TCL_PKGINDEX)
-556
View File
@@ -1,556 +0,0 @@
# T H I R D P A R T Y . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
include(CMakeParseArguments)
# Synopsis:
#
# THIRD_PARTY(dir
# varname_root
# build_target
# description
# [FIND_NAME name]
# [FIND_VERSION version]
# [FIND_COMPONENTS component1 component2 ...]
# [REQUIRED_VARS var1 var2 ...]
# [RESET_VARS var1 var2 ...]
# [ALIASES alias1 alias2 ...]
# [FLAGS flag1 flag2 ...]
# [UNDOCUMENTED]
# )
#-----------------------------------------------------------------------------
function(THIRD_PARTY dir varname_root build_target description)
# Parse extra arguments
CMAKE_PARSE_ARGUMENTS(TP "UNDOCUMENTED;NOSYS" "FIND_NAME;FIND_VERSION" "FIND_COMPONENTS;REQUIRED_VARS;RESET_VARS;ALIASES;FLAGS" ${ARGN})
# If the library variable has been explicitly set, get
# 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(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 ${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 ${TP_REQUIRED_VARS})
if(NOT ${item})
set(TP_DISABLED 1)
set(TP_DISABLE_TEST 1)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
if(NOT DISABLE_STR)
set(DISABLE_STR "${item}")
else(NOT DISABLE_STR)
set(DISABLE_STR "${DISABLE_STR},${item}")
endif(NOT DISABLE_STR)
endif(NOT ${item})
endforeach(item ${TP_REQUIRED_VARS})
if(DISABLE_STR)
set(${CMAKE_PROJECT_NAME}_${varname_root} "DISABLED ${DISABLE_STR}" CACHE STRING "DISABLED ${DISABLED_STR}" FORCE)
mark_as_advanced(FORCE ${CMAKE_PROJECT_NAME}_${varname_root})
set_property(CACHE ${CMAKE_PROJECT_NAME}_${varname_root} PROPERTY STRINGS "DISABLED ${DISABLE_STR}")
set(TP_MET_CONDITION 1)
else(DISABLE_STR)
# If we have a leftover disabled setting in the cache from earlier runs, clear it.
if("${local_opt}" MATCHES "DISABLED")
set(${CMAKE_PROJECT_NAME}_${varname_root} "" CACHE STRING "Clear DISABLED setting" FORCE)
mark_as_advanced(CLEAR ${CMAKE_PROJECT_NAME}_${varname_root})
endif("${local_opt}" MATCHES "DISABLED")
endif(DISABLE_STR)
# 2. Next - is the library variable explicitly set to SYSTEM? If it is, we are NOT building it.
if(local_opt)
if("${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM" CACHE STRING "User forced to SYSTEM" FORCE)
set(TP_MET_CONDITION 2)
if(TP_NOSYS)
message(WARNING "Compilation of ${build_target} was disabled, but local copy is modified - using a system version of ${build_target} may introduce problems or even fail to work!")
endif(TP_NOSYS)
endif("${local_opt}" STREQUAL "SYSTEM")
endif(local_opt)
# 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 TP_MET_CONDITION AND TP_NOSYS)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED" CACHE STRING "NOSYS passed, using bundled ${build_target}" FORCE)
mark_as_advanced(${CMAKE_PROJECT_NAME}_${varname_root})
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_MET_CONDITION 3)
set(TP_DISABLE_TEST 1)
endif(NOT TP_MET_CONDITION AND TP_NOSYS)
# 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(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(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 TP_MET_CONDITION)
if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root} "${BRLCAD_BUNDLED_LIBS} (AUTO)" CACHE STRING "BRLCAD_BUNDLED_LIBS: ${BRLCAD_BUNDLED_LIBS}" FORCE)
if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(TP_MET_CONDITION 5)
elseif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_DISABLE_TEST 1)
set(TP_MET_CONDITION 5)
endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
endif(NOT TP_MET_CONDITION)
# If we haven't been knocked out by any of the above conditions, do our testing and base the results on that.
if(NOT TP_DISABLE_TEST)
# Stash the previous results (if any) so we don't repeatedly call out the tests - only report
# if something actually changes in subsequent runs.
set(${varname_root}_FOUND_STATUS ${${varname_root}_FOUND})
# Initialize (or rather, uninitialize) variables in preparation for search
set(${varname_root}_FOUND "${varname_root}-NOTFOUND")
mark_as_advanced(${varname_root}_FOUND)
set(${varname_root}_LIBRARY "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_LIBRARY" FORCE)
mark_as_advanced(${varname_root}_LIBRARY)
set(${varname_root}_LIBRARIES "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_LIBRARIES" FORCE)
mark_as_advanced(${varname_root}_LIBRARIES)
set(${varname_root}_INCLUDE_DIR "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_INCLUDE_DIR" FORCE)
mark_as_advanced(${varname_root}_INCLUDE_DIR)
set(${varname_root}_INCLUDE_DIRS "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_INCLUDE_DIRS" FORCE)
mark_as_advanced(${varname_root}_INCLUDE_DIRS)
# Be quiet if we're doing this over
if("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
set(${varname_root}_FIND_QUIETLY TRUE)
endif("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
# Find the package in question. It is the toplevel CMakeLists.txt's responsibility to make
# sure that the CMAKE_MODULE_PATH variable is set correctly if there are local versions of
# 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(${TP_FIND_NAME} ${TP_FIND_VERSION} COMPONENTS ${TP_FIND_COMPONENTS})
# going to use system or bundled versions of deps
if(${varname_root}_FOUND)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
if(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "Found System version, using" FORCE)
endif(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
else(${varname_root}_FOUND)
# If one of our previous conditions precludes building this library, we've got a problem.
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 "${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "BRLCAD_BUNDLED_LIBS forced to SYSTEM, but library not found!" FORCE)
else(NOT "${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM" CACHE STRING "Hard-set to SYSTEM by user, but library not found!" FORCE)
endif(NOT "${local_opt}" STREQUAL "SYSTEM")
else("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED (AUTO)" CACHE STRING "System test failed, enabling local copy" FORCE)
endif("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
endif(${varname_root}_FOUND)
endif(NOT TP_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
# confused - a system lib was found and system libraries are to be preferred with current
# options. This is unfortunate in that it may introduce extra build work just from trying
# configure options, but appears to be essential to ensuring that the build "just works"
# each time.
if(NOT ${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
string(REGEX REPLACE "lib" "" rootname "${build_target}")
file(GLOB STALE_FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${rootname}*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
foreach(stale_file ${STALE_FILES})
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove ${stale_file}
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
endforeach(stale_file ${STALE_FILES})
if(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" MATCHES "${local_opt}")
if("${local_opt}" MATCHES "BUNDLED")
message("Reconfiguring to use system ${varname_root}")
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
if(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
add_subdirectory(${dir})
set(${varname_root}_LIBRARY "${build_target}" CACHE STRING "${varname_root}_LIBRARY" FORCE)
set(${varname_root}_LIBRARIES "${build_target}" CACHE STRING "${varname_root}_LIBRARIES" 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)
set(${varname_root}_INCLUDE_DIRS "${${varname_root}_INCLUDE_DIR}" CACHE STRING "set by THIRD_PARTY_SUBDIR macro" FORCE)
endif(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
# Let parent scope know what's happening
set(${varname_root}_FOUND "${${varname_root}_FOUND}" PARENT_SCOPE)
set(${varname_root}_LIBRARY "${${varname_root}_LIBRARY}" PARENT_SCOPE)
mark_as_advanced(${varname_root}_LIBRARY)
set(${varname_root}_LIBRARIES "${${varname_root}_LIBRARIES}" PARENT_SCOPE)
mark_as_advanced(${varname_root}_LIBRARIES)
set(${varname_root}_INCLUDE_DIR "${${varname_root}_INCLUDE_DIR}" PARENT_SCOPE)
mark_as_advanced(${varname_root}_INCLUDE_DIR)
set(${varname_root}_INCLUDE_DIRS "${${varname_root}_INCLUDE_DIRS}" PARENT_SCOPE)
mark_as_advanced(${varname_root}_INCLUDE_DIRS)
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)
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
set_property(CACHE ${CMAKE_PROJECT_NAME}_${varname_root} PROPERTY STRINGS AUTO BUNDLED SYSTEM)
endfunction(THIRD_PARTY)
#-----------------------------------------------------------------------------
function(THIRD_PARTY_EXECUTABLE dir varname_root build_target)
# Parse extra arguments
CMAKE_PARSE_ARGUMENTS(TP "NOSYS" "" "REQUIRED_VARS;ALIASES;DESCRIPTION" ${ARGN})
# If the exec variable has been explicitly set, get
# an normalized version of it for easier matching
set(local_opt)
if(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
set(local_opt "${${CMAKE_PROJECT_NAME}_${varname_root}}")
endif(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
VAL_NORMALIZE(local_opt ABS)
# Initialize some variables
set(TP_DISABLED 0)
set(TP_DISABLE_TEST 0)
set(TP_MET_CONDITION 0)
# 0. Whether or not we're building the sources, we are tracking the files
# that are supposed to be in the directory
get_filename_component(DIR_NAME "${dir}" NAME)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
message(FATAL_ERROR "Third party component ${DIR_NAME} does not have a dist file at \"${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist\"")
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
include("${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
CMAKEFILES_IN_DIR(${DIR_NAME}_ignore_files ${dir})
# 1. For executables, it is a reasonable use case that the developer manually specifies
# the location for an executable. It is tricky to distinguish this situation from
# a previously cached executable path resulting from a Find*.cmake script. The way
# we will proceed is to cache the value of ${varname_root}_EXECUTABLE if it is defined, and
# at the end check it against the results of running the THIRD_PARTY logic. If
# it matches neither pattern (Bundled or System) it is assumed that the value passed
# in is an intentional setting on the part of the developer. This has one potential
# drawback in that the *removal* of a system executable between searches could result
# in a previously cached system search result being identified as a user-specified
# result - to prevent that, the cached path is only used to override other results
# if the file it specifies actually exists. One additional wrinkle here - if the
# developer has hard-specified BUNDLED for this particular executable, even a user specified
# or cached value will be replaced with the local path. A feature based disablement
# of the tool also applies to the cached version.
if(${varname_root}_EXECUTABLE)
IS_SUBPATH("${CMAKE_BINARY_DIR}" "${${varname_root}_EXECUTABLE}" SUBBUILD_TEST)
if("${SUBBUILD_TEST}" STREQUAL "0")
get_filename_component(FULL_PATH_EXEC ${${varname_root}_EXECUTABLE} ABSOLUTE)
if("${FULL_PATH_EXEC}" STREQUAL "${${varname_root}_EXECUTABLE}")
if(EXISTS ${FULL_PATH_EXEC})
set(EXEC_CACHED ${${varname_root}_EXECUTABLE})
else(EXISTS ${FULL_PATH_EXEC})
# This path not being present may indicate the user specified a path
# and made a mistake doing so - warn that this might be the case.
message(WARNING "File path ${${varname_root}_EXECUTABLE} specified for ${varname_root}_EXECUTABLE does not exist - this path will not override ${build_target} executable search results.")
endif(EXISTS ${FULL_PATH_EXEC})
endif("${FULL_PATH_EXEC}" STREQUAL "${${varname_root}_EXECUTABLE}")
endif("${SUBBUILD_TEST}" STREQUAL "0")
endif(${varname_root}_EXECUTABLE)
# 2. If any of the required flags are off, this tool is a no-go.
set(DISABLE_STR "")
foreach(item ${TP_REQUIRED_VARS})
if(NOT ${item})
set(TP_DISABLED 1)
set(TP_DISABLE_TEST 1)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
if(NOT DISABLE_STR)
set(DISABLE_STR "${item}")
else(NOT DISABLE_STR)
set(DISABLE_STR "${DISABLE_STR},${item}")
endif(NOT DISABLE_STR)
endif(NOT ${item})
endforeach(item ${TP_REQUIRED_VARS})
if(DISABLE_STR)
set(${CMAKE_PROJECT_NAME}_${varname_root} "DISABLED ${DISABLE_STR}" CACHE STRING "DISABLED ${DISABLED_STR}" FORCE)
mark_as_advanced(FORCE ${CMAKE_PROJECT_NAME}_${varname_root})
set(${varname_root}_MET_CONDITION 1)
else(DISABLE_STR)
# If we have a leftover disabled setting in the cache from earlier runs, clear it.
if("${local_opt}" MATCHES "DISABLED")
set(${CMAKE_PROJECT_NAME}_${varname_root} "" CACHE STRING "Clear DISABLED setting" FORCE)
mark_as_advanced(CLEAR ${CMAKE_PROJECT_NAME}_${varname_root})
endif("${local_opt}" MATCHES "DISABLED")
endif(DISABLE_STR)
# 3. Next - is the executable variable explicitly set to SYSTEM? If it is, we are NOT building it.
if(local_opt)
if("${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(TP_MET_CONDITION 2)
if(TP_NOSYS)
message(WARNING "Compilation of ${build_target} was disabled, but local copy is modified - using a system version of ${build_target} may introduce problems or even fail to work!")
endif(TP_NOSYS)
endif("${local_opt}" STREQUAL "SYSTEM")
endif(local_opt)
# 4. If we have a NOSYS flag, ALWAYS* use the bundled version. The NOSYS flag signifies that
# the BRL-CAD project requires modifications in the local src/other version of a library or
# tool that are not likely to be present in a system version. These flags should be periodically
# reviewed to determine if they can be removed (i.e. system packages have appeared in modern
# OS distributions with the fixes needed by BRL-CAD...).
#
# * In the case of executables, we'll allow a cached value from the user to override the NOSYS
# flag, since that's a likely scenario for testing, but that shouldn't be done except for testing
# purposes with a NOSYS target.
if(NOT TP_MET_CONDITION AND TP_NOSYS)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED" CACHE STRING "NOSYS passed, using bundled ${build_target}" FORCE)
mark_as_advanced(${CMAKE_PROJECT_NAME}_${varname_root})
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_MET_CONDITION 3)
set(TP_DISABLE_TEST 1)
endif(NOT TP_MET_CONDITION AND TP_NOSYS)
# 5. If we have an explicit BUNDLE request for this particular executable, honor it as long as
# features are satisfied. No point in testing if we know we're turning it on - set vars accordingly.
if(NOT TP_MET_CONDITION AND "${local_opt}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_DISABLE_TEST 1)
set(TP_MET_CONDITION 4)
endif(NOT TP_MET_CONDITION AND "${local_opt}" STREQUAL "BUNDLED")
# 5. If BRLCAD_BUNDLED_LIBS is exactly SYSTEM or exactly BUNDLED, and we haven't been overridden by
# one of the other conditions above, go with that.
if(NOT TP_MET_CONDITION)
if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root} "${BRLCAD_BUNDLED_LIBS} (AUTO)" CACHE STRING "BRLCAD_BUNDLED_LIBS: ${BRLCAD_BUNDLED_LIBS}" FORCE)
if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(TP_MET_CONDITION 5)
elseif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_DISABLE_TEST 1)
set(TP_MET_CONDITION 5)
endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
endif(NOT TP_MET_CONDITION)
# If we haven't been knocked out by any of the above conditions, do our testing and base the results on that.
if(NOT TP_DISABLE_TEST)
# Stash the previous results (if any) so we don't repeatedly call out the tests - only report
# if something actually changes in subsequent runs.
set(${varname_root}_FOUND_STATUS ${${varname_root}_FOUND})
# Initialize (or rather, uninitialize) variables in preparation for search
set(${varname_root}_FOUND "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_FOUND" FORCE)
mark_as_advanced(${varname_root}_FOUND)
set(${varname_root}_EXECUTABLE "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_EXECUTABLE" FORCE)
# Be quiet if we're doing this over
if("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
set(${varname_root}_FIND_QUIETLY TRUE)
endif("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
# Include the Find module for the executable in question
if(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
include(${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
else(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
include(${CMAKE_ROOT}/Modules/Find${varname_root}.cmake)
endif(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
# going to use system or bundled versions of deps
if(${varname_root}_FOUND)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "Found System version, using" FORCE)
else(${varname_root}_FOUND)
# If one of our previous conditions precludes building this library, we've got a problem unless the
# cached version is suitable - check that before we warn.
if(NOT "${local_opt}" STREQUAL "SYSTEM" AND NOT "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED (AUTO)" CACHE STRING "System test failed, enabling local copy" FORCE)
endif(NOT "${local_opt}" STREQUAL "SYSTEM" AND NOT "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
endif(${varname_root}_FOUND)
endif(NOT TP_DISABLE_TEST)
# Now that we've run the Find routine, see if we had a cached value different from any of our
# standard results
set(TP_USING_CACHED 0)
if(NOT "${TP_MET_CONDITION}" STREQUAL "1" AND NOT "${TP_MET_CONDITION}" STREQUAL "4")
if(EXEC_CACHED)
# Is it a build target? If so, don't cache it.
get_filename_component(EXEC_CACHED_ABS_PATH ${EXEC_CACHED} ABSOLUTE)
IF ("${EXEC_CACHED_ABS_PATH}" STREQUAL "${PATH_ABS}")
# Is it the bundled path? (don't override if it is, the bundled option setting takes care of that)
if(NOT "${EXEC_CACHED}" STREQUAL "${CMAKE_BINARY_DIR}/${BIN_DIR}/${build_target}")
# Is it the same as the found results?
if(NOT "${EXEC_CACHED}" STREQUAL "${${varname_root}_EXECUTABLE_FOUND_RESULT}")
set(${varname_root}_EXECUTABLE ${EXEC_CACHED} CACHE STRING "Apparently a user specified path was supplied, use it" FORCE)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "Apparently a user specified path was supplied, use it" FORCE)
set(TP_USING_CACHED 1)
endif(NOT "${EXEC_CACHED}" STREQUAL "${${varname_root}_EXECUTABLE_FOUND_RESULT}")
endif(NOT "${EXEC_CACHED}" STREQUAL "${CMAKE_BINARY_DIR}/${BIN_DIR}/${build_target}")
endif("${EXEC_CACHED_ABS_PATH}" STREQUAL "${PATH_ABS}")
endif(EXEC_CACHED)
endif(NOT "${TP_MET_CONDITION}" STREQUAL "1" AND NOT "${TP_MET_CONDITION}" STREQUAL "4")
# If the CACHED value doesn't look good, and we aren't overridden by any of the other conditions, set based
# on the test results
if(NOT TP_USING_CACHED AND NOT TP_DISABLE_TEST)
if(${varname_root}_FOUND)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
if(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "Found System version, using" FORCE)
endif(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
else(${varname_root}_FOUND)
# If one of our previous conditions precludes building this exec, we've got a problem.
if("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root}_NOTFOUND 1)
message(WARNING "Compilation of local version of ${build_target} was disabled, but system version not found!")
if(NOT "${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "BRLCAD_BUNDLED_LIBS forced to SYSTEM, but library not found!" FORCE)
else(NOT "${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM" CACHE STRING "Hard-set to SYSTEM by user, but library not found!" FORCE)
endif(NOT "${local_opt}" STREQUAL "SYSTEM")
else("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED (AUTO)" CACHE STRING "System test failed, enabling local copy" FORCE)
endif("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
endif(${varname_root}_FOUND)
endif(NOT TP_USING_CACHED AND NOT TP_DISABLE_TEST)
if(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
# In the case of executables, it is possible that a directory may define more than one
# executable target. If this is the case, we may have already added this directory -
# if so, don't do it again.
if(SRC_OTHER_ADDED_DIRS)
list(FIND SRC_OTHER_ADDED_DIRS ${dir} ADDED_RESULT)
if("${ADDED_RESULT}" STREQUAL "-1")
add_subdirectory(${dir})
set(SRC_OTHER_ADDED_DIRS ${SRC_OTHER_ADDED_DIRS} ${dir})
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)
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)
endif(SRC_OTHER_ADDED_DIRS)
if(CMAKE_CONFIGURATION_TYPES)
set(${varname_root}_EXECUTABLE "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${BIN_DIR}/${build_target}" CACHE STRING "${varname_root}_EXECUTABLE" FORCE)
else(CMAKE_CONFIGURATION_TYPES)
set(${varname_root}_EXECUTABLE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${build_target}" CACHE STRING "${varname_root}_EXECUTABLE" FORCE)
endif(CMAKE_CONFIGURATION_TYPES)
set(${varname_root}_EXECUTABLE_TARGET ${build_target} CACHE STRING "Build target for ${build_target}" FORCE)
else(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
set(${varname_root}_EXECUTABLE_TARGET "" CACHE STRING "No build target for ${build_target}" FORCE)
endif(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
if (TP_ALIASES AND TP_DESCRIPTION)
BRLCAD_OPTION("${CMAKE_PROJECT_NAME}_${varname_root}" "${${CMAKE_PROJECT_NAME}_${varname_root}}"
TYPE ABS
ALIASES ${TP_ALIASES}
DESCRIPTION "${TP_DESCRIPTION}")
endif (TP_ALIASES AND TP_DESCRIPTION)
mark_as_advanced(${varname_root}_EXECUTABLE)
mark_as_advanced(${varname_root}_EXECUTABLE_TARGET)
mark_as_advanced(${varname_root}_FOUND)
endfunction(THIRD_PARTY_EXECUTABLE)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-405
View File
@@ -1,405 +0,0 @@
# T H I R D P A R T Y _ T C L . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# The question of whether and when to build Tcl/Tk extensions is among
# the most complex issues in BRL-CAD's build logic. In order of priority,
# these are the factors considered when evaluating whether to compile
# a Tcl/Tk extension:
#
# 1. Are the variables listed in required_vars enabled? If one or more
# of them is not, there is never any point in building or searching for
# packages requiring those variables. Examples of variables used here
# include BRLCAD_ENABLE_TK and BRLCAD_ENABLE_OPENGL. If the BRLCAD_<PKG>
# variable is set to SYSTEM, the only impact this will have if triggered
# is to disable the execution of the system test.
# 2. Is the extension variable set to SYSTEM explicitly? If so, the
# extension will not be built under any circumstances. Whether it
# is tested for depends on condition 1 above. If it is tested for and
# not detected (e.g. BRL-CAD's Tk features are enabled and Tkhtml
# is not found) a BRLCAD_<PKG>_NOTFOUND variable will be set, but
# the extension will not be enabled.
# 3. Is the extension variable set to BUNDLED explicitly? If so, only
# a disabled required_vars variable will disable it, and only then if
# the extension requires that variable.
# 4. If BRLCAD_TCL has been set explicitly to SYSTEM (not automatically
# as a consequence of detecting it in an AUTO search) Tcl/Tk
# extensions will also need to be SYSTEM unless explicitly enabled
# by their own BRLCAD_<PKG> variable (condition 3 above). If not
# found, BRLCAD_<PKG>_NOTFOUND will also be set in this instance.
# 5. If BRLCAD_TCL has been automatically set to SYSTEM as a consequence
# of BRLCAD_BUNDLED_LIBS being set to SYSTEM, the situation is
# regarded as identical to condition 4 above. If not found,
# BRLCAD_<PKG>_NOTFOUND will also be set in this instance.
# 6. If BRLCAD_TCL_BUILD is ON (either because BRLCAD_TCL is set to
# BUNDLED explicitly, because it has been set to BUNDLED (Auto) due
# to BRLCAD_BUNDLED_LIBS being set to BUNDLED, or because the AUTO
# search failed to find an acceptable Tcl on the system) Tcl/Tk
# extensions also default to ON, subject to the above conditions.
# If the extension has been forced to OFF for any reason other than
# a feature-based disabling and BRLCAD_TCL is hard-set to
# bundled (or BRLCAD_BUNDLED_LIBS is set to BUNDLED and BRLCAD_TCL
# is not hard-set to SYSTEM) CMake will FATAL_ERROR - using a system
# package when we're NOT using a system Tcl/Tk is probably not
# workable - even if it somehow compiled and ran, the probability
# of subtle issues would be high.
# 7. If none of the above conditions preclude the usefulness of doing
# so, test the available Tcl/Tk to see if it supplies the package
# in question. If NEEDS_LIBS is populated, the Tcl/Tk "package require"
# mechanism is not enough and a system version of the package must
# also have locatable C libraries If a system version is found that
# satisfies all criteria, compilation of the extension is disabled -
#
# Note: For the time being, this routine does not attempt to address
# the problem of header identification. In principle it should do so,
# but the current reality is that oftentimes "private" headers will be
# needed by BRL-CAD when using Tcl/Tk extensions - these headers may
# not be installed on system versions of packages, or may be in
# non-standard places if they are. In those situations, if the system
# version of the Tcl/Tk package in question is compatible with the
# copy in src/other (usually the case, since BRL-CAD requires a fairly
# modern Tcl/Tk to work), the build can use the system package with
# the *local* copy of the package's private headers, even when building
# with system extensions. This is sub-optimal, and eventually logic
# should be added to
#-----------------------------------------------------------------------------
macro(THIRD_PARTY_TCL_PACKAGE pkgname dir wishcmd depends required_vars NEEDS_LIBS aliases description)
# Get uppercase version of pkg string
string(TOUPPER ${pkgname} PKGNAME_UPPER)
# If the pkg variable has been explicitly set, get
# an uppercase version of it for easier matching
if(NOT ${${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}} STREQUAL "")
string(TOUPPER "${${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}}" OPT_STR_UPPER)
else(NOT ${${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}} STREQUAL "")
set(OPT_STR_UPPER "")
endif(NOT ${${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}} 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 "")
# Initialize some variables
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD "?")
set(${PKGNAME_UPPER}_DISABLED 0)
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 "")
foreach(item ${required_vars})
if(NOT ${item})
set(${PKGNAME_UPPER}_DISABLED 1)
set(${PKGNAME_UPPER}_DISABLE_TEST 1)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD OFF)
if(NOT DISABLE_STR)
set(DISABLE_STR "${item}")
else(NOT DISABLE_STR)
set(DISABLE_STR "${DISABLE_STR},${item}")
endif(NOT DISABLE_STR)
endif(NOT ${item})
endforeach(item ${required_vars})
if(DISABLE_STR)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "DISABLED ${DISABLE_STR}" CACHE STRING "DISABLED ${DISABLED_STR}" FORCE)
mark_as_advanced(FORCE ${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER})
set(${PKGNAME_UPPER}_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}_${PKGNAME_UPPER}" MATCHES "DISABLED")
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "" CACHE STRING "Clear DISABLED setting" FORCE)
mark_as_advanced(CLEAR ${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER})
endif("${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}" MATCHES "DISABLED")
endif(DISABLE_STR)
# 2. Next - is the pkg explicitly set to system? If it is,
# we are NOT building it.
if(OPT_STR_UPPER)
if("${OPT_STR_UPPER}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "SYSTEM" CACHE STRING "User forced to SYSTEM" FORCE)
set(${PKGNAME_UPPER}_MET_CONDITION 2)
endif("${OPT_STR_UPPER}" STREQUAL "SYSTEM")
endif(OPT_STR_UPPER)
# 3. If we have an explicit BUNDLE request for this particular extension,
# 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 ${PKGNAME_UPPER}_MET_CONDITION)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "BUNDLED" CACHE STRING "User forced to BUNDLED" FORCE)
set(${PKGNAME_UPPER}_DISABLE_TEST 1)
set(${PKGNAME_UPPER}_MET_CONDITION 3)
endif(NOT ${PKGNAME_UPPER}_MET_CONDITION)
endif("${OPT_STR_UPPER}" STREQUAL "BUNDLED")
endif(OPT_STR_UPPER)
# 4. If BRLCAD_TCL is *exactly* SYSTEM and we aren't already enabled,
# compilation is off. (Testing depends on #1).
if("${${CMAKE_PROJECT_NAME}_TCL}" STREQUAL "SYSTEM")
if(NOT ${PKGNAME_UPPER}_MET_CONDITION)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "SYSTEM (AUTO)" CACHE STRING "From ${CMAKE_PROJECT_NAME}_TCL - SYSTEM" FORCE)
set(${PKGNAME_UPPER}_MET_CONDITION 4)
endif(NOT ${PKGNAME_UPPER}_MET_CONDITION)
endif("${${CMAKE_PROJECT_NAME}_TCL}" STREQUAL "SYSTEM")
# 5. If BRLCAD_TCL matches SYSTEM and BRLCAD_BUNDLED_LIBS is *exactly*
# SYSTEM, compilation is off. (Testing depends on #1).
if("${${CMAKE_PROJECT_NAME}_TCL}" MATCHES "SYSTEM" AND "${${CMAKE_PROJECT_NAME}_BUNDLED_LIBS}" STREQUAL "SYSTEM")
if(NOT ${PKGNAME_UPPER}_MET_CONDITION)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "SYSTEM (AUTO)" CACHE STRING "From ${CMAKE_PROJECT_NAME}_BUNDLED_LIBS - SYSTEM" FORCE)
set(${PKGNAME_UPPER}_MET_CONDITION 5)
endif(NOT ${PKGNAME_UPPER}_MET_CONDITION)
endif("${${CMAKE_PROJECT_NAME}_TCL}" MATCHES "SYSTEM" AND "${${CMAKE_PROJECT_NAME}_BUNDLED_LIBS}" STREQUAL "SYSTEM")
# 6. If we're building Tcl itself (for whatever reason) and we aren't
# already off, default to compilation. If we're building, no point
# in testing - disable.
if(${CMAKE_PROJECT_NAME}_TCL_BUILD)
if(NOT ${PKGNAME_UPPER}_MET_CONDITION)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD ON)
set(${PKGNAME_UPPER}_DISABLE_TEST 1)
set(${PKGNAME_UPPER}_MET_CONDITION 6)
endif(NOT ${PKGNAME_UPPER}_MET_CONDITION)
endif(${CMAKE_PROJECT_NAME}_TCL_BUILD)
# Check for the bizarre case of bundled Tcl + system package - error out if that
# combination has been specified, since there is no expectation that a package
# provided for a system installation of Tcl/Tk would work with BRL-CAD's local
# copy. If the feature was disabled it doesn't matter, since that's a
# "disabled" condition instead of a SYSTEM condition. If we don't hit such a
# case, properly set ${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}
if(NOT ${PKGNAME_UPPER}_DISABLED)
if(${CMAKE_PROJECT_NAME}_TCL_BUILD)
if(NOT ${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
message(FATAL_ERROR "Local Tcl compilation enabled, but compilation of Tcl/Tk extension ${pkgname} has been disabled - unsupported configuration!")
else(NOT ${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "BUNDLED (AUTO)" CACHE STRING "From ${CMAKE_PROJECT_NAME}_TCL - BUNDLED" FORCE)
endif(NOT ${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
endif(${CMAKE_PROJECT_NAME}_TCL_BUILD)
endif(NOT ${PKGNAME_UPPER}_DISABLED)
# 7. If none of the above conditions preclude us from doing so, start
# testing.
if(NOT ${PKGNAME_UPPER}_DISABLE_TEST)
# Initialize test tracking variable
set(${PKGNAME_UPPER}_TEST_FAIL 0)
set(${PKGNAME_UPPER}_TCL_PASSED 0)
set(${PKGNAME_UPPER}_LIBS_FAIL 0)
# 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(${PKGNAME_UPPER}_FOUND_STATUS ${${PKGNAME_UPPER}_FOUND})
# 1. If we have no wish command, we fail immediately.
if("${wishcmd}" STREQUAL "" OR "${wishcmd}" MATCHES "NOTFOUND")
message(WARNING "Test for ${pkgname} failed - no tclsh/wish command available for testing!")
set(${PKGNAME_UPPER}_TEST_FAIL 1)
endif("${wishcmd}" STREQUAL "" OR "${wishcmd}" MATCHES "NOTFOUND")
# 2. We have wish - now things get interesting. Write out
# a Tcl script to probe for information on the package we're
# interested in, and collect the results.
if(NOT ${PKGNAME_UPPER}_TEST_FAIL)
set(CURRENT_TCL_PACKAGE_NAME ${pkgname})
set(pkg_test_file "${CMAKE_BINARY_DIR}/CMakeTmp/${pkgname}_version.tcl")
configure_file("${BRLCAD_SOURCE_DIR}/misc/CMake/tcltest.tcl.in" ${pkg_test_file} @ONLY)
DISTCLEAN("${pkg_test_file}")
EXEC_PROGRAM(${wishcmd} ARGS ${pkg_test_file} OUTPUT_VARIABLE EXECOUTPUT)
file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/${PKGNAME_UPPER}_PKG_VERSION" pkgversion)
string(REGEX REPLACE "\n" "" ${PKGNAME_UPPER}_PACKAGE_VERSION ${pkgversion})
if(${PKGNAME_UPPER}_PACKAGE_VERSION)
set(${PKGNAME_UPPER}_TCL_PASSED 1)
else(${PKGNAME_UPPER}_PACKAGE_VERSION)
set(${PKGNAME_UPPER}_TCL_PASSED 0)
endif(${PKGNAME_UPPER}_PACKAGE_VERSION)
endif(NOT ${PKGNAME_UPPER}_TEST_FAIL)
# 3. After 2, we *almost* know what to do. Check if we need to base
# the decision on C libraries and headers, as well. If we didn't pass
# the package version test, then the libraries and headers are moot -
# we can't assume the package is set up correctly, and need to build
# our own or report find failure, as the case may be.
#
# It might be that the variables we need have already been set by
# another routine (FindTCL.cmake, for example, does some sophisticated
# work to set the correct library paths for Tk as part of its search)
# The user might also be setting variables manually to identify locations
# outside normal search parameters. On the other hand, if we are changing
# CMake build settings, we don't want to let build-target settings satisfy
# the requirements.
#
# To handle this, each library variable is first checked to see if it's
# full path expansion matches the default variable setting. If so, accept
# the setting. If not, the setting is assumed to be a build target from
# a bundled configuration and cleared. (If the bundled sources are built
# in the end, they will be restored.)
if(${PKGNAME_UPPER}_TCL_PASSED)
if(NOT "${NEEDS_LIBS}" STREQUAL "")
# We have libraries to find - let's get started.
foreach(libname ${NEEDS_LIBS})
# get the uppercase version of the lib name
string(TOUPPER "${libname}" LIBNAME_UPPER)
# deduce the variable to hold the library results
if(${LIBNAME_UPPER} STREQUAL ${PKGNAME_UPPER})
set(LOOKFOR_LIBRARY "${PKGNAME_UPPER}_LIBRARY")
set(CORENAME ${pkgname})
else(${LIBNAME_UPPER} STREQUAL ${PKGNAME_UPPER})
set(LOOKFOR_LIBRARY "${PKGNAME_UPPER}_${LIBNAME_UPPER}_LIBRARY")
set(CORENAME ${libname})
endif(${LIBNAME_UPPER} STREQUAL ${PKGNAME_UPPER})
set(${PKGNAME_UPPER}_REQUIRED_LIBS ${${PKGNAME_UPPER}_REQUIRED_LIBS} ${${LOOKFOR_LIBRARY}})
# Check if this variable has already been set, and if
# so put it to the full path test
if(${LOOKFOR_LIBRARY})
get_filename_component(PATH_ABS ${${LOOKFOR_LIBRARY}} ABSOLUTE)
if(NOT "${${LOOKFOR_LIBRARY}}" STREQUAL "${PATH_ABS}")
set(${LOOKFOR_LIBRARY} "NOTFOUND" CACHE STRING "RESET" FORCE)
endif(NOT "${${LOOKFOR_LIBRARY}}" STREQUAL "${PATH_ABS}")
endif(${LOOKFOR_LIBRARY})
# If we don't already have a library value, go looking
if(NOT ${LOOKFOR_LIBRARY} OR "${${LOOKFOR_LIBRARY}}" MATCHES "NOTFOUND")
find_library(${LOOKFOR_LIBRARY} NAMES ${libname} ${libname}${${PKGNAME_UPPER}_PACKAGE_VERSION} PATH_SUFFIXES ${libname}${${PKGNAME_UPPER}_PACKAGE_VERSION} ${pkgname}${${PKGNAME_UPPER}_PACKAGE_VERSION})
endif(NOT ${LOOKFOR_LIBRARY} OR "${${LOOKFOR_LIBRARY}}" MATCHES "NOTFOUND")
# If we didn't find anything, we've failed to satisfy
# the package requirements
if(NOT ${LOOKFOR_LIBRARY})
set(${PKGNAME_UPPER}_LIBS_FAIL 1)
endif(NOT ${LOOKFOR_LIBRARY})
mark_as_advanced(${LOOKFOR_LIBRARY})
endforeach(libname ${NEEDS_LIBS})
endif(NOT "${NEEDS_LIBS}" STREQUAL "")
endif(${PKGNAME_UPPER}_TCL_PASSED)
endif(NOT ${PKGNAME_UPPER}_DISABLE_TEST)
# After all that, we finally know what to do - do it.
string(TOLOWER ${pkgname} PKGNAME_LOWER)
# If testing was disabled, we only care what the _BUILD variable says.
if(${PKGNAME_UPPER}_DISABLE_TEST)
if(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
add_subdirectory(${dir})
foreach(dep ${depends})
string(TOUPPER ${dep} DEP_UPPER)
if(BRLCAD_BUILD_${DEP_UPPER})
add_dependencies(${pkgname} ${dep})
endif(BRLCAD_BUILD_${DEP_UPPER})
endforeach(dep ${depends})
endif(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
endif(${PKGNAME_UPPER}_DISABLE_TEST)
# If testing was NOT disabled, but we're forced to system, see if we
# need to complain about not finding what we need - we can't enable, so
# complain. This situation is not as dangerous as the potential subtle
# issues with system pkg + local Tcl, so we won't FATAL_ERROR - just
# warn and let things proceed.
if(NOT ${PKGNAME_UPPER}_DISABLE_TEST)
if(${PKGNAME_UPPER}_MET_CONDITION STREQUAL "4" OR ${PKGNAME_UPPER}_MET_CONDITION STREQUAL "5")
if(${PKGNAME_UPPER}_TEST_FAIL OR ${PKGNAME_UPPER}_LIBS_FAIL OR NOT ${PKGNAME_UPPER}_TCL_PASSED)
set(BRLCAD_${PKGNAME_UPPER}_NOTFOUND 1)
if(NOT "${wishcmd}" STREQUAL "" AND NOT "${wishcmd}" MATCHES "NOTFOUND")
message(WARNING "Local compilation of Tcl/Tk extension ${pkgname} was disabled, but system version not found!")
endif(NOT "${wishcmd}" STREQUAL "" AND NOT "${wishcmd}" MATCHES "NOTFOUND")
endif(${PKGNAME_UPPER}_TEST_FAIL OR ${PKGNAME_UPPER}_LIBS_FAIL OR NOT ${PKGNAME_UPPER}_TCL_PASSED)
endif(${PKGNAME_UPPER}_MET_CONDITION STREQUAL "4" OR ${PKGNAME_UPPER}_MET_CONDITION STREQUAL "5")
endif(NOT ${PKGNAME_UPPER}_DISABLE_TEST)
# If testing was NOT disable, and none of the MET_CONDITIONs are satisfied,
# we base our decision on the test results.
if(NOT ${PKGNAME_UPPER}_MET_CONDITION)
if(NOT ${PKGNAME_UPPER}_TEST_FAIL)
if(NOT ${PKGNAME_UPPER}_LIBS_FAIL)
if(${PKGNAME_UPPER}_TCL_PASSED)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "SYSTEM (AUTO)" CACHE STRING "Detection based - SYSTEM" FORCE)
else(${PKGNAME_UPPER}_TCL_PASSED)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "BUNDLED (AUTO)" CACHE STRING "Detection based - BUNDLED" FORCE)
endif(${PKGNAME_UPPER}_TCL_PASSED)
else(NOT ${PKGNAME_UPPER}_LIBS_FAIL)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "BUNDLED (AUTO)" CACHE STRING "Detection based - BUNDLED" FORCE)
endif(NOT ${PKGNAME_UPPER}_LIBS_FAIL)
else(NOT ${PKGNAME_UPPER}_TEST_FAIL)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER} "BUNDLED (AUTO)" CACHE STRING "Detection based - BUNDLED" FORCE)
endif(NOT ${PKGNAME_UPPER}_TEST_FAIL)
if(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
add_subdirectory(${dir})
foreach(dep ${depends})
string(TOUPPER ${dep} DEP_UPPER)
if(BRLCAD_BUILD_${DEP_UPPER})
add_dependencies(${pkgname} ${dep})
endif(BRLCAD_BUILD_${DEP_UPPER})
endforeach(dep ${depends})
endif(${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}_BUILD)
endif(NOT ${PKGNAME_UPPER}_MET_CONDITION)
BRLCAD_OPTION("${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}" "${${CMAKE_PROJECT_NAME}_${PKGNAME_UPPER}}"
TYPE ABS
ALIASES ${${aliases}}
DESCRIPTION "${description}")
endmacro(THIRD_PARTY_TCL_PACKAGE)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+62
View File
@@ -0,0 +1,62 @@
#include <cstdio>
#include <fstream>
#include <iostream>
#include <regex>
#include <string>
int main(int argc, const char **argv)
{
int verbose = @EXTPROJ_VERBOSE@;
std::smatch m;
std::string build_path("@CMAKE_BINARY_DIR@");
std::string install_path = std::string("@CMAKE_INSTALL_PREFIX@");
// Because the input path might be anything, we need to quote it for
// processing - see https://stackoverflow.com/a/40195721
std::regex schars { R"([-[\]{}()*+?.,\^$|#\s])" };
std::string bp_sanetized = std::regex_replace(build_path, schars, R"(\$&)");
std::regex build_path_regex(bp_sanetized);
if (argc < 1) {
std::cerr << "Error: no file specified for processing.\n";
return -1;
}
for (int i = 1; i < argc; i++) {
std::string cline;
std::string nfile_contents;
std::ifstream fs;
fs.open(argv[i]);
if (!fs.is_open()) {
std::cerr << "Error: file " << argv[i] << " could not be opened.\n";
return -1;
} else {
std::cerr << "-- Patching " << argv[i] << "\n";
}
while (std::getline(fs, cline)) {
std::string nline = std::regex_replace(cline, build_path_regex, install_path);
nfile_contents.append(nline);
nfile_contents.append("\n");
if (nline != cline && verbose > 1) {
std::cerr << " Changed line: " << cline << " -> " << nline << "\n";
}
}
fs.close();
std::ofstream ofs(argv[i], std::ios::trunc);
ofs << nfile_contents;
ofs.close();
}
}
// Local Variables:
// tab-width: 8
// mode: C++
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8
+58
View File
@@ -0,0 +1,58 @@
#include <cstdio>
#include <fstream>
#include <iostream>
#include <regex>
#include <string>
int main(int argc, const char **argv)
{
int verbose = @EXTPROJ_VERBOSE@;
std::regex old_rpath("-rpath,\\$\\{LIB_RUNTIME_DIR\\}");
if (argc < 3) {
std::cerr << "Error: no file specified for processing or missing RPATH to set.\n";
return -1;
}
std::string new_rpath = std::string("-rpath,") + std::string(argv[1]);
for (int i = 2; i < argc; i++) {
std::string cline;
std::string nfile_contents;
std::ifstream fs;
fs.open(argv[i]);
if (!fs.is_open()) {
std::cerr << "Error: file " << argv[i] << " could not be opened.\n";
return -1;
} else {
if (verbose) {
std::cerr << "Patching " << argv[i] << "\n";
}
}
while (std::getline(fs, cline)) {
std::string nline = std::regex_replace(cline, old_rpath, new_rpath);
nfile_contents.append(nline);
nfile_contents.append("\n");
if (nline != cline) {
if (verbose > 1) {
std::cerr << " Changed line: " << cline << " -> " << nline << "\n";
}
}
}
fs.close();
std::ofstream ofs(argv[i], std::ios::trunc);
ofs << nfile_contents;
ofs.close();
}
}
// Local Variables:
// tab-width: 8
// mode: C++
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8
@@ -32,21 +32,9 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
string(REPLACE "\\" "" TF_DIR ${TF_DIR})
string(REPLACE "\\" "" INST_DIR ${INST_DIR})
string(REPLACE "\\" "" WORKING_PKGFILE ${WORKING_PKGFILE})
string(REPLACE "\\" "" INSTALL_PKGFILE ${INSTALL_PKGFILE})
file(WRITE "${WORKING_PKGFILE}" "if {![package vsatisfies [package provide Tcl] 8.6]} return\n")
file(APPEND "${WORKING_PKGFILE}" "package ifneeded itcl ${pkgversion} [list load [file join $dir \"${TF_DIR}\" ${TF_NAME}] Itcl]\n")
file(APPEND "${WORKING_PKGFILE}" "package ifneeded Itcl ${pkgversion} [list load [file join $dir \"${TF_DIR}\" ${TF_NAME}] Itcl]\n")
file(WRITE "${INSTALL_PKGFILE}" "if {![package vsatisfies [package provide Tcl] 8.6]} return\n")
file(APPEND "${INSTALL_PKGFILE}" "package ifneeded itcl ${pkgversion} [list load [file join $dir .. .. \"${INST_DIR}\" ${TF_NAME}] Itcl]\n")
file(APPEND "${INSTALL_PKGFILE}" "package ifneeded Itcl ${pkgversion} [list load [file join $dir .. .. \"${INST_DIR}\" ${TF_NAME}] Itcl]\n")
get_filename_component(TFD "${TF_DIR}" REALPATH)
file(WRITE "${WORKING_PKGFILE}" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir \"${TFD}\" ${TF_NAME}] ${pkgname}]")
file(WRITE "${INSTALL_PKGFILE}" "package ifneeded ${pkgname} ${pkgversion} [list load [file join $dir .. .. \"${INST_DIR}\" ${TF_NAME}] ${pkgname}]")
# Local Variables:
# tab-width: 8
+158
View File
@@ -0,0 +1,158 @@
#include <cstdio>
#include <fstream>
#include <iostream>
#include <regex>
#include <string>
#include <vector>
static const char *sep = "/";
static const char *CMAKE_INSTALL_PREFIX = "@CMAKE_INSTALL_PREFIX@";
static const char *LIB_DIR = "@LIB_DIR@";
static const char *BIN_DIR = "@BIN_DIR@";
static const char *INCLUDE_DIR = "@INCLUDE_DIR@";
static const char *MAN_DIR = "@MAN_DIR@";
static const char *PKG_DIR = "tcl8.@TCL_MINOR_VERSION@";
static const char *TKTABLE_RUNTIME_DIR = "Tktable@TKTABLE_VERSION@";
static const char *ZLIB_NAME = "@ZLIB_NAME@";
static const char *DEFLATE_NAME = "@DEFLATE_NAME@";
int main(int argc, const char **argv)
{
int verbose = 1;
if (argc < 2) {
std::cerr << "Error: no file specified for processing or missing RPATH to set.\n";
return -1;
}
std::vector<std::regex> regexes;
std::vector<std::string> strings;
std::regex tcllib_regex("sizeof[(]TCL_LIBRARY[)]");
regexes.push_back(tcllib_regex);
std::string tcllib_new = std::string("sizeof(\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string("\")");
strings.push_back(tcllib_new);
std::regex tcllib2_regex("= TCL_LIBRARY;");
regexes.push_back(tcllib2_regex);
std::string tcllib2_new = std::string("= \"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string("\";");
strings.push_back(tcllib2_new);
std::regex tclpkg_regex("TCL_PACKAGE_PATH");
regexes.push_back(tclpkg_regex);
std::string tclpkg_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string(sep) + std::string(PKG_DIR) + std::string("\"");
strings.push_back(tclpkg_new);
std::regex run_libdir_regex("CFG_RUNTIME_LIBDIR");
regexes.push_back(run_libdir_regex);
std::string run_libdir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string("\"");
strings.push_back(run_libdir_new);
std::regex run_bindir_regex("CFG_RUNTIME_BINDIR");
regexes.push_back(run_bindir_regex);
std::string run_bindir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(BIN_DIR) + std::string("\"");
strings.push_back(run_bindir_new);
std::regex run_srcdir_regex("CFG_RUNTIME_SCRDIR");
regexes.push_back(run_srcdir_regex);
std::string run_srcdir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string(sep) + std::string(PKG_DIR) + std::string("\"");
strings.push_back(run_srcdir_new);
std::regex run_incdir_regex("CFG_RUNTIME_INCDIR");
regexes.push_back(run_incdir_regex);
std::string run_incdir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(INCLUDE_DIR) + std::string("\"");
strings.push_back(run_incdir_new);
std::regex run_mandir_regex("CFG_RUNTIME_DOCDIR");
regexes.push_back(run_mandir_regex);
std::string run_mandir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(MAN_DIR) + std::string("\"");
strings.push_back(run_mandir_new);
std::regex inst_libdir_regex("CFG_INSTALL_LIBDIR");
regexes.push_back(inst_libdir_regex);
std::string inst_libdir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string("\"");
strings.push_back(inst_libdir_new);
std::regex inst_bindir_regex("CFG_INSTALL_BINDIR");
regexes.push_back(inst_bindir_regex);
std::string inst_bindir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(BIN_DIR) + std::string("\"");
strings.push_back(inst_bindir_new);
std::regex inst_srcdir_regex("CFG_INSTALL_SCRDIR");
regexes.push_back(inst_srcdir_regex);
std::string inst_srcdir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string(sep) + std::string(PKG_DIR) + std::string("\"");
strings.push_back(inst_srcdir_new);
std::regex inst_incdir_regex("CFG_INSTALL_INCDIR");
regexes.push_back(inst_incdir_regex);
std::string inst_incdir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(INCLUDE_DIR) + std::string("\"");
strings.push_back(inst_incdir_new);
std::regex inst_mandir_regex("CFG_INSTALL_DOCDIR");
regexes.push_back(inst_mandir_regex);
std::string inst_mandir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(MAN_DIR) + std::string("\"");
strings.push_back(inst_mandir_new);
std::regex tbl_runtimedir_regex("TBL_RUNTIME_DIR");
regexes.push_back(tbl_runtimedir_regex);
std::string tbl_runtimedir_new = std::string("\"") + std::string(CMAKE_INSTALL_PREFIX) + std::string(sep) + std::string(LIB_DIR) + std::string(TKTABLE_RUNTIME_DIR) + std::string("\"");
strings.push_back(tbl_runtimedir_new);
std::regex zname_regex("for ac_lib in z");
regexes.push_back(zname_regex);
std::string zname_new = std::string("for ac_lib in ") + std::string(ZLIB_NAME);
strings.push_back(zname_new);
std::regex deflate_regex("deflateSetHeader");
regexes.push_back(deflate_regex);
std::string deflate_new = std::string(DEFLATE_NAME);
strings.push_back(deflate_new);
for (int i = 1; i < argc; i++) {
std::string cline;
std::string nfile_contents;
std::ifstream fs;
fs.open(argv[i]);
if (!fs.is_open()) {
std::cerr << "Error: file " << argv[i] << " could not be opened.\n";
return -1;
} else {
if (verbose) {
std::cerr << "Patching " << argv[i] << "\n";
}
}
while (std::getline(fs, cline)) {
std::string nline = cline;
for (size_t j = 0; j < regexes.size(); j++) {
if (strings[j].length() > 0) {
std::string nline2 = std::regex_replace(nline, regexes[j], strings[j]);
nline = nline2;
}
}
nfile_contents.append(nline);
nfile_contents.append("\n");
if (nline != cline) {
if (verbose > 1) {
std::cerr << " Changed line: " << cline << " -> " << nline << "\n";
}
}
}
fs.close();
std::ofstream ofs(argv[i], std::ios::trunc);
ofs << nfile_contents;
ofs.close();
}
}
// Local Variables:
// tab-width: 8
// mode: C++
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8
-8
View File
@@ -1,8 +0,0 @@
catch {package require @CURRENT_TCL_PACKAGE_NAME@}
set packageversion NOTFOUND
set packageversion [lindex [lsort -decreasing [package versions @CURRENT_TCL_PACKAGE_NAME@]] 0]
set filename "@CMAKE_BINARY_DIR@/CMakeTmp/@PKGNAME_UPPER@_PKG_VERSION"
set fileId [open $filename "w"]
puts $fileId $packageversion
close $fileId
exit
@@ -1,5 +1,5 @@
# Minimum required version of CMake
cmake_minimum_required(VERSION 3.1.3)
cmake_minimum_required(VERSION 3.12)
# Set CMake project name
project(SVN2GIT)
+1 -1
View File
@@ -1,5 +1,5 @@
# Minimum required version of CMake
cmake_minimum_required(VERSION 3.1.3)
cmake_minimum_required(VERSION 3.12)
# set CMake project name
project(repowork)
+8 -82
View File
@@ -18,6 +18,14 @@
# situations, CMake provides a variable CMAKE_CFG_INTDIR that will
# insert the correct logic for config-dependent paths.
include("${CMAKE_CURRENT_SOURCE_DIR}/Third_Party_Exec.cmake")
function(SetTargetFolder targetname folder)
if(TARGET ${targetname})
set_target_properties(${targetname} PROPERTIES FOLDER "${folder}")
endif(TARGET ${targetname})
endfunction(SetTargetFolder)
# Clear all pre-defined CMake flags
CLEAR_BUILD_FLAGS()
@@ -43,88 +51,6 @@ foreach(ITEM ${dlists})
CMAKEFILES(${dlist})
endforeach(ITEM ${dlists})
# For those wanting to use a system version of the LEMON parser
# generator from sqlite, remember that the presence of /usr/bin/lemon
# is not enough. LEMON needs a template file, lempar.c, and by
# default it needs it in the same directory as /usr/bin/lemon. The
# typical approach to avoiding that requirement is to patch lemon,
# like this Gentoo ebuild:
#
# http://gentoo-overlays.zugaina.org/gentoo-zh/portage/dev-util/lemon/
#
# LEMON packages for other major Linux/BSD distros will do the same.
# BRL-CAD's FindLEMON.cmake macros will look for the template file in
# the executable directory first, and if not there will check in
# /usr/share/lemon (the location used by several distributions.) If
# your distribution has a working lemon with the lempar.c template
# file in a custom location, specify the full path to the template
# with the variable LEMON_TEMPLATE - something like:
#
# cmake .. -DLEMON_TEMPLATE=/etc/lemon/lempar.c
#
# This is not to tell LEMON what template to use - that information is
# usually hardcoded in LEMON itself - but to let FindLEMON.cmake know
# there is a working LEMON installation.
set(LEMON_SKIP_INSTALL 1)
set(lemon_DESCRIPTION "
Option for enabling and disabling compilation of the lemon parser
provided with BRL-CAD's source distribution. Default is AUTO,
responsive to the toplevel BRLCAD_BUNDLED_LIBS option and testing
first for a system version if BRLCAD_BUNDLED_LIBS is also AUTO.
")
THIRD_PARTY_EXECUTABLE(lemon LEMON lemon REQUIRED "BRLCAD_LEVEL2" ALIASES "ENABLE_LEMON" DESCRIPTION lemon_DESCRIPTION)
if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED" OR "${BRLCAD_LEMON}" MATCHES "BUNDLED")
set(LEMON_TEMPLATE "${BRLCAD_SOURCE_DIR}/misc/tools/lemon/lempar.c" CACHE STRING "Lemon template file" FORCE)
set(LEMON_EXECUTABLE_TARGET "lemon" CACHE STRING "lemon target" FORCE)
endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED" OR "${BRLCAD_LEMON}" MATCHES "BUNDLED")
DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/lemon/Makefile)
# Make sure we load FindLEMON.cmake to be able to define LEMON targets.
include(${BRLCAD_CMAKE_DIR}/FindLEMON.cmake)
SetTargetFolder(lemon "Compilation Utilities")
SetTargetFolder(lempar_cp "Compilation Utilities")
set(RE2C_SKIP_INSTALL 1)
set(re2c_DESCRIPTION "
Option for enabling and disabling compilation of the re2c scanner
utility provided with BRL-CAD's source distribution. Default is AUTO,
responsive to the toplevel BRLCAD_BUNDLED_LIBS option and testing
first for a system version if BRLCAD_BUNDLED_LIBS is also AUTO.
")
THIRD_PARTY_EXECUTABLE(re2c RE2C re2c REQUIRED "BRLCAD_LEVEL2" ALIASES "ENABLE_RE2C" DESCRIPTION re2c_DESCRIPTION)
DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/re2c/Makefile)
DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/re2c/re2cParse_parser/parser.yy)
DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/re2c/re2cParse_bootstrap_parser/parser.yy)
SetTargetFolder(re2c "Compilation Utilities")
SetTargetFolder(re2c_bootstrap "Compilation Utilities")
# Make sure we load FindRE2C.cmake to be able to define RE2C targets.
include(${BRLCAD_CMAKE_DIR}/FindRE2C.cmake)
# Perplex is set up as a misc/tools sub-build, but at this time it is
# entirely a BRL-CAD effort and not distributed or maintained as its
# own project.
# For all BRL-CAD projects, we will use the perplex template in
# misc/tools/perplex
set(PERPLEX_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/perplex/perplex_template.c" CACHE STRING "Perplex template file" FORCE)
mark_as_advanced(PERPLEX_TEMPLATE)
set(PERPLEX_SKIP_INSTALL 1)
set(perplex_DESCRIPTION "
Option for enabling and disabling compilation of the perplex scanner
generator provided with BRL-CAD's source distribution. Default is
AUTO, responsive to the toplevel BRLCAD_BUNDLED_LIBS option and
testing first for a system version if BRLCAD_BUNDLED_LIBS is also
AUTO. perplex requires a working re2c.
")
THIRD_PARTY_EXECUTABLE(perplex PERPLEX perplex REQUIRED "BRLCAD_LEVEL2" ALIASES "ENABLE_PERPLEX" DESCRIPTION perplex_DESCRIPTION NOSYS)
# Make sure we load FindPERPLEX.cmake to be able to define PERPLEX targets.
include(${BRLCAD_CMAKE_DIR}/FindPERPLEX.cmake)
DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/perplex/Makefile)
DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/perplex/PERPLEX_parser/parser.y)
SetTargetFolder(perplex "Compilation Utilities")
SetTargetFolder(perplex_template_cp "Compilation Utilities")
# To enforce style guidelines rigorously, BRL-CAD bundles the
# Artistic Style code formatter. This tool is LGPLv3 licensed
+270
View File
@@ -0,0 +1,270 @@
function(THIRD_PARTY_EXECUTABLE dir varname_root build_target)
# Parse extra arguments
cmake_parse_arguments(TP "NOSYS" "" "REQUIRED_VARS;ALIASES;DESCRIPTION" ${ARGN})
# If the exec variable has been explicitly set, get
# an normalized version of it for easier matching
set(local_opt)
if(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
set(local_opt "${${CMAKE_PROJECT_NAME}_${varname_root}}")
endif(NOT ${${CMAKE_PROJECT_NAME}_${varname_root}} STREQUAL "")
VAL_NORMALIZE(local_opt ABS)
# Initialize some variables
set(TP_DISABLED 0)
set(TP_DISABLE_TEST 0)
set(TP_MET_CONDITION 0)
# 0. Whether or not we're building the sources, we are tracking the files
# that are supposed to be in the directory
get_filename_component(DIR_NAME "${dir}" NAME)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
message(FATAL_ERROR "Third party component ${DIR_NAME} does not have a dist file at \"${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist\"")
endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
include("${CMAKE_CURRENT_SOURCE_DIR}/${DIR_NAME}.dist")
CMAKEFILES_IN_DIR(${DIR_NAME}_ignore_files ${dir})
# 1. For executables, it is a reasonable use case that the developer manually specifies
# the location for an executable. It is tricky to distinguish this situation from
# a previously cached executable path resulting from a Find*.cmake script. The way
# we will proceed is to cache the value of ${varname_root}_EXECUTABLE if it is defined, and
# at the end check it against the results of running the THIRD_PARTY logic. If
# it matches neither pattern (Bundled or System) it is assumed that the value passed
# in is an intentional setting on the part of the developer. This has one potential
# drawback in that the *removal* of a system executable between searches could result
# in a previously cached system search result being identified as a user-specified
# result - to prevent that, the cached path is only used to override other results
# if the file it specifies actually exists. One additional wrinkle here - if the
# developer has hard-specified BUNDLED for this particular executable, even a user specified
# or cached value will be replaced with the local path. A feature based disablement
# of the tool also applies to the cached version.
if(${varname_root}_EXECUTABLE)
IS_SUBPATH("${CMAKE_BINARY_DIR}" "${${varname_root}_EXECUTABLE}" SUBBUILD_TEST)
if("${SUBBUILD_TEST}" STREQUAL "0")
get_filename_component(FULL_PATH_EXEC ${${varname_root}_EXECUTABLE} ABSOLUTE)
if("${FULL_PATH_EXEC}" STREQUAL "${${varname_root}_EXECUTABLE}")
if(EXISTS ${FULL_PATH_EXEC})
set(EXEC_CACHED ${${varname_root}_EXECUTABLE})
else(EXISTS ${FULL_PATH_EXEC})
# This path not being present may indicate the user specified a path
# and made a mistake doing so - warn that this might be the case.
message(WARNING "File path ${${varname_root}_EXECUTABLE} specified for ${varname_root}_EXECUTABLE does not exist - this path will not override ${build_target} executable search results.")
endif(EXISTS ${FULL_PATH_EXEC})
endif("${FULL_PATH_EXEC}" STREQUAL "${${varname_root}_EXECUTABLE}")
endif("${SUBBUILD_TEST}" STREQUAL "0")
endif(${varname_root}_EXECUTABLE)
# 2. If any of the required flags are off, this tool is a no-go.
set(DISABLE_STR "")
foreach(item ${TP_REQUIRED_VARS})
if(NOT ${item})
set(TP_DISABLED 1)
set(TP_DISABLE_TEST 1)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
if(NOT DISABLE_STR)
set(DISABLE_STR "${item}")
else(NOT DISABLE_STR)
set(DISABLE_STR "${DISABLE_STR},${item}")
endif(NOT DISABLE_STR)
endif(NOT ${item})
endforeach(item ${TP_REQUIRED_VARS})
if(DISABLE_STR)
set(${CMAKE_PROJECT_NAME}_${varname_root} "DISABLED ${DISABLE_STR}" CACHE STRING "DISABLED ${DISABLED_STR}" FORCE)
mark_as_advanced(FORCE ${CMAKE_PROJECT_NAME}_${varname_root})
set(${varname_root}_MET_CONDITION 1)
else(DISABLE_STR)
# If we have a leftover disabled setting in the cache from earlier runs, clear it.
if("${local_opt}" MATCHES "DISABLED")
set(${CMAKE_PROJECT_NAME}_${varname_root} "" CACHE STRING "Clear DISABLED setting" FORCE)
mark_as_advanced(CLEAR ${CMAKE_PROJECT_NAME}_${varname_root})
endif("${local_opt}" MATCHES "DISABLED")
endif(DISABLE_STR)
# 3. Next - is the executable variable explicitly set to SYSTEM? If it is, we are NOT building it.
if(local_opt)
if("${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(TP_MET_CONDITION 2)
if(TP_NOSYS)
message(WARNING "Compilation of ${build_target} was disabled, but local copy is modified - using a system version of ${build_target} may introduce problems or even fail to work!")
endif(TP_NOSYS)
endif("${local_opt}" STREQUAL "SYSTEM")
endif(local_opt)
# 4. If we have a NOSYS flag, ALWAYS* use the bundled version. The NOSYS flag signifies that
# the BRL-CAD project requires modifications in the local src/other version of a library or
# tool that are not likely to be present in a system version. These flags should be periodically
# reviewed to determine if they can be removed (i.e. system packages have appeared in modern
# OS distributions with the fixes needed by BRL-CAD...).
#
# * In the case of executables, we'll allow a cached value from the user to override the NOSYS
# flag, since that's a likely scenario for testing, but that shouldn't be done except for testing
# purposes with a NOSYS target.
if(NOT TP_MET_CONDITION AND TP_NOSYS)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED" CACHE STRING "NOSYS passed, using bundled ${build_target}" FORCE)
mark_as_advanced(${CMAKE_PROJECT_NAME}_${varname_root})
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_MET_CONDITION 3)
set(TP_DISABLE_TEST 1)
endif(NOT TP_MET_CONDITION AND TP_NOSYS)
# 5. If we have an explicit BUNDLE request for this particular executable, honor it as long as
# features are satisfied. No point in testing if we know we're turning it on - set vars accordingly.
if(NOT TP_MET_CONDITION AND "${local_opt}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_DISABLE_TEST 1)
set(TP_MET_CONDITION 4)
endif(NOT TP_MET_CONDITION AND "${local_opt}" STREQUAL "BUNDLED")
# 5. If BRLCAD_BUNDLED_LIBS is exactly SYSTEM or exactly BUNDLED, and we haven't been overridden by
# one of the other conditions above, go with that.
if(NOT TP_MET_CONDITION)
if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root} "${BRLCAD_BUNDLED_LIBS} (AUTO)" CACHE STRING "BRLCAD_BUNDLED_LIBS: ${BRLCAD_BUNDLED_LIBS}" FORCE)
if("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(TP_MET_CONDITION 5)
elseif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(TP_DISABLE_TEST 1)
set(TP_MET_CONDITION 5)
endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM")
endif("${BRLCAD_BUNDLED_LIBS}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL "BUNDLED")
endif(NOT TP_MET_CONDITION)
# If we haven't been knocked out by any of the above conditions, do our testing and base the results on that.
if(NOT TP_DISABLE_TEST)
# Stash the previous results (if any) so we don't repeatedly call out the tests - only report
# if something actually changes in subsequent runs.
set(${varname_root}_FOUND_STATUS ${${varname_root}_FOUND})
# Initialize (or rather, uninitialize) variables in preparation for search
set(${varname_root}_FOUND "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_FOUND" FORCE)
mark_as_advanced(${varname_root}_FOUND)
set(${varname_root}_EXECUTABLE "${varname_root}-NOTFOUND" CACHE STRING "${varname_root}_EXECUTABLE" FORCE)
# Be quiet if we're doing this over
if("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
set(${varname_root}_FIND_QUIETLY TRUE)
endif("${${varname_root}_FOUND_STATUS}" MATCHES "NOTFOUND")
# Include the Find module for the executable in question
if(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
include(${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
else(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
include(${CMAKE_ROOT}/Modules/Find${varname_root}.cmake)
endif(EXISTS ${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/Find${varname_root}.cmake)
# going to use system or bundled versions of deps
if(${varname_root}_FOUND)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "Found System version, using" FORCE)
else(${varname_root}_FOUND)
# If one of our previous conditions precludes building this library, we've got a problem unless the
# cached version is suitable - check that before we warn.
if(NOT "${local_opt}" STREQUAL "SYSTEM" AND NOT "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED (AUTO)" CACHE STRING "System test failed, enabling local copy" FORCE)
endif(NOT "${local_opt}" STREQUAL "SYSTEM" AND NOT "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
endif(${varname_root}_FOUND)
endif(NOT TP_DISABLE_TEST)
# Now that we've run the Find routine, see if we had a cached value different from any of our
# standard results
set(TP_USING_CACHED 0)
if(NOT "${TP_MET_CONDITION}" STREQUAL "1" AND NOT "${TP_MET_CONDITION}" STREQUAL "4")
if(EXEC_CACHED)
# Is it a build target? If so, don't cache it.
get_filename_component(EXEC_CACHED_ABS_PATH ${EXEC_CACHED} ABSOLUTE)
IF ("${EXEC_CACHED_ABS_PATH}" STREQUAL "${PATH_ABS}")
# Is it the bundled path? (don't override if it is, the bundled option setting takes care of that)
if(NOT "${EXEC_CACHED}" STREQUAL "${CMAKE_BINARY_DIR}/${BIN_DIR}/${build_target}")
# Is it the same as the found results?
if(NOT "${EXEC_CACHED}" STREQUAL "${${varname_root}_EXECUTABLE_FOUND_RESULT}")
set(${varname_root}_EXECUTABLE ${EXEC_CACHED} CACHE STRING "Apparently a user specified path was supplied, use it" FORCE)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "Apparently a user specified path was supplied, use it" FORCE)
set(TP_USING_CACHED 1)
endif(NOT "${EXEC_CACHED}" STREQUAL "${${varname_root}_EXECUTABLE_FOUND_RESULT}")
endif(NOT "${EXEC_CACHED}" STREQUAL "${CMAKE_BINARY_DIR}/${BIN_DIR}/${build_target}")
endif("${EXEC_CACHED_ABS_PATH}" STREQUAL "${PATH_ABS}")
endif(EXEC_CACHED)
endif(NOT "${TP_MET_CONDITION}" STREQUAL "1" AND NOT "${TP_MET_CONDITION}" STREQUAL "4")
# If the CACHED value doesn't look good, and we aren't overridden by any of the other conditions, set based
# on the test results
if(NOT TP_USING_CACHED AND NOT TP_DISABLE_TEST)
if(${varname_root}_FOUND)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD OFF)
if(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "Found System version, using" FORCE)
endif(NOT "${CMAKE_PROJECT_NAME}_${varname_root}" STREQUAL "SYSTEM")
else(${varname_root}_FOUND)
# If one of our previous conditions precludes building this exec, we've got a problem.
if("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root}_NOTFOUND 1)
message(WARNING "Compilation of local version of ${build_target} was disabled, but system version not found!")
if(NOT "${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM (AUTO)" CACHE STRING "BRLCAD_BUNDLED_LIBS forced to SYSTEM, but library not found!" FORCE)
else(NOT "${local_opt}" STREQUAL "SYSTEM")
set(${CMAKE_PROJECT_NAME}_${varname_root} "SYSTEM" CACHE STRING "Hard-set to SYSTEM by user, but library not found!" FORCE)
endif(NOT "${local_opt}" STREQUAL "SYSTEM")
else("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
set(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD ON)
set(${CMAKE_PROJECT_NAME}_${varname_root} "BUNDLED (AUTO)" CACHE STRING "System test failed, enabling local copy" FORCE)
endif("${local_opt}" STREQUAL "SYSTEM" OR "${BRLCAD_BUNDLED_LIBS}" STREQUAL SYSTEM)
endif(${varname_root}_FOUND)
endif(NOT TP_USING_CACHED AND NOT TP_DISABLE_TEST)
if(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
# In the case of executables, it is possible that a directory may define more than one
# executable target. If this is the case, we may have already added this directory -
# if so, don't do it again.
if(MISC_ADDED_DIRS)
list(FIND MISC_ADDED_DIRS ${dir} ADDED_RESULT)
if("${ADDED_RESULT}" STREQUAL "-1")
add_subdirectory(${dir})
set(MISC_ADDED_DIRS ${MISC_ADDED_DIRS} ${dir})
list(REMOVE_DUPLICATES MISC_ADDED_DIRS)
set(MISC_ADDED_DIRS ${MISC_ADDED_DIRS} CACHE STRING "Enabled 3rd party sub-directories" FORCE)
mark_as_advanced(MISC_ADDED_DIRS)
endif("${ADDED_RESULT}" STREQUAL "-1")
else(MISC_ADDED_DIRS)
add_subdirectory(${dir})
set(MISC_ADDED_DIRS ${dir} CACHE STRING "Enabled 3rd party sub-directories" FORCE)
mark_as_advanced(MISC_ADDED_DIRS)
endif(MISC_ADDED_DIRS)
if(CMAKE_CONFIGURATION_TYPES)
set(${varname_root}_EXECUTABLE "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${BIN_DIR}/${build_target}" CACHE STRING "${varname_root}_EXECUTABLE" FORCE)
else(CMAKE_CONFIGURATION_TYPES)
set(${varname_root}_EXECUTABLE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${build_target}" CACHE STRING "${varname_root}_EXECUTABLE" FORCE)
endif(CMAKE_CONFIGURATION_TYPES)
set(${varname_root}_EXECUTABLE_TARGET ${build_target} CACHE STRING "Build target for ${build_target}" FORCE)
else(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
set(${varname_root}_EXECUTABLE_TARGET "" CACHE STRING "No build target for ${build_target}" FORCE)
endif(${CMAKE_PROJECT_NAME}_${varname_root}_BUILD)
if (TP_ALIASES AND TP_DESCRIPTION)
BRLCAD_OPTION("${CMAKE_PROJECT_NAME}_${varname_root}" "${${CMAKE_PROJECT_NAME}_${varname_root}}"
TYPE ABS
ALIASES ${TP_ALIASES}
DESCRIPTION "${TP_DESCRIPTION}")
endif (TP_ALIASES AND TP_DESCRIPTION)
mark_as_advanced(${varname_root}_EXECUTABLE)
mark_as_advanced(${varname_root}_EXECUTABLE_TARGET)
mark_as_advanced(${varname_root}_FOUND)
endfunction(THIRD_PARTY_EXECUTABLE)
# Locac Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+34 -4
View File
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
set(_LEMON_SEARCHES)
# Search LEMON_ROOT first if it is set.
if(LEMON_ROOT)
set(_LEMON_SEARCH_ROOT PATHS ${LEMON_ROOT} NO_DEFAULT_PATH)
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_ROOT)
endif()
# Normal search.
set(_LEMON_x86 "(x86)")
set(_LEMON_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/lemon"
"$ENV{ProgramFiles${_LEMON_x86}}/lemon")
unset(_LEMON_x86)
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_NORMAL)
set(LEMON_NAMES lemon)
# Try each search configuration.
foreach(search ${_LEMON_SEARCHES})
find_program(LEMON_EXECUTABLE lemon ${${search}} PATH_SUFFIXES bin)
endforeach()
mark_as_advanced(LEMON_EXECUTABLE)
foreach(search ${_LEMON_SEARCHES})
find_file(LEMON_TEMPLATE lempar.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/lemon)
endforeach()
mark_as_advanced(LEMON_TEMPLATE)
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
# look for the template in share
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
@@ -113,6 +139,10 @@ if(NOT COMMAND LEMON_TARGET)
CMAKE_PARSE_ARGUMENTS(${LVAR_PREFIX} "" "OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR;EXTRA_ARGS" "" ${ARGN})
endif(${ARGC} GREATER 3)
if (TARGET perplex_stage)
set(DEPS_TARGET perplex_stage)
endif (TARGET perplex_stage)
# Need a working directory
if("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
set(${LVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LVAR_PREFIX}")
@@ -161,7 +191,7 @@ if(NOT COMMAND LEMON_TARGET)
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
COMMAND ${CMAKE_COMMAND} -E copy ${lemon_in_file} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
DEPENDS ${Input} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
DEPENDS ${Input} ${LEMON_EXECUTABLE_TARGET} ${DEPS_TARGET}
WORKING_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR}
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
)
@@ -171,7 +201,7 @@ if(NOT COMMAND LEMON_TARGET)
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${${LVAR_PREFIX}_OUT_SRC_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE} ${DEPS_TARGET}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_SRC_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
@@ -179,7 +209,7 @@ if(NOT COMMAND LEMON_TARGET)
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_HDR_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${${LVAR_PREFIX}_OUT_HDR_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER} ${DEPS_TARGET}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_HDR_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
+34 -4
View File
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(PERPLEX_EXECUTABLE perplex DOC "path to the perplex executable")
set(_PERPLEX_SEARCHES)
# Search PERPLEX_ROOT first if it is set.
if(PERPLEX_ROOT)
set(_PERPLEX_SEARCH_ROOT PATHS ${PERPLEX_ROOT} NO_DEFAULT_PATH)
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_ROOT)
endif()
# Normal search.
set(_PERPLEX_x86 "(x86)")
set(_PERPLEX_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/perplex"
"$ENV{ProgramFiles${_PERPLEX_x86}}/perplex")
unset(_PERPLEX_x86)
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_NORMAL)
set(PERPLEX_NAMES perplex)
# Try each search configuration.
foreach(search ${_PERPLEX_SEARCHES})
find_program(PERPLEX_EXECUTABLE perplex ${${search}} PATH_SUFFIXES bin)
endforeach()
mark_as_advanced(PERPLEX_EXECUTABLE)
foreach(search ${_PERPLEX_SEARCHES})
find_file(PERPLEX_TEMPLATE perplex_template.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/perplex)
endforeach()
mark_as_advanced(PERPLEX_TEMPLATE)
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} PATH)
if(perplex_path)
@@ -141,6 +167,10 @@ if(NOT COMMAND PERPLEX_TARGET)
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
set(PVAR_PREFIX ${Name}_${IN_FILE_WE})
if (TARGET perplex_stage)
set(DEP_TARGET perplex_stage)
endif (TARGET perplex_stage)
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${PVAR_PREFIX} "" "TEMPLATE;OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR" "" ${ARGN})
endif(${ARGC} GREATER 3)
@@ -200,7 +230,7 @@ if(NOT COMMAND PERPLEX_TARGET)
OUTPUT ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${perplex_in_file} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${${PVAR_PREFIX}_OUT_HDR_FILE} -t ${${PVAR_PREFIX}_TEMPLATE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
DEPENDS ${Input} ${${PVAR_PREFIX}_TEMPLATE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
)
@@ -209,7 +239,7 @@ if(NOT COMMAND PERPLEX_TARGET)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
@@ -217,7 +247,7 @@ if(NOT COMMAND PERPLEX_TARGET)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
-6
View File
@@ -1,6 +0,0 @@
set(lemon_ignore_files
CMakeLists.txt
README
lemon.c
lempar.c
)
-33
View File
@@ -1,33 +0,0 @@
cmake_minimum_required(VERSION 3.14)
# set project name
PROJECT(LEMON)
# build the lemon binary
add_executable(lemon lemon.c)
# install the binary
if (NOT BIN_DIR)
set (BIN_DIR bin)
endif (NOT BIN_DIR)
if (NOT LEMON_SKIP_INSTALL)
install(TARGETS lemon DESTINATION ${BIN_DIR})
endif (NOT LEMON_SKIP_INSTALL)
# install the template
if (NOT DATA_DIR)
set (DATA_DIR share)
endif (NOT DATA_DIR)
if (NOT LEMON_SKIP_INSTALL)
install(FILES lempar.c DESTINATION ${DATA_DIR}/lemon)
endif (NOT LEMON_SKIP_INSTALL)
configure_file(lempar.c ${CMAKE_BINARY_DIR}/${DATA_DIR}/lemon COPYONLY)
DISTCLEAN(${CMAKE_BINARY_DIR}/${DATA_DIR}/lemon)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-15
View File
@@ -1,15 +0,0 @@
set(perplex_ignore_files
CHANGELOG.txt
CMake/FindLEMON.cmake
CMake/FindRE2C.cmake
CMakeLists.txt
README.txt
mbo_getopt.cpp
mbo_getopt.h
parser.y
perplex.cpp
perplex.h
perplex_template.c
scanner.re
token_type.h
)
-4
View File
@@ -1,4 +0,0 @@
Version 1.0.1 (2014-06-24)
--------------------------
* Fixed a casting bug in perplex_template.c. Benign on most systems, but
triggered a warning from some compilers.
-112
View File
@@ -1,112 +0,0 @@
# C M A K E L I S T S . T X T
#
# Perplex - re2c scanner input generator
#
# Copyright (c) 2012-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
cmake_minimum_required(VERSION 3.14)
project(PERPLEX)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
set(PERPLEX_CMAKE_DIR "${PERPLEX_SOURCE_DIR}/CMake")
if(PERPLEX_IS_SUBBUILD)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PERPLEX_CMAKE_DIR}")
else(PERPLEX_IS_SUBBUILD)
set(CMAKE_MODULE_PATH "${PERPLEX_CMAKE_DIR};${CMAKE_MODULE_PATH}")
endif(PERPLEX_IS_SUBBUILD)
FIND_PACKAGE(LEMON)
FIND_PACKAGE(RE2C)
if(NOT LEMON_EXECUTABLE OR NOT RE2C_EXECUTABLE)
message(FATAL_ERROR "Perplex requires the LEMON Parser Generator and the re2c scanner generator.")
endif(NOT LEMON_EXECUTABLE OR NOT RE2C_EXECUTABLE)
RE2C_TARGET(PERPLEX scanner.re ${CMAKE_CURRENT_BINARY_DIR}/scanner.c COMPILE_FLAGS "-c")
LEMON_TARGET(PERPLEX parser.y)
ADD_RE2C_LEMON_DEPENDENCY(PERPLEX PERPLEX)
set(perplex_sources
${LEMON_PERPLEX_SRC}
${RE2C_PERPLEX_OUTPUTS}
mbo_getopt.cpp
perplex.cpp
)
add_executable(perplex ${perplex_sources})
set_property(TARGET perplex APPEND PROPERTY INCLUDE_DIRECTORIES "${LEMON_PERPLEX_INCLUDE_DIR}")
# Need to link against stl library with some compilers.
target_link_libraries(perplex "${STDCXX_LIBRARIES}")
# Install
if(NOT BIN_DIR)
set(BIN_DIR bin)
endif(NOT BIN_DIR)
if(NOT PERPLEX_SKIP_INSTALL)
install(TARGETS perplex DESTINATION ${BIN_DIR})
endif(NOT PERPLEX_SKIP_INSTALL)
# Handle Perplex template
if(NOT DATA_DIR)
set(DATA_DIR share)
endif(NOT DATA_DIR)
if(NOT CMAKE_CONFIGURATION_TYPES)
set(PERPLEX_TEMPLATE_DIR ${CMAKE_BINARY_DIR}/${DATA_DIR}/perplex)
else(NOT CMAKE_CONFIGURATION_TYPES)
set(PERPLEX_TEMPLATE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${DATA_DIR}/perplex)
endif(NOT CMAKE_CONFIGURATION_TYPES)
add_custom_command(
OUTPUT ${PERPLEX_TEMPLATE_DIR}/perplex_template.c
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/perplex_template.c ${PERPLEX_TEMPLATE_DIR}/perplex_template.c
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/perplex_template.c
)
add_custom_target(perplex_template_cp ALL DEPENDS ${PERPLEX_TEMPLATE_DIR}/perplex_template.c)
add_dependencies(perplex perplex_template_cp)
if(NOT PERPLEX_SKIP_INSTALL)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/perplex_template.c DESTINATION ${DATA_DIR})
endif(NOT PERPLEX_SKIP_INSTALL)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-276
View File
@@ -1,276 +0,0 @@
==========
Overview
==========
Perplex is a simple tool to simplify the creation of scanners using re2c. It
generates an input for the re2c tool from a perplex input file.
Main Sources
-------------
mbo_getopt.cpp and mbo_getopt.h
Option parser, taken from the re2c project.
perplex.cpp
main for perplex.
scanner.re and parser.y
Inputs for re2c scanner-generator and lemon parser-generator respectively.
These files implement the perplex input file parser.
perplex_template.c
Template file with a basic re2c scanner implementation.
Used as the basis for generated scanner sources.
Licensing and Copyrights
-------------------------
mbo_getopt.cpp and mbo_getopt.h are in the Public Domain, written by
Marcus Boerger.
scanner.re and perplex_template.c include code taken from the flex project,
and are released under a BSD License with joint copyright held by the U.S.
Government and The Regents of the University of California.
All other source files are released under a BSD License with U.S. Government
copyright.
=====
API
=====
All scanner data is stored in a perplex_t object.
The template implements the following public functions:
perplex_t perplexFileScanner(FILE *input)
Creates a perplex_t object initialized to scan input from the specified
file stream. The scanner will stop scanning when EOF is encountered.
perplex_t perplexStringScanner(char *firstChar, size_t numChars)
Creates a perplex_t object initialized to scan input from the specified
string. The scanner will stop scanning when numChars characters have
been scanned.
void perplexFree(perplex_t scanner)
Frees all memory associated with the given perplex_t object, except for
any memory referenced by scanner->extra, which must be freed by the user.
int yylex(perplex_t scanner)
Returns the value of the next recognized token, or YYEOF when the end of
the input has been reached. The name of this routine can be changed by
defining the pre-processor symbol PERPLEX_LEXER in section 1 of the
perplex input file.
void perplexSetExtra(perplex_t scanner, void *extra)
Set scanner's application data.
void *perplexGetExtra(perplex_t scanner)
Get scanner's application data.
void perplexUnput(peprlex_t scanner, char c)
Inserts a character on the specified scanner's input buffer so that it
is the next character scanned.
Configuration Macros
---------------------
These macros can be defined in section 1 of the perplex input file:
PERPLEX_LEXER
Set this symbol to specify an alternate name for the generated lexer.
Default is yylex.
PERPLEX_ON_ENTER
Use this symbol to specify code to run at the beginning of each call to
the lexer. A common use is to simplify access to application data:
#define PERPLEX_ON_ENTER appData_t *appData = (appData_t*)yyextra;
Macros Available Inside Rule Code Blocks
-----------------------------------------
These macros can only be used inside rule code blocks:
YYGETCONDITION and YYSETCONDITION(condition)
Get or set the current start conditions, (requires running perplex and
re2c with '-c' option flag).
yytext
A dynamically allocated null-terminated string holding the input which
was matched. yytext is guaranteed to exist until the end of the code
block it is used in, but will be automatically freed afterwards. If
you need to store the token text, you'll need to make a copy.
yyextra
Application data (void*).
===============
Using Perplex
===============
1) Write a perplex input file (see Perplex Input Format).
2) Run perplex on the input to generate an re2c input file.
perplex -t /path/to/perplex_template.c -h header.h -o output.re input.l
* Input defaults to stdin and output defaults to stdout.
* The generated header contains the perplex_t definition and public function
prototypes. This header should be manually included in input.l. If no
output header path is specified, the definitions/declarations will appear
at the top of the output source.
3) Run re2c on the re2c input to generate the final scanner source.
re2c -o /path/to/output.c /path/to/output.re
4) Scan input.
int tokenID;
perplex_t scanner = perplexFileScanner(inFile);
perplexSetExtra(scanner, (void*)appData);
while ((tokenID = yylex(scanner)) != YYEOF) {
...
}
/* do something with appData */
perplexFree(scanner);
======================
Perplex Input Format
======================
Perplex takes a three-section file as input:
/* section 1 - code copied to output */
%%
/* section 2 - scanner rules (see Perplex Rule Section Syntax) */
<regular-expression> { <code> }
<regular-expression> { <code> }
%%
/* section 3 (optional) - code copied to output */
Sections are separated by "%%" appearing on a line by itself, with no leading
or trailing whitespace. The second "%%" separator and following code section
are optional.
=============================
Perplex Rule Section Syntax
=============================
The basic form of the rule section is a series of regular expressions followed
by C/C++ code to be executed when the current input string matches the
expression:
<regular-expression> { <code> }
<regular-expression> { <code> }
The code block spans between { and }, not including C-braces or braces
appearing within strings or comments. The code-block is optional. If missing,
the default behavior is to ignore the matched input string and continue
scanning.
* See the re2c documentation for a list of valid regular expressions.
Named Definitions
------------------
Regular expressions can be given aliases using re2c's named definition syntax.
All named definitions should appear before the first rule.
%%
/* named definitions */
alpha = [A-Za-z];
num = [0-9];
/* rules */
alpha { /* code */ }
num { /* code */ }
/* to match something like "A1" */
alpha(num) { /* code */ }
Exiting From Code Blocks
-------------------------
When the end of a code block is reached, the default behavior is to advance
past the matched input, and continue scanning:
[ \t]+ { /* ignore and continue scanning */ }
If you have matched a token, you will probably return a token identifier rather
than immediately resume scanning:
[A-Za-z_]+ { return TOKEN_NAME; }
It is also possible that you will match part of a token, and need to continue
scanning to find the end of it. Use the continue keyword to avoid throwing out
the text matched so far:
/* start of list */
'{' { continue; }
/* intermediate list item */
[^,}]',' { continue; }
/* end of list */
[^,}]'}' { return TOKEN_LIST; }
==================
Start Conditions
==================
Start conditions allow you to specify that certain rules only be applied in
certain states. Using start conditions requires that perplex and re2c are
run with the '-c' option flag.
Conditions are simply ints, defined in whatever manner is convenient
(e.g. in an enum).
When using conditions, all rules must either be prefixed with a
comma-separated list of conditions appearing between < and >, or must be
specified inside a condition scope (a condition list followed by rules
in between { and }):
enum {conditionOne, conditionTwo, conditionThree};
%%
/* condition scope */
<conditionOne> {
"center" { /* code */ }
"view" { /* code */ }
}
/* simple condition-prefixed rules */
<conditionOne,conditionTwo>[a-zA-Z]+ { /* code */ }
<conditionThree>'v' { /* code */ }
0 is the initial condition, and can be referrenced as the empty list "<>" in
the rule section. "<*>" is the shorthand for specifying all conditions.
The current condition can be determined by calling YYGETCONDITION(). A new
condition can be set by calling YYSETCONDITION(<condition>), or by using one of
the re2c transition operators: "=>" or ":=>". Take the example of changing from
a "code" condition to a "comment" condition:
enum {INITIAL, code, comment};
%%
/* scanner's first order of business is to change from "INITIAL"
* to "code" condition
*/
<> => code
/* this... */
<code>"/*" => comment { /* code */ }
/* ...is equivalent to this */
<code>"/*" {
YYSETCONDITION(comment);
/* code */
}
/* and this... */
<code>"/*" :=> comment
/* ...is equivalent to this */
<code>"/*" :=> comment {
YYSETCONDITION(comment);
continue;
}
-33
View File
@@ -1,33 +0,0 @@
set(re2c_ignore_files
CMake/FindLEMON.cmake
CMakeLists.txt
README.in
actions.cc
basics.h
bootstrap/scanner.cc
code.cc
code.h
code_names.h
config.h.in
config_w32.h.in
configure.in
dfa.cc
dfa.h
globals.h
ins.h
main.cc
mbo_getopt.cc
mbo_getopt.h
parser.yy
re.h
re2c.1.in
re2c.spec.in
re2c_parser.h
scanner.h
scanner.re
stream_lc.h
substr.cc
substr.h
token.h
translate.cc
)
-141
View File
@@ -1,141 +0,0 @@
# Minimum required version of CMake
cmake_minimum_required(VERSION 3.14)
# Set CMake project name
project(RE2C)
# Set project information
set(PACKAGE re2c)
set(VERSION 0.13.5)
set(PACKAGE_NAME ${PACKAGE})
set(PACKAGE_BUGREPORT "re2c-general@lists.sourceforge.net")
set(PACKAGE_STRING "${PACKAGE} ${VERSION}")
set(PACKAGE_TARNAME ${PACKAGE})
set(PACKAGE_VERSION ${VERSION})
set(PACKAGE_RELEASE 1)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/CMake")
find_package(LEMON)
set(STDC_HEADERS 1)
include(CheckIncludeFile)
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
include(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET)
CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
CHECK_FUNCTION_EXISTS(munmap HAVE_MUNMAP)
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
include(CheckTypeSize)
CHECK_TYPE_SIZE(char SIZEOF_CHAR)
CHECK_TYPE_SIZE(int SIZEOF_INT)
CHECK_TYPE_SIZE(long SIZEOF_LONG)
CHECK_TYPE_SIZE(short SIZEOF_SHORT)
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/config.h")
add_definitions(-DHAVE_CONFIG_H)
set(re2c_common_SRCS
code.cc
dfa.cc
main.cc
actions.cc
substr.cc
translate.cc
mbo_getopt.cc
)
set(re2c_HDRS
basics.h
dfa.h
globals.h
ins.h
re2c_parser.h
re.h
scanner.h
substr.h
token.h
mbo_getopt.h
code.h
stream_lc.h
code_names.h
)
set(parser_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/bootstrap_parser")
LEMON_TARGET(re2cParse_bootstrap parser.yy OUT_SRC_FILE bootstrap_parser.cc OUT_HDR_FILE bootstrap_parser_tokens.h)
set(re2c_bootstrap_SRCS
${re2c_common_SRCS}
${LEMON_re2cParse_bootstrap_SRC}
${LEMON_re2cParse_bootstrap_HDR}
bootstrap/scanner.cc
)
add_executable(re2c_bootstrap ${re2c_bootstrap_SRCS})
set_property(TARGET re2c_bootstrap APPEND PROPERTY INCLUDE_DIRECTORIES "${LEMON_re2cParse_bootstrap_INCLUDE_DIR}")
# Need to link against stl library with some compilers.
target_link_libraries(re2c_bootstrap "${STDCXX_LIBRARIES}")
if(TARGET_RUNTIME_OUTPUT_DIRECTORY)
set_target_properties(re2c_bootstrap PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TARGET_RUNTIME_OUTPUT_DIRECTORY}")
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
set_target_properties(re2c_bootstrap PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER} "${TARGET_RUNTIME_OUTPUT_DIRECTORY}")
endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
endif(TARGET_RUNTIME_OUTPUT_DIRECTORY)
if(${LEMON_EXECUTABLE_TARGET})
add_dependencies(re2c_bootstrap ${LEMON_EXECUTABLE_TARGET})
endif(${LEMON_EXECUTABLE_TARGET})
set(parser_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/re2c_parser")
LEMON_TARGET(re2cParse parser.yy OUT_SRC_FILE parser.cc OUT_HDR_FILE parser_tokens.h)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/scanner.cc
COMMAND re2c_bootstrap -bi -o ${CMAKE_CURRENT_BINARY_DIR}/scanner.cc ${CMAKE_CURRENT_SOURCE_DIR}/scanner.re
DEPENDS re2c_bootstrap
)
set(re2c_SRCS
${re2c_common_SRCS}
${LEMON_re2cParse_SRC}
${LEMON_re2cParse_HDR}
${CMAKE_CURRENT_BINARY_DIR}/scanner.cc
)
add_executable(re2c ${re2c_SRCS})
set_property(TARGET re2c APPEND PROPERTY INCLUDE_DIRECTORIES "${LEMON_re2cParse_INCLUDE_DIR}")
# Need to link against stl library with some compilers.
target_link_libraries(re2c "${STDCXX_LIBRARIES}")
# Install
if(NOT BIN_DIR)
set(BIN_DIR bin)
endif(NOT BIN_DIR)
if(NOT RE2C_SKIP_INSTALL)
install(TARGETS re2c DESTINATION ${BIN_DIR})
endif(NOT RE2C_SKIP_INSTALL)
configure_file(README.in ${CMAKE_CURRENT_BINARY_DIR}/README)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/README")
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-102
View File
@@ -1,102 +0,0 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have a working `mmap' system call. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `munmap' function. */
#define HAVE_MUNMAP 1
/* Define to 1 if stdbool.h conforms to C99. */
#define HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if the system has the type `_Bool'. */
#define HAVE__BOOL 1
/* Name of package */
#define PACKAGE "re2c"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "re2c-general@lists.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "re2c"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "re2c @PACKAGE_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "re2c"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
/* The size of a `char', as computed by sizeof. */
#define SIZEOF_CHAR 1
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of a `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "@PACKAGE_VERSION@"
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
/* #undef volatile */
-66
View File
@@ -1,66 +0,0 @@
AC_PREREQ([2.57])
AC_INIT(re2c, 0.13.5, re2c-general@lists.sourceforge.net)
AM_INIT_AUTOMAKE(re2c, $PACKAGE_VERSION)
AC_CONFIG_SRCDIR(actions.cc)
AM_CONFIG_HEADER(config.h)
AC_SUBST(PACKAGE_DATE, `date +'%d %b %Y'`)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(PACKAGE_NAME)
AC_SUBST(PACKAGE_TARNAME)
AC_SUBST(PACKAGE_RELEASE, ${PACKAGE_RELEASE:-1})
AC_SUBST(WINBUILDDIR, Release-2005)
# Checks for programs.
AC_PROG_YACC
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
if test "$GCC" = "yes"; then
AC_MSG_CHECKING([Testing GCC version])
GCCVERSION=`$CXX -dumpversion 2>/dev/null`
if test -z "$GCCVERSION"; then
AC_MSG_ERROR([GCC version 3 or above required])
fi
AC_MSG_RESULT([found version $GCCVERSION])
fi
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
# We only rely on standard C/C++ headers. If we ever have a pressing need
# for something non-standard, we should add a check for it here.
# AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_CHECK_FUNCS([memset munmap strdup strndup])
AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CONFIG_FILES([\
Makefile \
README \
makerpm \
re2c.1 \
re2c.spec \
run_tests.sh \
config_w32.h \
htdocs/manual.html \
])
AC_OUTPUT_COMMANDS([chmod +x makerpm run_tests.sh])
AC_OUTPUT
-829
View File
@@ -1,829 +0,0 @@
./"
./" $Id$
./"
.TH RE2C 1 "@PACKAGE_DATE@" "Version @PACKAGE_VERSION@"
.ds re \fBre2c\fP
.ds le \fBlex\fP
.ds rx regular-expression
.ds rxs regular-expressions
.ds lx \fIl\fP-expression
.SH NAME
\*(re \- convert \*(rxs to C/C++
.SH SYNOPSIS
\*(re [\fB-bdDefFghisuvVw1\fP] [\fB-o output\fP] [\fB-c\fP [\fB-t header\fP]] \fBfile\fP
.SH DESCRIPTION
\*(re is a preprocessor that generates C-based recognizers from regular
expressions.
The input to \*(re consists of C/C++ source interleaved with
comments of the form \fC/*!re2c\fP ... \fC*/\fP which contain
scanner specifications.
In the output these comments are replaced with code that, when
executed, will find the next input token and then execute
some user-supplied token-specific code.
For example, given the following code
.in +3
.nf
char *scan(char *p)
{
/*!re2c
re2c:define:YYCTYPE = "unsigned char";
re2c:define:YYCURSOR = p;
re2c:yyfill:enable = 0;
re2c:yych:conversion = 1;
re2c:indent:top = 1;
[0-9]+ {return p;}
[^] {return (char*)0;}
*/
}
.fi
.in -3
\*(re -is will generate
.in +3
.nf
/* Generated by re2c on Sat Apr 16 11:40:58 1994 */
char *scan(char *p)
{
{
unsigned char yych;
yych = (unsigned char)*p;
if(yych &lt;= '/') goto yy4;
if(yych &gt;= ':') goto yy4;
++p;
yych = (unsigned char)*p;
goto yy7;
yy3:
{return p;}
yy4:
++p;
yych = (unsigned char)*p;
{return char*)0;}
yy6:
++p;
yych = (unsigned char)*p;
yy7:
if(yych &lt;= '/') goto yy3;
if(yych &lt;= '9') goto yy6;
goto yy3;
}
}
.fi
.in -3
You can place one \fC/*!max:re2c */\fP comment that will output a "#define
\fCYYMAXFILL\fP <n>" line that holds the maximum number of characters
required to parse the input. That is the maximum value \fCYYFILL\fP(n)
will receive. If -1 is in effect then YYMAXFILL can only be triggered once
after the last \fC/*!re2c */\fP.
You can also use \fC/*!ignore:re2c */\fP blocks that allows to document the
scanner code and will not be part of the output.
.SH OPTIONS
\*(re provides the following options:
.TP
\fB-?\fP
\fB-h\fP
Invoke a short help.
.TP
\fB-b\fP
Implies \fB-s\fP. Use bit vectors as well in the attempt to coax better
code out of the compiler. Most useful for specifications with more than a
few keywords (e.g. for most programming languages).
.TP
\fB-c\fP
Used to support (f)lex-like condition support.
.TP
\fB-d\fP
Creates a parser that dumps information about the current position and in
which state the parser is while parsing the input. This is useful to debug
parser issues and states. If you use this switch you need to define a macro
\fIYYDEBUG\fP that is called like a function with two parameters:
\fIvoid YYDEBUG(int state, char current)\fP. The first parameter receives the
state or -1 and the second parameter receives the input at the current cursor.
.TP
\fB-D\fP
Emit Graphviz dot data. It can then be processed with e.g.
"dot -Tpng input.dot > output.png". Please note that scanners with many states
may crash dot.
.TP
\fB-e\fP
Cross-compile from an ASCII platform to an EBCDIC one.
.TP
\fB-f\fP
Generate a scanner with support for storable state.
For details see below at \fBSCANNER WITH STORABLE STATES\fP.
.TP
\fB-F\fP
Partial support for flex syntax. When this flag is active then named
definitions must be surrounded by curly braces and can be defined without an
equal sign and the terminating semi colon. Instead names are treated as direct
double quoted strings.
.TP
\fB-g\fP
Generate a scanner that utilizes GCC's computed goto feature. That is \*(re
generates jump tables whenever a decision is of a certain complexity (e.g. a
lot of if conditions are otherwise necessary). This is only useable with GCC
and produces output that cannot be compiled with any other compiler. Note that
this implies -b and that the complexity threshold can be configured using the
inplace configuration "cgoto:threshold".
.TP
\fB-i\fP
Do not output #line information. This is useful when you want use a CMS tool
with the \*(re output which you might want if you do not require your users to
have \*(re themselves when building from your source.
\fB-o output\fP
Specify the output file.
.TP
\fB-r\fP
Allows reuse of scanner definitions with '\fB/*!use:re2c\fP' after
'\fB/*!rules:re2c\fP'. In this mode no '\fB/*!re2c\fP' block and exactly one
'\fB/*!rules:re2c\fP' must be present. The rules are being saved and used by
every '\fB/*!use:re2c\fP' block that follows. These blocks can contain
inplace configurations, especially '\fBre2c:flags:w\fP' and '\fBre2c:flags:u\fP'.
That way it is possible to create the same scanner multiple times for different
character types, different input mechanisms or different output mechanisms.
The '\fB/*!use:re2c\fP' blocks can also contain additional rules that will be
appended to the set of rules in '\fB/*!rules:re2c\fP'.
.TP
\fB-s\fP
Generate nested \fCif\fPs for some \fCswitch\fPes. Many compilers need this
assist to generate better code.
.TP
\fB-t\fP
Create a header file that contains types for the (f)lex-like condition support.
This can only be activated when \fB-c\fP is in use.
.TP
\fB-u\fP
Generate a parser that supports Unicode chars (UTF-32). This means the
generated code can deal with any valid Unicode character up to 0x10FFFF. When
UTF-8 or UTF-16 needs to be supported you need to convert the incoming stream
to UTF-32 upon input yourself.
.TP
\fB-v\fP
Show version information.
.TP
\fB-V\fP
Show the version as a number XXYYZZ.
.TP
\fB-w\fP
Create a parser that supports wide chars (UCS-2). This implies \fB-s\fP and
cannot be used together with \fB-e\fP switch.
.TP
\fB-1\fP
Force single pass generation, this cannot be combined with -f and disables
YYMAXFILL generation prior to last \*(re block.
.TP
\fB--no-generation-date\fP
Suppress date output in the generated output so that it only shows the re2c
version.
.TP
\fb--case-insensitive\fP
All strings are case insensitive, so all "-expressions are treated
in the same way '-expressions are.
.TP
\fB--case-inverted\fP
Invert the meaning of single and double quoted strings.
With this switch single quotes are case sensitive and
double quotes are case insensitive.
.SH "INTERFACE CODE"
Unlike other scanner generators, \*(re does not generate complete scanners:
the user must supply some interface code.
In particular, the user must define the following macros or use the
corresponding inplace configurations:
.TP
\fCYYCONDTYPE\fP
In \fB-c\fP mode you can use \fB-t\fP to generate a file that contains the
enumeration used as conditions. Each of the values refers to a condition of
a rule set.
.TP
\fCYYCTXMARKER\fP
\*(lx of type \fC*YYCTYPE\fP.
The generated code saves trailing context backtracking information in \fCYYCTXMARKER\fP.
The user only needs to define this macro if a scanner specification uses trailing
context in one or more of its \*(rxs.
.TP
\fCYYCTYPE\fP
Type used to hold an input symbol.
Usually \fCchar\fP or \fCunsigned char\fP.
.TP
\fCYYCURSOR\fP
\*(lx of type \fC*YYCTYPE\fP that points to the current input symbol.
The generated code advances \fCYYCURSOR\fP as symbols are matched.
On entry, \fCYYCURSOR\fP is assumed to point to the first character of the
current token. On exit, \fCYYCURSOR\fP will point to the first character of
the following token.
.TP
\fCYYDEBUG(\fP\fIstate\fP,\fIcurrent\fC)\fP
This is only needed if the \fB-d\fP flag was specified. It allows to easily debug
the generated parser by calling a user defined function for every state. The function
should have the following signature: \fIvoid YYDEBUG(int state, char current)\fP.
The first parameter receives the state or -1 and the second parameter receives the
input at the current cursor.
.TP
\fCYYFILL\fP(\fIn\fP\fC\fP)
The generated code "calls" \fCYYFILL\fP(n) when the buffer needs
(re)filling: at least \fIn\fP additional characters should
be provided. \fCYYFILL\fP(n) should adjust \fCYYCURSOR\fP, \fCYYLIMIT\fP,
\fCYYMARKER\fP and \fCYYCTXMARKER\fP as needed. Note that for typical
programming languages \fIn\fP will be the length of the longest keyword plus one.
The user can place a comment of the form \fC/*!max:re2c */\fP once to insert
a \fCYYMAXFILL\fP(n) definition that is set to the maximum length value. If -1
switch is used then \fCYYMAXFILL\fP can be triggered only once after the
last \fC/*!re2c */\fP
block.
.TP
\fCYYGETCONDITION\fP()
This define is used to get the condition prior to entering the scanner code
when using \fB-c\fP switch. The value must be initialized with a value from
the enumeration \fCYYCONDTYPE\fP type.
.TP
\fCYYGETSTATE\fP()
The user only needs to define this macro if the \fB-f\fP flag was specified.
In that case, the generated code "calls" \fCYYGETSTATE\fP() at the very beginning
of the scanner in order to obtain the saved state. \fCYYGETSTATE\fP() must return a signed
integer. The value must be either -1, indicating that the scanner is entered for the
first time, or a value previously saved by \fCYYSETSTATE\fP(s). In the second case, the
scanner will resume operations right after where the last \fCYYFILL\fP(n) was called.
.TP
\fCYYLIMIT\fP
Expression of type \fC*YYCTYPE\fP that marks the end of the buffer
(\fCYYLIMIT[-1]\fP is the last character in the buffer).
The generated code repeatedly compares \fCYYCURSOR\fP to \fCYYLIMIT\fP
to determine when the buffer needs (re)filling.
.TP
\fCYYMARKER\fP
\*(lx of type \fC*YYCTYPE\fP.
The generated code saves backtracking information in \fCYYMARKER\fP. Some easy
scanners might not use this.
.TP
\fCYYMAXFILL
This will be automatically defined by \fC/*!max:re2c */\fP blocks as explained above.
.TP
\fCYYSETCONDITION(\fP\fIc\fP\fC)\fP
This define is used to set the condition in transition rules. This is only
being used when \fB-c\fP is active and transition rules are being used.
.TP
\fCYYSETSTATE(\fP\fIs\fP\fC)\fP
The user only needs to define this macro if the \fB-f\fP flag was specified.
In that case, the generated code "calls" \fCYYSETSTATE\fP just before calling
\fCYYFILL\fP(n). The parameter to \fCYYSETSTATE\fP is a signed integer that uniquely
identifies the specific instance of \fCYYFILL\fP(n) that is about to be called.
Should the user wish to save the state of the scanner and have \fCYYFILL\fP(n) return
to the caller, all he has to do is store that unique identifier in a variable.
Later, when the scannered is called again, it will call \fCYYGETSTATE()\fP and
resume execution right where it left off. The generated code will contain
both \fCYYSETSTATE\fP(s) and \fCYYGETSTATE\fP even if \fCYYFILL\fP(n) is being
disabled.
.SH "SCANNER WITH STORABLE STATES"
When the \fB-f\fP flag is specified, \*(re generates a scanner that
can store its current state, return to the caller, and later resume
operations exactly where it left off.
The default operation of \*(re is a "pull" model, where the scanner asks
for extra input whenever it needs it. However, this mode of operation
assumes that the scanner is the "owner" the parsing loop, and that may
not always be convenient.
Typically, if there is a preprocessor ahead of the scanner in the stream,
or for that matter any other procedural source of data, the scanner cannot
"ask" for more data unless both scanner and source live in a separate threads.
The \fB-f\fP flag is useful for just this situation : it lets users design
scanners that work in a "push" model, i.e. where data is fed to the scanner
chunk by chunk. When the scanner runs out of data to consume, it just stores
its state, and return to the caller. When more input data is fed to the scanner,
it resumes operations exactly where it left off.
When using the -f option \*(re does not accept stdin because it has to do the
full generation process twice which means it has to read the input twice. That
means \*(re would fail in case it cannot open the input twice or reading the
input for the first time influences the second read attempt.
Changes needed compared to the "pull" model.
1. User has to supply macros YYSETSTATE() and YYGETSTATE(state)
2. The \fB-f\fP option inhibits declaration of \fIyych\fP and
\fIyyaccept\fP. So the user has to declare these. Also the user has
to save and restore these. In the example \fIexamples/push.re\fP these
are declared as fields of the (C++) class of which the scanner is a
method, so they do not need to be saved/restored explicitly. For C
they could e.g. be made macros that select fields from a structure
passed in as parameter. Alternatively, they could be declared as local
variables, saved with YYFILL(n) when it decides to return and restored
at entry to the function. Also, it could be more efficient to save the
state from YYFILL(n) because YYSETSTATE(state) is called
unconditionally. YYFILL(n) however does not get \fIstate\fP as
parameter, so we would have to store state in a local variable by
YYSETSTATE(state).
3. Modify YYFILL(n) to return (from the function calling it) if more
input is needed.
4. Modify caller to recognise "more input is needed" and respond
appropriately.
5. The generated code will contain a switch block that is used to restores
the last state by jumping behind the corresponding YYFILL(n) call. This code is
automatically generated in the epilog of the first "\fC/*!re2c */\fP" block.
It is possible to trigger generation of the YYGETSTATE() block earlier by
placing a "\fC/*!getstate:re2c */\fP" comment. This is especially useful when
the scanner code should be wrapped inside a loop.
Please see examples/push.re for push-model scanner. The generated code can be
tweaked using inplace configurations "\fBstate:abort\fP" and "\fBstate:nextlabel\fP".
.SH "SCANNER WITH CONDITION SUPPORT"
You can precede \*(rxs with a list of condition names when using the \fB-c\fP
switch. In this case \*(re generates scanner blocks for each condition. Where each of the
generated blocks has its own precondition. The precondition is given by the
interface define \fBYYGETCONDITION\fP and must be of type \fBYYCONDTYPE\fP.
.LP
There are two special rule types. First, the rules of the condition '*' are
merged to all conditions. And second the empty condition list allows to
provide a code block that does not have a scanner part. Meaning it does not
allow any regular expression. The condition value referring to this special
block is always the one with the enumeration value 0. This way the code of this
special rule can be used to initialize a scanner. It is in no way necessary to
have these rules: but sometimes it is helpful to have a dedicated uninitialized
condition state.
.LP
Non empty rules allow to specify the new condition, which makes them
transition rules. Besides generating calls for the define \fBYYSETCONDITION\fP
no other special code is generated.
.LP
There is another kind of special rules that allow to prepend code to any code
block of all rules of a certain set of conditions or to all code blocks to all
rules. This can be helpful when some operation is common among rules. For
instance this can be used to store the length of the scanned string. These
special setup rules start with an exclamation mark followed by either a list
of conditions \fB<! condition, ... >\fP or a star \fB<!*>\fP.
When \*(re generates the code for a rule whose state does not have a
setup rule and a star'd setup rule is present, than that code will be used
as setup code.
.SH "SCANNER SPECIFICATIONS"
Each scanner specification consists of a set of \fIrules\fP, \fInamed
definitions\fP and \fIconfigurations\fP.
.LP
\fIRules\fP consist of a \*(rx along with a block of C/C++ code that
is to be executed when the associated \fI\*(rx\fP is matched. You can either
start the code with an opening curly brace or the sequence '\fB:=\fP'. When
the code with a curly brace then \*(re counts the brace depth and stops looking
for code automatically. Otherwise curly braces are not allowed and \*(re stops
looking for code at the first line that does not begin with whitespace.
.P
.RS
\fI\*(rx\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fI\*(rx\fP \fC:=\fP \fIC/C++ code\fP
.RE
.P
If \fB-c\fP is active then each \*(rx is preceded by a list of
comma separated condition names. Besides normal naming rules there are two
special cases. A rule may contain the single condition name '*' and no condition
name at all. In the latter case the rule cannot have a \*(rx. Non
empty rules may further more specify the new condition. In that case \*(re will
generated the necessary code to change the condition automatically. Just as above
code can be started with a curly brace of the sequence '\fB:=\fP'. Further more
rules can use ':=>' as a shortcut to automatically generate code that not only
sets the new condition state but also continues execution with the new state. A
shortcut rule should not be used in a loop where there is code between the start
of the loop and the \*(re block unless \fIre2c:cond:goto\fP is changed
to '\fIcontinue;\fP'. If code is necessary before all rule (though not simple
jumps) you can do so by using <! pseudo-rules.
.P
.RS
\fC<\fP\fIcondition-list\fP\fC>\fP \fI\*(rx\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<\fP\fIcondition-list\fP\fC>\fP \fI\*(rx\fP \fC:=\fP \fIC/C++ code\fP
.P
\fC<\fP\fIcondition-list\fP\fC>\fP \fI\*(rx\fP \fC=>\fP \fP\fIcondition\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<\fP\fIcondition-list\fP\fC>\fP \fI\*(rx\fP \fC=>\fP \fP\fIcondition\fP \fC:=\fP \fIC/C++ code\fP
.P
\fC<\fP\fIcondition-list\fP\fC>\fP \fI\*(rx\fP \fC:=>\fP \fP\fIcondition\fP
.P
\fC<\fP\fI*\fP\fC>\fP \fI\*(rx\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<\fP\fI*\fP\fC>\fP \fI\*(rx\fP \fC:=\fP \fIC/C++ code\fP
.P
\fC<\fP\fI*\fP\fC>\fP \fI\*(rx\fP \fC=>\fP \fP\fIcondition\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<\fP\fI*\fP\fC>\fP \fI\*(rx\fP \fC=>\fP \fP\fIcondition\fP \fC:=\fP \fIC/C++ code\fP
.P
\fC<\fP\fI*\fP\fC>\fP \fI\*(rx\fP \fC:=>\fP \fP\fIcondition\fP
.P
\fC<>\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<>\fP \fC:=\fP \fIC/C++ code\fP
.P
\fC<>\fP \fC=>\fP \fP\fIcondition\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<>\fP \fC=>\fP \fP\fIcondition\fP \fC:=\fP \fIC/C++ code\fP
.P
\fC<>\fP \fC:=>\fP \fP\fIcondition\fP
.P
\fC<!\fIcondition-list\fP\fC>\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<!\fIcondition-list\fP\fC>\fP \fC:=\fP \fIC/C++ code\fP
.P
\fC<!*>\fP \fC{\fP \fIC/C++ code\fP \fC}\fP
.P
\fC<!*>\fP \fC:=\fP \fIC/C++ code\fP
.RE
.LP
Named definitions are of the form:
.P
.RS
\fIname\fP \fC=\fP \fI\*(rx\fP\fC;\fP
.RE
.LP
\fB-F\fP is active, then named definitions are also of the form:
.P
.RS
\fIname\fP \fI\*(rx\fP
.RE
.LP
Configurations look like named definitions whose names start
with "\fBre2c:\fP":
.P
.RS
\fCre2c:\fP\fIname\fP \fC=\fP \fIvalue\fP\fC;\fP
.RE
.RS
\fCre2c:\fP\fIname\fP \fC=\fP \fB"\fP\fIvalue\fP\fB"\fP\fC;\fP
.RE
.SH "SUMMARY OF RE2C REGULAR-EXPRESSIONS"
.TP
\fC"foo"\fP
the literal string \fCfoo\fP.
ANSI-C escape sequences can be used.
.TP
\fC'foo'\fP
the literal string \fCfoo\fP (characters [a-zA-Z] treated case-insensitive).
ANSI-C escape sequences can be used.
.TP
\fC[xyz]\fP
a "character class"; in this case,
the \*(rx matches either an '\fCx\fP', a '\fCy\fP', or a '\fCz\fP'.
.TP
\fC[abj-oZ]\fP
a "character class" with a range in it;
matches an '\fCa\fP', a '\fCb\fP', any letter from '\fCj\fP' through '\fCo\fP',
or a '\fCZ\fP'.
.TP
\fC[^\fIclass\fP\fC]\fP
an inverted "character class".
.TP
\fIr\fP\fC\e\fP\fIs\fP
match any \fIr\fP which isn't an \fIs\fP. \fIr\fP and \fIs\fP must be \*(rxs
which can be expressed as character classes.
.TP
\fIr\fP\fC*\fP
zero or more \fIr\fP's, where \fIr\fP is any \*(rx
.TP
\fC\fIr\fP\fC+\fP
one or more \fIr\fP's
.TP
\fC\fIr\fP\fC?\fP
zero or one \fIr\fP's (that is, "an optional \fIr\fP")
.TP
name
the expansion of the "named definition" (see above)
.TP
\fC(\fP\fIr\fP\fC)\fP
an \fIr\fP; parentheses are used to override precedence
(see below)
.TP
\fIrs\fP
an \fIr\fP followed by an \fIs\fP ("concatenation")
.TP
\fIr\fP\fC|\fP\fIs\fP
either an \fIr\fP or an \fIs\fP
.TP
\fIr\fP\fC/\fP\fIs\fP
an \fIr\fP but only if it is followed by an \fIs\fP. The \fIs\fP is not part of
the matched text. This type of \*(rx is called "trailing context". A trailing
context can only be the end of a rule and not part of a named definition.
.TP
\fIr\fP\fC{\fP\fIn\fP\fC}\fP
matches \fIr\fP exactly \fIn\fP times.
.TP
\fIr\fP\fC{\fP\fIn\fP\fC,}\fP
matches \fIr\fP at least \fIn\fP times.
.TP
\fIr\fP\fC{\fP\fIn\fP\fC,\fP\fIm\fP\fC}\fP
matches \fIr\fP at least \fIn\fP but not more than \fIm\fP times.
.TP
\fC.\fP
match any character except newline (\\n).
.TP
\fIdef\fP
matches named definition as specified by \fIdef\fP only if \fB-F\fP is
off. If the switch \fB-F\fP is active then this behaves like it was enclosed
in double quotes and matches the string \fIdef\fP.
.LP
Character classes and string literals may contain octal or hexadecimal
character definitions and the following set of escape sequences (\fB\\n\fP,
\fB\\t\fP, \fB\\v\fP, \fB\\b\fP, \fB\\r\fP, \fB\\f\fP, \fB\\a\fP, \fB\\\\\fP).
An octal character is defined by a backslash followed by its three octal digits
and a hexadecimal character is defined by backslash, a lower cased '\fBx\fP'
and its two hexadecimal digits or a backslash, an upper cased \fBX\fP and its
four hexadecimal digits.
.LP
\*(re further more supports the c/c++ unicode notation. That is a backslash followed
by either a lowercased \fBu\fP and its four hexadecimal digits or an uppercased
\fBU\fP and its eight hexadecimal digits. However only in \fB-u\fP mode the
generated code can deal with any valid Unicode character up to 0x10FFFF.
.LP
Since characters greater \fB\\X00FF\fP are not allowed in non unicode mode, the
only portable "\fBany\fP" rules are \fB(.|"\\n")\fP and \fB[^]\fP.
.LP
The \*(rxs listed above are grouped according to
precedence, from highest precedence at the top to lowest at the bottom.
Those grouped together have equal precedence.
.SH "INPLACE CONFIGURATION"
.LP
It is possible to configure code generation inside \*(re blocks. The following
lists the available configurations:
.TP
\fIre2c:condprefix\fP \fB=\fP yyc_ \fB;\fP
Allows to specify the prefix used for condition labels. That is this text is
prepended to any condition label in the generated output file.
.TP
\fIre2c:condenumprefix\fP \fB=\fP yyc \fB;\fP
Allows to specify the prefix used for condition values. That is this text is
prepended to any condition enum value in the generated output file.
.TP
\fIre2c:cond:divider\fP \fB=\fP "/* *********************************** */" \fB;\fP
Allows customizing of the divider for condition blocks. You can use '@@' to
put the name of the condition or customize the placeholder
using \fIre2c:cond:divider@cond\fP.
.TP
\fIre2c:cond:divider@cond\fP \fB=\fP @@ \fB;\fP
Specifies the placeholder that will be replaced with the condition name
in \fIre2c:cond:divider\fP.
.TP
\fIre2c:cond:goto\fP \fB=\fP "goto @@;" \fB;\fP
Allows customizing of the conditional goto statements used with ':=>' style rules.
You can use '@@' to put the name of the condition or customize the placeholder
using \fIre2c:cond:goto@cond\fP. You can also change this to 'continue;',
which would allow you to continue with the next loop cycle including any code
between loop start and re2c block.
.TP
\fIre2c:cond:goto@cond\fP \fB=\fP @@ \fB;\fP
Specifies the placeholder that will be replaced with the condition label
in \fIre2c:cond:goto\fP.
.TP
\fIre2c:indent:top\fP \fB=\fP 0 \fB;\fP
Specifies the minimum number of indentation to use. Requires a numeric value
greater than or equal zero.
.TP
\fIre2c:indent:string\fP \fB=\fP "\\t" \fB;\fP
Specifies the string to use for indentation. Requires a string that should
contain only whitespace unless you need this for external tools. The easiest
way to specify spaces is to include them in single or double quotes. If you do
not want any indentation at all you can simply set this to \fB""\fP.
.TP
\fIre2c:yych:conversion\fP \fB=\fP 0 \fB;\fP
When this setting is non zero, then \*(re automatically generates conversion
code whenever yych gets read. In this case the type must be defined using
\fBre2c:define:YYCTYPE\fP.
.TP
\fIre2c:yych:emit\fP \fB=\fP 1 \fB;\fP
Generation of \fByych\fP can be suppressed by setting this to 0.
.TP
\fIre2c:yybm:hex\fP \fB=\fP 0 \fB;\fP
If set to zero then a decimal table is being used else a hexadecimal table
will be generated.
.TP
\fIre2c:yyfill:enable\fP \fB=\fP 1 \fB;\fP
Set this to zero to suppress generation of YYFILL(n). When using this be sure
to verify that the generated scanner does not read behind input. Allowing
this behavior might introduce sever security issues to you programs.
.TP
\fIre2c:yyfill:check\fP \fB=\fP 1 \fB;\fP
This can be set 0 to suppress output of the pre condition using YYCURSOR and
YYLIMIT which becomes useful when YYLIMIT + max(YYFILL) is always accessible.
.TP
\fIre2c:yyfill:parameter\fP \fB=\fP 1 \fB;\fP
Allows to suppress parameter passing to \fBYYFILL\fP calls. If set to zero
then no parameter is passed to \fBYYFILL\fP. However \fBdefine:YYFILL@LEN\fP
allows to specify a replacement string for the actual length value. If set to
a non zero value then \fBYYFILL\fP usage will be followed by the number of
requested characters in braces unless \fBre2c:define:YYFILL:naked\fP is set.
Also look at \fBre2c:define:YYFILL:naked\fP and \fBre2c:define:YYFILL@LEN\fP.
.TP
\fIre2c:startlabel\fP \fB=\fP 0 \fB;\fP
If set to a non zero integer then the start label of the next scanner blocks
will be generated even if not used by the scanner itself. Otherwise the normal
\fByy0\fP like start label is only being generated if needed. If set to a text
value then a label with that text will be generated regardless of whether the
normal start label is being used or not. This setting is being reset to \fB0\fP
after a start label has been generated.
.TP
\fIre2c:labelprefix\fP \fB=\fP yy \fB;\fP
Allows to change the prefix of numbered labels. The default is \fByy\fP and
can be set any string that is a valid label.
.TP
\fIre2c:state:abort\fP \fB=\fP 0 \fB;\fP
When not zero and switch -f is active then the \fCYYGETSTATE\fP block will
contain a default case that aborts and a -1 case is used for initialization.
.TP
\fIre2c:state:nextlabel\fP \fB=\fP 0 \fB;\fP
Used when -f is active to control whether the \fCYYGETSTATE\fP block is
followed by a \fCyyNext:\fP label line. Instead of using \fCyyNext\fP you can
usually also use configuration \fIstartlabel\fP to force a specific start label
or default to \fCyy0\fP as start label. Instead of using a dedicated label it
is often better to separate the YYGETSTATE code from the actual scanner code by
placing a "\fC/*!getstate:re2c */\fP" comment.
.TP
\fIre2c:cgoto:threshold\fP \fB=\fP 9 \fB;\fP
When -g is active this value specifies the complexity threshold that triggers
generation of jump tables rather than using nested if's and decision bitfields.
The threshold is compared against a calculated estimation of if-s needed where
every used bitmap divides the threshold by 2.
.TP
\fIre2c:yych:conversion\fP \fB=\fP 0 \fB;\fP
When the input uses signed characters and \fB-s\fP or \fB-b\fP switches are
in effect re2c allows to automatically convert to the unsigned character type
that is then necessary for its internal single character. When this setting
is zero or an empty string the conversion is disabled. Using a non zero number
the conversion is taken from \fBYYCTYPE\fP. If that is given by an inplace
configuration that value is being used. Otherwise it will be \fB(YYCTYPE)\fP
and changes to that configuration are no longer possible. When this setting is
a string the braces must be specified. Now assuming your input is a \fBchar*\fP
buffer and you are using above mentioned switches you can set \fBYYCTYPE\fP to
\fBunsigned char\fP and this setting to either \fB1\fP or \fB"(unsigned char)"\fP.
.TP
\fIre2c:define:define:YYCONDTYPE\fP \fB=\fP YYCONDTYPE \fB;\fP
Enumeration used for condition support with \fB-c\fP mode.
.TP
\fIre2c:define:YYCTXMARKER\fP \fB=\fP YYCTXMARKER \fB;\fP
Allows to overwrite the define YYCTXMARKER and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYCTYPE\fP \fB=\fP YYCTYPE \fB;\fP
Allows to overwrite the define YYCTYPE and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYCURSOR\fP \fB=\fP YYCURSOR \fB;\fP
Allows to overwrite the define YYCURSOR and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYDEBUG\fP \fB=\fP YYDEBUG \fB;\fP
Allows to overwrite the define \fBYYDEBUG\fP and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYFILL\fP \fB=\fP YYFILL \fB;\fP
Allows to overwrite the define \fBYYFILL\fP and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYFILL:naked\fP \fB=\fP 0 \fB;\fP
When set to 1 neither braces, parameter nor semicolon gets emitted.
.TP
\fIre2c:define:YYFILL@len\fP \fB=\fP @@ \fB;\fP
When using \fIre2c:define:YYFILL\fP and \fIre2c:yyfill:parameter\fP is 0 then
any occurrence of this text inside \fBYYFILL\fP will be replaced with the actual
length value.
.TP
\fIre2c:define:YYGETCONDITION\fP \fB=\fP YYGETCONDITION \fB;\fP
Allows to overwrite the define \fBYYGETCONDITION\fP.
.TP
\fIre2c:define:YYGETCONDITION:naked\fP \fB=\fP \fB;\fP
When set to 1 neither braces, parameter nor semicolon gets emitted.
.TP
\fIre2c:define:YYGETSTATE\fP \fB=\fP YYGETSTATE \fB;\fP
Allows to overwrite the define \fBYYGETSTATE\fP and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYGETSTATE:naked\fP \fB=\fP 0 \fB;\fP
When set to 1 neither braces, parameter nor semicolon gets emitted.
.TP
\fIre2c:define:YYLIMIT\fP \fB=\fP YYLIMIT \fB;\fP
Allows to overwrite the define \fBYYLIMIT\fP and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYMARKER\fP \fB=\fP YYMARKER \fB;\fP
Allows to overwrite the define \fBYYMARKER\fP and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYSETCONDITION\fP \fB=\fP YYSETCONDITION \fB;\fP
Allows to overwrite the define \fBYYSETCONDITION\fP.
.TP
\fIre2c:define:YYSETCONDITION@cond\fP \fB=\fP @@ \fB;\fP
When using \fIre2c:define:YYSETCONDITION\fP then any occurrence of this text
inside \fBYYSETCONDITION\fP will be replaced with the actual new condition value.
.TP
\fIre2c:define:YYSETSTATE\fP \fB=\fP YYSETSTATE \fB;\fP
Allows to overwrite the define \fBYYSETSTATE\fP and thus avoiding it by setting the
value to the actual code needed.
.TP
\fIre2c:define:YYSETSTATE:naked\fP \fB=\fP 0 \fB;\fP
When set to 1 neither braces, parameter nor semicolon gets emitted.
.TP
\fIre2c:define:YYSETSTATE@state\fP \fB=\fP @@ \fB;\fP
When using \fIre2c:define:YYSETSTATE\fP then any occurrence of this text
inside \fBYYSETSTATE\fP will be replaced with the actual new state value.
.TP
\fIre2c:label:yyFillLabel\fP \fB=\fP yyFillLabel \fB;\fP
Allows to overwrite the name of the label yyFillLabel.
.TP
\fIre2c:label:yyNext\fP \fB=\fP yyNext \fB;\fP
Allows to overwrite the name of the label yyNext.
.TP
\fIre2c:variable:yyaccept\fP \fB=\fP yyaccept \fB;\fP
Allows to overwrite the name of the variable yyaccept.
.TP
\fIre2c:variable:yybm\fP \fB=\fP yybm \fB;\fP
Allows to overwrite the name of the variable yybm.
.TP
\fIre2c:variable:yych\fP \fB=\fP yych \fB;\fP
Allows to overwrite the name of the variable yych.
.TP
\fIre2c:variable:yyctable\fP \fB=\fP yyctable \fB;\fP
When both \fB-c\fP and \fB-g\fP are active then \*(re uses this variable to
generate a static jump table for YYGETCONDITION.
.TP
\fIre2c:variable:yystable\fP \fB=\fP yystable \fB;\fP
When both \fB-f\fP and \fB-g\fP are active then \*(re uses this variable to
generate a static jump table for YYGETSTATE.
.TP
\fIre2c:variable:yytarget\fP \fB=\fP yytarget \fB;\fP
Allows to overwrite the name of the variable yytarget.
.SH "UNDERSTANDING RE2C"
.LP
The subdirectory lessons of the \*(re distribution contains a few step by step
lessons to get you started with \*(re. All examples in the lessons subdirectory
can be compiled and actually work.
.SH FEATURES
.LP
\*(re does not provide a default action:
the generated code assumes that the input
will consist of a sequence of tokens.
Typically this can be dealt with by adding a rule such as the one for
unexpected characters in the example above.
.LP
The user must arrange for a sentinel token to appear at the end of input
(and provide a rule for matching it):
\*(re does not provide an \fC<<EOF>>\fP expression.
If the source is from a null-byte terminated string, a
rule matching a null character will suffice. If the source is from a
file then you could pad the input with a newline (or some other character that
cannot appear within another token); upon recognizing such a character check
to see if it is the sentinel and act accordingly. And you can also use YYFILL(n)
to end the scanner in case not enough characters are available which is nothing
else then e detection of end of data/file.
.SH BUGS
.LP
Difference only works for character sets.
.LP
The \*(re internal algorithms need documentation.
.SH "SEE ALSO"
.LP
flex(1), lex(1).
.P
More information on \*(re can be found here:
.PD 0
.P
.B http://re2c.org/
.PD 1
.SH AUTHORS
.PD 0
.P
Peter Bumbulis <peter@csg.uwaterloo.ca>
.P
Brian Young <bayoung@acm.org>
.P
Dan Nuffer <nuffer@users.sourceforge.net>
.P
Marcus Boerger <helly@users.sourceforge.net>
.P
Hartmut Kaiser <hkaiser@users.sourceforge.net>
.P
Emmanuel Mogenet <mgix@mgix.com> added storable state
.P
.PD 1
.SH VERSION INFORMATION
This manpage describes \*(re, version @PACKAGE_VERSION@.
.fi
-52
View File
@@ -1,52 +0,0 @@
Summary: A tool for generating C-based recognizers from regular expressions
Name: @PACKAGE_NAME@
Version: @PACKAGE_VERSION@
Release: @PACKAGE_RELEASE@
License: Public Domain
Group: Development/Tools
URL: http://re2c.org/
Source0: http://prdownloads.sourceforge.net/re2c/re2c-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
re2c is a great tool for writing fast and flexible lexers. It has
served many people well for many years and it deserves to be
maintained more actively. re2c is on the order of 2-3 times faster
than a flex based scanner, and its input model is much more
flexible.
%prep
%setup -q
%build
./configure \
--prefix=%{_prefix}
make re2c
#regenerate file scanner.cc
rm -f scanner.cc
./re2c -b scanner.re > scanner.cc
rm -f re2c scanner.o
make
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 0755 re2c $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
install -m 0755 re2c.1 $RPM_BUILD_ROOT%{_mandir}/man1
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Sun Jan 04 2003 Marcus Boerger <re2c@somabo.de>
- Initial version.
%files
%defattr(-,root,root)
%{_bindir}/re2c
%{_mandir}/man1/re2c.1*
%doc README examples doc/* lessons
+2 -2
View File
@@ -22,7 +22,7 @@ file(WRITE ../../../../rt^3/include/brlcad/brlcadversion.h
include_directories(
${BRLCAD_BINARY_DIR}/include
${BRLCAD_SOURCE_DIR}/include
${TCL_INCLUDE_PATH}
${TCL_INCLUDE_DIRS}
)
# build the BrlcadCore.dll
@@ -91,7 +91,7 @@ file(GLOB COREINTERFACE_HEADERS ../../../../rt^3/include/brlcad/*.h)
include_directories(
../../../../rt^3/include
${ZLIB_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
${OPENNURBS_INCLUDE_DIR}
)
+1 -1
View File
@@ -26,7 +26,7 @@ add_dependencies(cad_user managed_files)
# superset of what will be installed, but is the best available option without
# performing an actual install step.)
if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
target_include_directories(cad_user PUBLIC "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${INCLUDE_DIR}/brlcad")
target_include_directories(cad_user PUBLIC "${CMAKE_BINARY_DIR}/$<CONFIG>/${INCLUDE_DIR}/brlcad")
else(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
target_include_directories(cad_user PUBLIC "${CMAKE_BINARY_DIR}/${INCLUDE_DIR}/brlcad")
endif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
+3 -1
View File
@@ -1,3 +1,5 @@
find_package(ZLIB)
set(ADRT_INCLUDE_DIRS
${GCV_INCLUDE_DIRS}
${BRLCAD_SOURCE_DIR}/src/adrt
@@ -69,7 +71,7 @@ if(BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
)
BRLCAD_INCLUDE_DIRS(isst_dirs)
set(isst_libs libtclcad librender libdm ${TCL_LIBRARY} ${OPENGL_LIBRARIES} ${IMM32_LIBRARY} ${COMCTL32_LIBRARY} ${OPENGL32_LIBRARY})
set(isst_libs libtclcad librender libdm ${TCL_LIBRARIES} ${OPENGL_LIBRARIES} ${IMM32_LIBRARY} ${COMCTL32_LIBRARY} ${OPENGL32_LIBRARY})
BRLCAD_ADDDATA(isst.tcl tclscripts/isst)
BRLCAD_ADDEXEC(isst isst.c "${isst_libs}" GUI)
+3 -1
View File
@@ -1,3 +1,5 @@
find_package(ZLIB)
set(ADRT_MASTER_SOURCES
../tienet.c
compnet.c
@@ -6,7 +8,7 @@ set(ADRT_MASTER_SOURCES
tienet_master.c
)
BRLCAD_ADDEXEC(adrt_master "${ADRT_MASTER_SOURCES}" librt)
BRLCAD_ADDEXEC(adrt_master "${ADRT_MASTER_SOURCES}" "librt;${ZLIB_LIBRARY}")
set(adrt_master_ignore_files
CMakeLists.txt
+1
View File
@@ -1,3 +1,4 @@
find_package(TCL)
if(TARGET libtclcad)
set(BWISH_INCLUDE_DIRS
+4 -2
View File
@@ -372,14 +372,14 @@ register_cmds(Tcl_Interp *interp, struct bu_cmdtab *cmds)
}
}
#if 0
#ifdef BWISH
/* structure provided in libtclcad. provides -format pix-n-w support.
* doesn't really seem to be used anywhere except here.
*/
extern Tk_PhotoImageFormat tkImgFmtPIX;
#endif
#endif
int
cmdInit(Tcl_Interp *interp)
@@ -395,9 +395,11 @@ cmdInit(Tcl_Interp *interp)
/* Register bwish/btclsh commands */
register_cmds(interp, bwish_cmds);
#if 0
#ifdef BWISH
/* Add pix format for images */
Tk_CreatePhotoImageFormat(&tkImgFmtPIX);
#endif
#endif
/* initialize command history */
+3 -10
View File
@@ -15,22 +15,15 @@ CHECK_CXX_FLAG("wd4800") # implicit conversions to bool
# Also quell a GCC warning for similar reasons.
CHECK_CXX_FLAG("Wno-ignored-qualifiers")
find_package(STEPCODE)
set(STEPCODE_DIR ${BRLCAD_SOURCE_DIR}/src/other/stepcode)
set(STEP_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${BU_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
${WDB_INCLUDE_DIRS}
${STEPCODE_DIR}/include
${STEPCODE_DIR}/src/base
${STEPCODE_DIR}/src/clstepcore
${STEPCODE_DIR}/src/cleditor
${STEPCODE_DIR}/src/clutils
${STEPCODE_DIR}/src/cldai
${STEPCODE_DIR}/src/test
${CMAKE_BINARY_DIR}/src/other/stepcode/include
${STEPCODE_INCLUDE_DIRS}
${BRLCAD_SOURCE_DIR}/src/libbrep #Temporary until headers reworked
)
BRLCAD_INCLUDE_DIRS(STEP_INCLUDE_DIRS)
@@ -72,7 +65,7 @@ macro(GENERATE_SCHEMA_INPUTS SCHEMA_FILE TARGET_SUFFIX)
)
add_custom_command(OUTPUT ${EXPRESS_OUTPUT} ${SCHEMA_OUT_DIR}/step_express_${SCHEMA_NAME}.done
COMMAND ${EXP2CXX_EXEC} ARGS ${SCHEMA_FILE} > ${SCHEMA_OUT_DIR}/step_express_${SCHEMA_NAME}.log 2>&1
COMMAND ${EXP2CXX_EXECUTABLE} ARGS ${SCHEMA_FILE} > ${SCHEMA_OUT_DIR}/step_express_${SCHEMA_NAME}.log 2>&1
COMMAND ${CMAKE_COMMAND} -E touch ${SCHEMA_OUT_DIR}/step_express_${SCHEMA_NAME}.done
DEPENDS ${SCHEMA_FILE} ${EXP2CXX_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${SCHEMA_OUT_DIR}
+3
View File
@@ -2,10 +2,13 @@ set(AP203_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../step-g
${BRLCAD_BINARY_DIR}/${INCLUDE_DIR}/stepcode
${OPENNURBS_INCLUDE_DIRS}
)
BRLCAD_INCLUDE_DIRS(AP203_INCLUDE_DIRS)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap203e2/ap203e2_mim_lf.exp)
add_definitions(-DAP203e2)
+4
View File
@@ -3,8 +3,12 @@ set(AP214_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../step-g
${BRLCAD_BINARY_DIR}/${INCLUDE_DIR}/stepcode
${OPENNURBS_INCLUDE_DIRS}
)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
BRLCAD_INCLUDE_DIRS(AP214_INCLUDE_DIRS)
set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap214e3/AP214E3_2010.exp)
+5 -1
View File
@@ -2,11 +2,15 @@ set(AP242_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../step-g
${BRLCAD_BINARY_DIR}/${INCLUDE_DIR}/stepcode
${OPENNURBS_INCLUDE_DIRS}
)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
BRLCAD_INCLUDE_DIRS(AP242_INCLUDE_DIRS)
set(STEP_SCHEMA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../../other/stepcode/data/ap242/ap242e1.exp)
set(STEP_SCHEMA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../../superbuild/stepcode/data/ap242/ap242e1.exp)
add_definitions(-DAP242)
GENERATE_SCHEMA_INPUTS(${STEP_SCHEMA_FILE} ap242g)
+4
View File
@@ -1,8 +1,12 @@
set(AP203_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${BRLCAD_BINARY_DIR}/${INCLUDE_DIR}/stepcode
${OPENNURBS_INCLUDE_DIRS}
)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
BRLCAD_INCLUDE_DIRS(AP203_INCLUDE_DIRS)
set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap203e2/ap203e2_mim_lf.exp)
+4
View File
@@ -2,8 +2,12 @@ set(AP214_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../g-step
${BRLCAD_BINARY_DIR}/${INCLUDE_DIR}/stepcode
${OPENNURBS_INCLUDE_DIRS}
)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
BRLCAD_INCLUDE_DIRS(AP214_INCLUDE_DIRS)
set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap214e3/AP214E3_2010.exp)
+5 -1
View File
@@ -2,11 +2,15 @@ set(AP242_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../g-step
${BRLCAD_BINARY_DIR}/${INCLUDE_DIR}/stepcode
${OPENNURBS_INCLUDE_DIRS}
)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
BRLCAD_INCLUDE_DIRS(AP242_INCLUDE_DIRS)
set(STEP_SCHEMA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../../other/stepcode/data/ap242/ap242e1.exp)
set(STEP_SCHEMA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../../superbuild/stepcode/data/ap242/ap242e1.exp)
add_definitions(-DAP242)
GENERATE_SCHEMA_INPUTS(${STEP_SCHEMA_FILE} gap242)
+4 -1
View File
@@ -2,9 +2,12 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${STEPCODE_INCLUDE_DIRS}
)
set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap203/ap203.exp)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
set(STEP_SCHEMA_FILE ${CMAKE_SOURCE_DIR}/src/superbuild/stepcode/data/ap203/ap203.exp)
add_definitions(-DAP203)
GENERATE_SCHEMA_INPUTS(${STEP_SCHEMA_FILE} gstep)
+4
View File
@@ -1,8 +1,12 @@
set(IFC_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${BRLCAD_BINARY_DIR}/${INCLUDE_DIR}/stepcode
${OPENNURBS_INCLUDE_DIRS}
)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
BRLCAD_INCLUDE_DIRS(IFC_INCLUDE_DIRS)
set(IFC_SCHEMA_FILE ${STEPCODE_DIR}/data/ifc4/IFC4.exp)
+5 -2
View File
@@ -1,11 +1,14 @@
set(AP203_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${OPENNURBS_INCLUDE_DIRS}
${OPENNURBS_INCLUDE_DIR}
${STEPCODE_INCLUDE_DIRS}
)
BRLCAD_INCLUDE_DIRS(AP203_INCLUDE_DIRS)
set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap203/ap203.exp)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
set(STEP_SCHEMA_FILE ${CMAKE_SOURCE_DIR}/src/superbuild/stepcode/data/ap203/ap203.exp)
add_definitions(-DAP203)
#set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap203e2/ap203e2_mim_lf.exp)
#add_definitions(-DAP203e2)
+4 -1
View File
@@ -1,9 +1,12 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${STEPCODE_INCLUDE_DIRS}
)
set(STEP_SCHEMA_FILE ${STEPCODE_DIR}/data/ap203/ap203.exp)
link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})
set(STEP_SCHEMA_FILE ${CMAKE_SOURCE_DIR}/src/superbuild/stepcode/data/ap203/ap203.exp)
add_definitions(-DAP203)
GENERATE_SCHEMA_INPUTS(${STEP_SCHEMA_FILE} list_elements)
+2 -2
View File
@@ -345,8 +345,8 @@ else(NOT DEFINED BRLCAD_BUILDTEST_EXTERNALS)
"${CMAKE_CURRENT_BINARY_DIR}/../../../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/other/openNURBS"
"${ZLIB_INCLUDE_DIRS}"
"${REGEX_INCLUDE_DIRS}"
${ZLIB_INCLUDE_DIRS}
${REGEX_INCLUDE_DIRS}
)
# The build shims aren't so great at mocking the initialization
+2 -2
View File
@@ -11,8 +11,8 @@ else(NOT DEFINED BRLCAD_BUILDTEST_EXTERNALS)
"${CMAKE_CURRENT_BINARY_DIR}/../../../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/other/openNURBS"
"${ZLIB_INCLUDE_DIRS}"
"${REGEX_INCLUDE_DIRS}"
${ZLIB_INCLUDE_DIRS}
${REGEX_INCLUDE_DIRS}
)
# The build shims aren't so great at mocking the initialization
+3 -3
View File
@@ -15,9 +15,9 @@ else(NOT DEFINED BRLCAD_BUILDTEST_EXTERNALS)
"${CMAKE_CURRENT_BINARY_DIR}/../../../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/other/openNURBS"
"${ZLIB_INCLUDE_DIRS}"
"${REGEX_INCLUDE_DIRS}"
"${TCL_INCLUDE_PATH}"
${ZLIB_INCLUDE_DIRS}
${REGEX_INCLUDE_DIRS}
${TCL_INCLUDE_PATH}
)
# The build shims aren't so great at mocking the initialization
+3 -2
View File
@@ -4,7 +4,8 @@ set(BG_INCLUDE_DIRS
${BRLCAD_SOURCE_DIR}/include
${BN_INCLUDE_DIRS}
${BU_INCLUDE_DIRS}
${P2T_INCLUDE_DIR}
${POLY2TRI_INCLUDE_DIR}
${SPSR_INCLUDE_DIR}
)
BRLCAD_LIB_INCLUDE_DIRS(bg BG_INCLUDE_DIRS "")
@@ -72,7 +73,7 @@ set(LIBBG_SOURCES
util.c
)
BRLCAD_ADDLIB(libbg "${LIBBG_SOURCES}" "libbn;libbu;${P2T_LIBRARY}")
BRLCAD_ADDLIB(libbg "${LIBBG_SOURCES}" "libbn;libbu;${POLY2TRI_LIBRARY}")
set_target_properties(libbg PROPERTIES VERSION 20.0.1 SOVERSION 20)
if (HIDE_INTERNAL_SYMBOLS)
if (TARGET poly2tri OR HIDE_INTERNAL_SYMBOLS_EXT)
+4 -4
View File
@@ -4,14 +4,14 @@ set(BREP_INCLUDE_DIRS
${BRLCAD_SOURCE_DIR}/include
${BU_INCLUDE_DIRS}
${BN_INCLUDE_DIRS}
${P2T_INCLUDE_DIR}
${OPENNURBS_INCLUDE_DIRS}
${POLY2TRI_INCLUDE_DIR}
${OPENNURBS_INCLUDE_DIR}
)
# locally used but not needed by users of the library
set(BREP_LOCAL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${REGEX_INCLUDE_DIR}
${REGEX_INCLUDE_DIRS}
${BRLCAD_SOURCE_DIR}/src/other/Eigen
)
@@ -49,7 +49,7 @@ set(LIBBREP_SOURCES
tools/util.cpp
)
BRLCAD_ADDLIB(libbrep "${LIBBREP_SOURCES}" "libbg;libbn;libbu;${OPENNURBS_LIBRARIES};${P2T_LIBRARY};${WINSOCK_LIB};${RPCRT_LIB};${STDCXX_LIBRARIES}")
BRLCAD_ADDLIB(libbrep "${LIBBREP_SOURCES}" "libbg;libbn;libbu;${OPENNURBS_LIBRARY};${POLY2TRI_LIBRARY};${WINSOCK_LIB};${RPCRT_LIB};${STDCXX_LIBRARIES}")
set_target_properties(libbrep PROPERTIES VERSION 20.0.1 SOVERSION 20)
if(HIDE_INTERNAL_SYMBOLS)
+3
View File
@@ -561,6 +561,9 @@ vdir(char *result, size_t len, va_list args)
cpath = _bu_dir_brlcad_root(BRLCAD_MAN_DIR, 1);
path_append(&vls, cpath);
break;
case BU_DIR_INSTALL:
bu_vls_strcat(&vls, BRLCAD_ROOT);
break;
case BU_DIR_TEMP:
cpath = dir_temp(buf, MAXPATHLEN);
path_append(&vls, cpath);
+4 -2
View File
@@ -1,3 +1,5 @@
find_package(PNG)
# Include directories needed by libdm users
set(DM_INCLUDE_DIRS
${BRLCAD_BINARY_DIR}/include
@@ -7,7 +9,7 @@ set(DM_INCLUDE_DIRS
${ICV_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
${X11_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
${PNG_INCLUDE_DIR}
)
# local includes
@@ -83,7 +85,7 @@ set(LIBDM_SRCS
)
set_property(SOURCE dm_obj.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
set_property(SOURCE dm_init.cpp APPEND PROPERTY COMPILE_DEFINITIONS "DM_PLUGIN_SUFFIX=\"${CMAKE_SHARED_LIBRARY_SUFFIX}\"")
BRLCAD_ADDLIB(libdm "${LIBDM_SRCS}" "librt;libicv;libbu;libpkg;${OPENGL_LIBRARIES};${PNG_LIBRARIES}")
BRLCAD_ADDLIB(libdm "${LIBDM_SRCS}" "librt;libicv;libbu;libpkg;${OPENGL_LIBRARIES};${PNG_LIBRARY}")
set_target_properties(libdm PROPERTIES VERSION 20.0.1 SOVERSION 20)
if (TARGET profont_ProFont_ttf_cp)
+3
View File
@@ -15,6 +15,9 @@ if(WIN32 AND BRLCAD_ENABLE_OPENGL)
${OPENGL_INCLUDE_DIR_GL}
${TCL_INCLUDE_PATH}
${TK_INCLUDE_PATH}
# Needed for tkWinInt.h
${CMAKE_CURRENT_SOURCE_DIR}/../../superbuild/tk/generic
${CMAKE_CURRENT_SOURCE_DIR}/../../superbuild/tk/win
)
set_property(SOURCE dm-wgl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
set(_LEMON_SEARCHES)
# Search LEMON_ROOT first if it is set.
if(LEMON_ROOT)
set(_LEMON_SEARCH_ROOT PATHS ${LEMON_ROOT} NO_DEFAULT_PATH)
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_ROOT)
endif()
# Normal search.
set(_LEMON_x86 "(x86)")
set(_LEMON_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/lemon"
"$ENV{ProgramFiles${_LEMON_x86}}/lemon")
unset(_LEMON_x86)
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_NORMAL)
set(LEMON_NAMES lemon)
# Try each search configuration.
foreach(search ${_LEMON_SEARCHES})
find_program(LEMON_EXECUTABLE lemon ${${search}} PATH_SUFFIXES bin)
endforeach()
mark_as_advanced(LEMON_EXECUTABLE)
foreach(search ${_LEMON_SEARCHES})
find_file(LEMON_TEMPLATE lempar.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/lemon)
endforeach()
mark_as_advanced(LEMON_TEMPLATE)
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
# look for the template in share
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
@@ -113,6 +139,10 @@ if(NOT COMMAND LEMON_TARGET)
CMAKE_PARSE_ARGUMENTS(${LVAR_PREFIX} "" "OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR;EXTRA_ARGS" "" ${ARGN})
endif(${ARGC} GREATER 3)
if (TARGET perplex_stage)
set(DEPS_TARGET perplex_stage)
endif (TARGET perplex_stage)
# Need a working directory
if("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
set(${LVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LVAR_PREFIX}")
@@ -161,7 +191,7 @@ if(NOT COMMAND LEMON_TARGET)
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
COMMAND ${CMAKE_COMMAND} -E copy ${lemon_in_file} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
DEPENDS ${Input} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
DEPENDS ${Input} ${LEMON_EXECUTABLE_TARGET} ${DEPS_TARGET}
WORKING_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR}
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
)
@@ -171,7 +201,7 @@ if(NOT COMMAND LEMON_TARGET)
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${${LVAR_PREFIX}_OUT_SRC_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE} ${DEPS_TARGET}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_SRC_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
@@ -179,7 +209,7 @@ if(NOT COMMAND LEMON_TARGET)
add_custom_command(
OUTPUT ${${LVAR_PREFIX}_OUT_HDR_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${${LVAR_PREFIX}_OUT_HDR_FILE}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER} ${DEPS_TARGET}
)
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_HDR_FILE} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
@@ -44,9 +44,35 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(PERPLEX_EXECUTABLE perplex DOC "path to the perplex executable")
set(_PERPLEX_SEARCHES)
# Search PERPLEX_ROOT first if it is set.
if(PERPLEX_ROOT)
set(_PERPLEX_SEARCH_ROOT PATHS ${PERPLEX_ROOT} NO_DEFAULT_PATH)
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_ROOT)
endif()
# Normal search.
set(_PERPLEX_x86 "(x86)")
set(_PERPLEX_SEARCH_NORMAL
PATHS "$ENV{ProgramFiles}/perplex"
"$ENV{ProgramFiles${_PERPLEX_x86}}/perplex")
unset(_PERPLEX_x86)
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_NORMAL)
set(PERPLEX_NAMES perplex)
# Try each search configuration.
foreach(search ${_PERPLEX_SEARCHES})
find_program(PERPLEX_EXECUTABLE perplex ${${search}} PATH_SUFFIXES bin)
endforeach()
mark_as_advanced(PERPLEX_EXECUTABLE)
foreach(search ${_PERPLEX_SEARCHES})
find_file(PERPLEX_TEMPLATE perplex_template.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/perplex)
endforeach()
mark_as_advanced(PERPLEX_TEMPLATE)
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} PATH)
if(perplex_path)
@@ -141,6 +167,10 @@ if(NOT COMMAND PERPLEX_TARGET)
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
set(PVAR_PREFIX ${Name}_${IN_FILE_WE})
if (TARGET perplex_stage)
set(DEP_TARGET perplex_stage)
endif (TARGET perplex_stage)
if(${ARGC} GREATER 3)
CMAKE_PARSE_ARGUMENTS(${PVAR_PREFIX} "" "TEMPLATE;OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR" "" ${ARGN})
endif(${ARGC} GREATER 3)
@@ -200,7 +230,7 @@ if(NOT COMMAND PERPLEX_TARGET)
OUTPUT ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${perplex_in_file} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${${PVAR_PREFIX}_OUT_HDR_FILE} -t ${${PVAR_PREFIX}_TEMPLATE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
DEPENDS ${Input} ${${PVAR_PREFIX}_TEMPLATE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
)
@@ -209,7 +239,7 @@ if(NOT COMMAND PERPLEX_TARGET)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
@@ -217,7 +247,7 @@ if(NOT COMMAND PERPLEX_TARGET)
add_custom_command(
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
+5 -2
View File
@@ -1,8 +1,11 @@
find_package(PNG)
find_package(NETPBM)
set(ICV_INCLUDE_DIRS
${BRLCAD_BINARY_DIR}/include
${BRLCAD_SOURCE_DIR}/include
${BU_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${PNG_INCLUDE_DIR}
${NETPBM_INCLUDE_DIR}
)
BRLCAD_LIB_INCLUDE_DIRS(icv ICV_INCLUDE_DIRS "")
@@ -24,7 +27,7 @@ set(LIBICV_SOURCES
dpix.c
)
BRLCAD_ADDLIB(libicv "${LIBICV_SOURCES}" "libbu;libbn;${PNG_LIBRARIES};${NETPBM_LIBRARY}")
BRLCAD_ADDLIB(libicv "${LIBICV_SOURCES}" "libbu;libbn;${PNG_LIBRARY};${NETPBM_LIBRARY}")
set_target_properties(libicv PROPERTIES VERSION 20.0.1 SOVERSION 20)
if (HIDE_INTERNAL_SYMBOLS)
if (TARGET netpbm OR HIDE_INTERNAL_SYMBOLS_EXT)
+1 -1
View File
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h> /* for file mode info in WRMODE */
#include "png.h"
#include <png.h>
#include "bio.h"
+1 -1
View File
@@ -5,7 +5,7 @@ set(OPTICAL_INCLUDE_DIRS
${BU_INCLUDE_DIRS}
${BN_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
${TCL_INCLUDE_PATH}
${TCL_INCLUDE_DIRS}
)
if (BRLCAD_ENABLE_TCL)
set(OPTICAL_INCLUDE_DIRS ${OPTICAL_INCLUDE_DIRS} ${TCL_INCLUDE_PATH})
+1 -1
View File
@@ -5,7 +5,7 @@ set(PC_INCLUDE_DIRS
)
if(BRLCAD_ENABLE_GECODE)
set(PC_INCLUDE_DIRS ${PC_INCLUDE_DIRS} ${GECODE_INCLUDE_DIR})
set(PC_INCLUDE_DIRS ${PC_INCLUDE_DIRS} ${GECODE_INCLUDE_DIRS})
set(PC_LOCAL_INCLUDE_DIRS)
BRLCAD_LIB_INCLUDE_DIRS(pc PC_INCLUDE_DIRS PC_LOCAL_INCLUDE_DIRS)
BRLCAD_ADDEXEC(cartesian-heart cartesian-heart.cpp "${GECODE_LIBRARIES}" NO_INSTALL)
+3 -4
View File
@@ -7,7 +7,6 @@ set(RT_INCLUDE_DIRS
${BG_INCLUDE_DIRS}
${NMG_INCLUDE_DIRS}
${BREP_INCLUDE_DIRS}
${P2T_INCLUDE_DIR}
${OPENNURBS_INCLUDE_DIRS}
)
@@ -19,9 +18,9 @@ endif (BRLCAD_ENABLE_OPENCL)
# locally used but not needed by users of the library
set(RT_LOCAL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${REGEX_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/vds
${CMAKE_CURRENT_SOURCE_DIR}/gdiam
${REGEX_INCLUDE_DIRS}
)
BRLCAD_LIB_INCLUDE_DIRS(rt RT_INCLUDE_DIRS RT_LOCAL_INCLUDE_DIRS)
@@ -361,10 +360,10 @@ if(BRLCAD_ENABLE_OPENCL)
endif(BRLCAD_ENABLE_OPENCL)
if(BRLCAD_ENABLE_SPR)
set(SPR_LIB libSPR)
set(SPR_LIB ${SPSR_LIBRARY})
endif(BRLCAD_ENABLE_SPR)
BRLCAD_ADDLIB(librt "${LIBRT_SOURCES}" "${OPENCL_LIBS};libbrep;libnmg;libbg;libbn;libbu;${OPENNURBS_LIBRARIES};${REGEX_LIBRARIES};${WINSOCK_LIB};${RPCRT_LIB};${STDCXX_LIBRARIES}")
BRLCAD_ADDLIB(librt "${LIBRT_SOURCES}" "${OPENCL_LIBS};libbrep;libnmg;libbg;libbn;libbu;${OPENNURBS_LIBRARY};${REGEX_LIBRARY};${WINSOCK_LIB};${RPCRT_LIB};${STDCXX_LIBRARIES}")
set_target_properties(librt PROPERTIES VERSION 20.0.1 SOVERSION 20)
if(HIDE_INTERNAL_SYMBOLS)
+4 -4
View File
@@ -188,7 +188,7 @@ rt_dsp_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
ON_3dPoint *ctrlpt = new ON_3dPoint(p_ctrl);
bezpoints1.Append(*ctrlpt);
}
ON_BezierCurve s1_bez3d((const ON_3dPointArray)bezpoints1);
ON_BezierCurve s1_bez3d(bezpoints1);
ON_NurbsCurve* s1_beznurb3d = ON_NurbsCurve::New();
s1_bez3d.GetNurbForm(*s1_beznurb3d);
s1_beznurb3d->SetDomain(0.0, 1.0);
@@ -238,7 +238,7 @@ rt_dsp_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
ON_3dPoint ctrlpt(p_ctrl);
bezpoints2.Append(ctrlpt);
}
ON_BezierCurve s2_bez3d((const ON_3dPointArray)bezpoints2);
ON_BezierCurve s2_bez3d(bezpoints2);
ON_NurbsCurve* s2_beznurb3d = ON_NurbsCurve::New();
s2_bez3d.GetNurbForm(*s2_beznurb3d);
s2_beznurb3d->SetDomain(0.0, 1.0);
@@ -289,7 +289,7 @@ rt_dsp_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
ON_3dPoint ctrlpt(p_ctrl);
bezpoints3.Append(ctrlpt);
}
ON_BezierCurve s3_bez3d((const ON_3dPointArray)bezpoints3);
ON_BezierCurve s3_bez3d(bezpoints3);
ON_NurbsCurve* s3_beznurb3d = ON_NurbsCurve::New();
s3_bez3d.GetNurbForm(*s3_beznurb3d);
s3_beznurb3d->SetDomain(0.0, 1.0);
@@ -339,7 +339,7 @@ rt_dsp_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
ON_3dPoint ctrlpt(p_ctrl);
bezpoints4.Append(ctrlpt);
}
ON_BezierCurve s4_bez3d((const ON_3dPointArray)bezpoints4);
ON_BezierCurve s4_bez3d(bezpoints4);
ON_NurbsCurve* s4_beznurb3d = ON_NurbsCurve::New();
s4_bez3d.GetNurbForm(*s4_beznurb3d);
s4_beznurb3d->SetDomain(0.0, 1.0);
@@ -221,7 +221,7 @@ rt_revolve_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_to
for (int j = 0; j < bsg->degree + 1; j++) {
bezpoints.Append((*b)->m_V[bsg->ctl_points[j]].Point());
}
ON_BezierCurve bez3d = ON_BezierCurve((const ON_3dPointArray)bezpoints);
ON_BezierCurve bez3d = ON_BezierCurve(bezpoints);
ON_NurbsCurve* beznurb3d = ON_NurbsCurve::New();
bez3d.GetNurbForm(*beznurb3d);
beznurb3d->SetDomain(0.0, 1.0);
+1 -1
View File
@@ -201,7 +201,7 @@ rt_sketch_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol
for (int j = 0; j < bsg->degree + 1; j++) {
bezpoints.Append((*b)->m_V[bsg->ctl_points[j]].Point());
}
ON_BezierCurve bez3d = ON_BezierCurve((const ON_3dPointArray)bezpoints);
ON_BezierCurve bez3d = ON_BezierCurve(bezpoints);
ON_NurbsCurve* beznurb3d = ON_NurbsCurve::New();
bez3d.GetNurbForm(*beznurb3d);
beznurb3d->SetDomain(0.0, 1.0);
+5 -1
View File
@@ -318,6 +318,10 @@ _tclcad_bu_dir_print(const char *dirkey, int fail_quietly)
snprintf(result, MAXPATHLEN, "%s", bu_dir(NULL, 0, BU_DIR_MAN, NULL));
return result;
}
if (BU_STR_EQUIV(dirkey, "install") || BU_STR_EQUAL(dirkey, "BU_DIR_INSTALL")) {
snprintf(result, MAXPATHLEN, "%s", bu_dir(NULL, 0, BU_DIR_INSTALL, NULL));
return result;
}
if (BU_STR_EQUIV(dirkey, "temp") || BU_STR_EQUAL(dirkey, "BU_DIR_TEMP")) {
snprintf(result, MAXPATHLEN, "%s", bu_dir(NULL, 0, BU_DIR_TEMP, NULL));
return result;
@@ -365,7 +369,7 @@ tcl_bu_dir(void *clientData,
{
Tcl_Interp *interp = (Tcl_Interp *)clientData;
if (argc != 2) {
bu_log("Usage: bu_dir [curr|init|bin|lib|libexec|include|data|doc|man|temp|home|cache|config|ext|libext]\n");
bu_log("Usage: bu_dir [curr|init|bin|lib|libexec|include|data|doc|man|install|temp|home|cache|config|ext|libext]\n");
return BRLCAD_ERROR;
}
Tcl_AppendResult(interp, _tclcad_bu_dir_print(argv[1],1), NULL);
+2 -3
View File
@@ -6,12 +6,11 @@ set(WDB_INCLUDE_DIRS
${BN_INCLUDE_DIRS}
${NMG_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
${SYSV_INCLUDE_DIRS}
${OPENNURBS_INCLUDE_DIRS}
)
BRLCAD_LIB_INCLUDE_DIRS(wdb WDB_INCLUDE_DIRS "")
set(LIBWDB_SOURCES
annot.c
arbn.c
@@ -40,7 +39,7 @@ set(LIBWDB_SOURCES
wdb.c
)
BRLCAD_ADDLIB(libwdb "${LIBWDB_SOURCES}" "librt;libnmg;libbn;libbu;${OPENNURBS_LIBRARIES}")
BRLCAD_ADDLIB(libwdb "${LIBWDB_SOURCES}" "librt;libnmg;libbn;libbu;${OPENNURBS_LIBRARIES};${REGEX_LIBRARY}")
set_target_properties(libwdb PROPERTIES VERSION 20.0.1 SOVERSION 20)
CMAKEFILES(CMakeLists.txt)
+64 -838
View File
@@ -1,28 +1,22 @@
#-----------------------------------------------------------------------
# Local Copies of External Libraries
# Bundled External Libraries and other 3rd party components.
#
# BRL-CAD depends on a variety of external libraries and tools -
# rather than fail if those requirements are not satisfied, we build
# local copies at need.
# In general, source code here will meet one of the following criteria:
#
# There are three overall approaches to the handling of these
# dependencies:
# 1. A third party library where BRL-CAD has had to make local
# modifications that are essential to our use of the library,
# precluding the use of a system-supplied version, and the library
# is not readily integrable into BRL-CAD's own compilation.
#
# 1. Auto - detect system libraries and use them if suitable,
# otherwise build and use the local copy. This is the default
# approach.
# 2. A header only library or some other component used in the
# compilation of multiple parts of BRL-CAD (i.e. it isn't practical
# to locate it with the logic that uses it.)
#
# 2. Bundled - regardless of system conditions, build and use all
# bundled libraries.
#
# 3. System - fail to build if the system libraries do not satisfy
# requirements. This is primarily useful for distributions that
# want to ensure packages are using external libraries.
#
# In addition to the broad toplevel control, individual libraries can
# also be overridden - for example, if the toplevel setting is for
# Bundled libs, it is still possible to request a system library in
# individual cases.
# 3. A third party component that is not widely available in the
# the broader software ecosystem. Since we know we will
# always be building those components, there isn't any gain or
# justification for the increased complexity of maintaining a
# superbuild detect-and-build-if-needed approach to support it.
#
#-----------------------------------------------------------------------
@@ -43,19 +37,6 @@ unset(CMAKE_CXX_EXTENSIONS)
unset(CMAKE_CXX_STANDARD_REQUIRED)
unset(CMAKE_CXX_STANDARD)
###############################################################################
# We never want our build products to be identified by searches here - we
# either want system installed versions or nothing. Set CMAKE_IGNORE_PATH
# values accordingly. NOTE: we must specify EXPLICITY all directories to
# ignore as CMAKE_IGNORE_PATH does not automatically ignore subdirectories:
# https://cmake.org/cmake/help/latest/variable/CMAKE_IGNORE_PATH.html#variable:CMAKE_IGNORE_PATH
set(CMAKE_IGNORE_PATH
${CMAKE_BINARY_DIR}/${BIN_DIR}
${CMAKE_BINARY_DIR}/${LIB_DIR}
${CMAKE_INSTALL_PREFIX}/${BIN_DIR}
${CMAKE_INSTALL_PREFIX}/${LIB_DIR}
)
###############################################################################
# Unlike the misc/tools directory components built in src/other are part of
# the distribution, not just the compilation. Hence we need to make sure of
@@ -79,6 +60,15 @@ endif(${CMAKE_WORD_SIZE} MATCHES "32BIT" AND NOT MSVC AND DEFINED 32BIT_FLAG)
###############################################################################
# If we're using a bundled zlib with a prefix defined, we need a definition
# flag.
# TODO - is there some target property we can use to pass this automatically?
# Hammering it at high levels is almost certainly not the right approach...
if (Z_PREFIX_STR)
add_definitions(-DZ_PREFIX)
add_definitions(-DZ_PREFIX_STR=${Z_PREFIX_STR})
endif (Z_PREFIX_STR)
# Set a variable that will tell build logic in subdirectories that there is a
# parent build. This will in some cases disable attempts to define settings
# such as RPATH values that we need the parent build to manage.
@@ -108,751 +98,30 @@ endforeach(ITEM ${dlists})
set(SKIP_INSTALL_HEADERS TRUE CACHE BOOL "Don't install src/other headers" FORCE)
mark_as_advanced(SKIP_INSTALL_HEADERS)
# libregex library - often needed by tools, so do this one first.
set(regex_DESCRIPTION "
Option for enabling and disabling compilation of the Regular
Expression Library 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.
")
set(REGEX_PREFIX_STR "brl_")
THIRD_PARTY(libregex REGEX regex regex_DESCRIPTION ALIASES ENABLE_REGEX)
BRLCAD_INCLUDE_FILE(regex.h HAVE_REGEX_H)
SetTargetFolder(regex "Third Party Libraries")
SetTargetFolder(regex-static "Third Party Libraries")
if (NOT BRLCAD_REGEX_BUILD)
set(REGEX_LIBRARIES ${REGEX_LIBRARY} CACHE STRING "REGEX_LIBRARIES" FORCE)
set(REGEX_INCLUDE_DIRS "${REGEX_INCLUDE_DIR}" CACHE STRING "REGEX include directory" FORCE)
else (NOT BRLCAD_REGEX_BUILD)
# Our own code (at least the Creo plugin, maybe others) may require our
# regex.h to build if compiling against an installed BRL-CAD's libs.
# Explicitly override the general suppression of header installs in this
# specific case.
get_directory_property(REGEX_HDRS DIRECTORY libregex DEFINITION REGEX_HDRS)
install(FILES ${REGEX_HDRS} DESTINATION ${INCLUDE_DIR})
endif (NOT BRLCAD_REGEX_BUILD)
# Same deal for zlib Library - common requirement, deal with it up front
set(zlib_DESCRIPTION "
Option for enabling and disabling compilation of the zlib library
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.
")
set(Z_PREFIX_STR "brl_")
THIRD_PARTY(libz ZLIB zlib zlib_DESCRIPTION ALIASES ENABLE_ZLIB ENABLE_LIBZ)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libz/CTestTestfile.cmake")
SetTargetFolder(zlib "Third Party Libraries")
SetTargetFolder(zlib-static "Third Party Libraries")
SetTargetFolder(example "Third Party Executables")
SetTargetFolder(minigzip "Third Party Executables")
if(BRLCAD_ZLIB_BUILD)
add_definitions(-DZ_PREFIX)
add_definitions(-DZ_PREFIX_STR=${Z_PREFIX_STR})
set(Z_PREFIX_STR "${Z_PREFIX_STR}" CACHE STRING "prefix for zlib functions" FORCE)
# Our own code (at least logic using OpenNURBS, maybe others) can require our
# zlib.h to build if compiling against an installed BRL-CAD's libs.
# Explicitly override the general suppression of header installs in this
# specific case.
get_directory_property(ZLIB_PUBLIC_HDRS DIRECTORY libz DEFINITION ZLIB_PUBLIC_HDRS)
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION ${INCLUDE_DIR})
else(BRLCAD_ZLIB_BUILD)
set(Z_PREFIX_STR "" CACHE STRING "clear prefix for zlib functions" FORCE)
set(Z_PREFIX_STR)
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY_RELEASE} CACHE STRING "ZLIB_LIBRARIES" FORCE)
set(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}" CACHE STRING "ZLIB include directory" FORCE)
endif(BRLCAD_ZLIB_BUILD)
# libpng Library - Checks for ZLIB, so need to handle libpng AFTER
# zlib to set the variables if using a local copy of zlib. If not
# using a local copy of zlib, FindZLIB results will be identical in
# both cases so there is no danger of harming the libpng setup. The
# PNG CMake system needs some options set and some variables
# translated to fit BRL-CAD's standard assumptions, so handle that
# here as well. BRL-CAD needs PNG's IO - turn it on (i.e. turn off
# the disabling flags)
set(SKIP_INSTALL_FILES ON CACHE BOOL "Don't install files from libpng" FORCE)
mark_as_advanced(SKIP_INSTALL_FILES)
set(SKIP_INSTALL_EXECUTABLES ON CACHE BOOL "Don't install files from libpng" FORCE)
mark_as_advanced(SKIP_INSTALL_EXECUTABLES)
set(PNG_NO_CONSOLE_IO OFF CACHE BOOL "Option to disable Console IO in PNG" FORCE)
mark_as_advanced(PNG_NO_CONSOLE_IO)
set(PNG_NO_STDIO OFF CACHE BOOL "Option to disable STDIO in PNG" FORCE)
mark_as_advanced(PNG_NO_STDIO)
set(SKIP_INSTALL_EXPORT ON CACHE BOOL "We dont't want export for this application" FORCE)
mark_as_advanced(SKIP_INSTALL_EXPORT)
set(PNG_MAN_DIR ${MAN_DIR} CACHE STRING "Set PNG_MAN_DIR to the global MAN_DIR" FORCE)
mark_as_advanced(PNG_MAN_DIR)
set(PNG_TESTS 0 CACHE STRING "Disable building png test executables" FORCE)
mark_as_advanced(PNG_TESTS)
set(PNG_PREFIX "brl_" CACHE STRING "BRL-CAD prefix for libpng" FORCE)
mark_as_advanced(PNG_PREFIX)
set(ld-version-script OFF CACHE STRING "Disable linker script" FORCE)
mark_as_advanced(ld-version-script)
mark_as_advanced(PNG_PREFIX)
mark_as_advanced(PNG_FRAMEWORK)
mark_as_advanced(DFA_XTRA)
mark_as_advanced(AWK)
set(CMAKE_INSTALL_LIBDIR ${LIB_DIR})
set(PNG_LIB_NAME png_brl)
set(png_DESCRIPTION "
Option for enabling and disabling compilation of the Portable Network
Graphics library 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.
")
# Note - we don't actually know the libpng build target name for the
# shared library at this point - use png as a stub and override
# once we know what PNG_LIB_NAME is.
set(CMAKE_FIND_FRAMEWORK LAST)
THIRD_PARTY(libpng PNG png png_DESCRIPTION REQUIRED_VARS BRLCAD_LEVEL2 ALIASES ENABLE_PNG)
if(BRLCAD_PNG_BUILD)
set(PNG_LIBRARY png CACHE STRING "PNG_LIBRARY" FORCE)
set(PNG_LIBRARIES png CACHE STRING "PNG_LIBRARIES" FORCE)
set(PNG_PNG_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libpng;${CMAKE_CURRENT_SOURCE_DIR}/libpng" CACHE STRING "PNG include directory" FORCE)
mark_as_advanced(PNG_PNG_INCLUDE_DIR)
set(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} CACHE STRING "PNG include directory" FORCE)
set(PNG_INCLUDE_DIRS ${PNG_INCLUDE_DIR} CACHE STRING "PNG include directory" FORCE)
# On Haiku the find_library call sets this variable directly, which is not
# how we handle things elsewhere in BRL-CAD - unset the variable in that
# situation so the remainder of the build logic works normally
if("${M_LIBRARY}" MATCHES "NOTFOUND")
unset(M_LIBRARY CACHE)
endif("${M_LIBRARY}" MATCHES "NOTFOUND")
SetTargetFolder(png "Third Party Libraries")
SetTargetFolder(png_static "Third Party Libraries")
SetTargetFolder(genfiles "Third Party Libraries")
else(BRLCAD_PNG_BUILD)
set(PNG_LIBRARIES ${PNG_LIBRARY_RELEASE} CACHE STRING "PNG_LIBRARIES" FORCE)
set(PNG_INCLUDE_DIRS "${PNG_PNG_INCLUDE_DIR}" CACHE STRING "PNG include directory" FORCE)
endif(BRLCAD_PNG_BUILD)
# Since SKIP_INSTALL_FILES doesn't have a PNG prefix, we'll unset it once we're done
unset(SKIP_INSTALL_FILES CACHE)
unset(SKIP_INSTALL_FILES)
unset(SKIP_INSTALL_EXECUTABLES CACHE)
unset(SKIP_INSTALL_EXECUTABLES)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libpng/CTestTestfile.cmake")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libpng/libpng.pc")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libpng/libpng-config")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libpng/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libpng/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}")
DISTCLEAN(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng.pc)
DISTCLEAN(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng-config)
DISTCLEAN(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
DISTCLEAN(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
# Other PNG options to mark as advanced
mark_as_advanced(PNGARG)
mark_as_advanced(PNG_DEBUG)
mark_as_advanced(PNG_SHARED)
mark_as_advanced(PNG_STATIC)
mark_as_advanced(uname_executable)
# libnetpbm Library support for pnm,ppm,pbm, etc. image files
set(netpbm_DESCRIPTION "
Option for enabling and disabling compilation of the netpbm 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.
")
THIRD_PARTY(libnetpbm NETPBM netpbm netpbm_DESCRIPTION REQUIRED_VARS BRLCAD_LEVEL2 ALIASES ENABLE_NETPBM)
if(BRLCAD_NETPBM_BUILD)
mark_as_advanced(NETPBM_INCLUDE_DIRS)
mark_as_advanced(NETPBM_LIBRARIES)
SetTargetFolder(netpbm "Third Party Libraries")
SetTargetFolder(netpbm-static "Third Party Libraries")
endif(BRLCAD_NETPBM_BUILD)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libnetpbm/version.h")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libnetpbm/compile.h")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/libnetpbm/pm_config.h")
# libutahrle Library - The directory to perform ADD_SUBDIRECTORY on
# and the include directory for utahrle are different, so override the
# macro's setting of UTAHRLE_INCLUDE_DIR here.
set(UTAHRLE_HAVE_COMMON_H 1)
set(utahrle_DESCRIPTION "
Option for enabling and disabling compilation of the Utah Raster
Toolkit 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.
")
THIRD_PARTY(libutahrle UTAHRLE utahrle utahrle_DESCRIPTION REQUIRED_VARS BRLCAD_LEVEL3
ALIASES ENABLE_UTAHRLE FLAGS NOSYS)
if(BRLCAD_UTAHRLE_BUILD)
SetTargetFolder(utahrle "Third Party Libraries")
SetTargetFolder(utahrle-static "Third Party Libraries")
if (BRLCAD_LEVEL3)
add_subdirectory(libutahrle)
set(UTAHRLE_INCLUDE_DIR "${BRLCAD_SOURCE_DIR}/src/other/libutahrle/include" CACHE STRING "directory with rle.h header" FORCE)
set(BRLCAD_UTAHRLE_INCLUDE_DIR "${UTAHRLE_INCLUDE_DIR}" CACHE STRING "directory with rle.h header" FORCE)
mark_as_advanced(UTAHRLE_INCLUDE_DIR)
mark_as_advanced(BRLCAD_UTAHRLE_INCLUDE_DIR)
endif(BRLCAD_UTAHRLE_BUILD)
####################################################################
# Tcl/Tk and related extensions
####################################################################
function(TCL_RESET_VARS)
unset(TCL_LIBRARY CACHE)
unset(TCL_STUB_LIBRARY CACHE)
unset(TCL_FOUND CACHE)
unset(TCLSH_FOUND CACHE)
unset(TCL_LIBRARY CACHE)
unset(TCL_INCLUDE_PATH CACHE)
unset(TCL_TCLSH CACHE)
unset(TCL_STUB_LIBRARY CACHE)
endfunction(TCL_RESET_VARS)
function(TK_RESET_VARS)
unset(TK_LIBRARY CACHE)
unset(TK_STUB_LIBRARY CACHE)
unset(TK_FOUND CACHE)
unset(TCLTK_FOUND CACHE)
unset(TK_LIBRARY CACHE)
unset(TK_INCLUDE_PATH CACHE)
unset(TK_WISH CACHE)
unset(TK_STUB_LIBRARY CACHE)
unset(TTK_STUB_LIBRARY CACHE)
endfunction(TK_RESET_VARS)
# Set the expected graphics system (if known) before any find_package
# calls related to Tcl
if(BRLCAD_ENABLE_AQUA)
set(TK_ENABLE_AQUA ON CACHE STRING "BRL-CAD setting to enable AQUA" FORCE)
set(TCL_TK_SYSTEM_GRAPHICS "aqua" CACHE STRING "Tk system graphics type" FORCE)
endif(BRLCAD_ENABLE_AQUA)
# Make sure we actually look for these each time...
TCL_RESET_VARS()
TK_RESET_VARS()
set(tcl_DESCRIPTION "
Option for enabling and disabling compilation of the Tcl 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.
")
THIRD_PARTY(tcl TCL tcl tcl_DESCRIPTION ALIASES ENABLE_TCL FIND_NAME TCL REQUIRED_VARS "BRLCAD_ENABLE_TCL;BRLCAD_LEVEL2")
if(BRLCAD_TCL_BUILD)
# Let the BRL-CAD compilation know we have Tcl
CONFIG_H_APPEND(BRLCAD "#define HAVE_TCL_H 1\n")
# There is no system init.tcl that we need to provide a path for
CONFIG_H_APPEND(BRLCAD "#define TCL_SYSTEM_INITTCL_PATH \"\"\n")
# Set the necessary variables ourselves since FindTCL.cmake doesn't know about our build
set(TCL_LIBRARY tcl CACHE STRING "TCL_LIBRARY" FORCE)
set(TCL_STUB_LIBRARY tclstub CACHE STRING "TCL_LIBRARY" FORCE)
set(TCL_TCLSH tclsh CACHE STRING "Tcl shell" FORCE)
set(TCL_VERSION_MAJOR "8" CACHE STRING "Tcl MAJOR version" FORCE)
set(TCL_VERSION_MINOR "6" CACHE STRING "Tcl MINOR version" FORCE)
# For the include path, use the TCL_INCLUDE_PATH set in the tcl build itself;
# we are not installing headers, so we have to look in the source tree
get_directory_property(TCL_INCLUDE_PATH DIRECTORY tcl DEFINITION TCL_INCLUDE_PATH)
set(TCL_INCLUDE_PATH "${TCL_INCLUDE_PATH}" CACHE STRING "Tcl include path" FORCE)
# Let Distclean know it will have work to do
DISTCLEAN("${CMAKE_BINARY_DIR}/${LIB_DIR}/tcl8")
DISTCLEAN("${CMAKE_BINARY_DIR}/${LIB_DIR}/tcl8.6")
# Group the targets in Visual Studio project files
SetTargetFolder(tclsh "Third Party Executables")
SetTargetFolder(tcl "Third Party Libraries")
SetTargetFolder(tclstub "Third Party Libraries")
elseif(BRLCAD_ENABLE_TCL)
# We're using the system Tcl, but need some extra information. FindTCL.cmake
# doesn't give us a stub library location, so we need to go find it ourselves.
get_filename_component(TCL_LIB_PATH "${TCL_LIBRARY}" DIRECTORY)
find_library(TCL_STUB_LIBRARY tclstub NAMES tclstub86 tclstub8.6 PATHS ${TCL_LIB_PATH})
# Make sure we've got the header file
BRLCAD_INCLUDE_FILE(tcl.h HAVE_TCL_H)
# We're going to need the path to the system init.tcl for btclsh and bwish -
# extract it from the system Tcl
set(inittcl_script "
set filename \"${CMAKE_BINARY_DIR}/CMakeTmp/tcl_inittcl\"
set fileID [open $filename \"w\"]
puts $fileID $auto_path
close $fileID
exit
")
set(inittcl_scriptfile "${CMAKE_BINARY_DIR}/CMakeTmp/tcl_inittcl.tcl")
file(WRITE ${inittcl_scriptfile} ${inittcl_script})
execute_process(COMMAND ${TCL_TCLSH} ${inittcl_scriptfile} OUTPUT_VARIABLE EXECOUTPUT)
file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/tcl_inittcl" tcl_inittcl_raw)
string(REGEX REPLACE "\n" "" tcl_inittcl_paths_1 ${tcl_inittcl_raw})
string(REGEX REPLACE " " ";" tcl_inittcl_paths ${tcl_inittcl_paths_1})
find_path(tcl_inittcl NAMES init.tcl PATHS ${tcl_inittcl_paths})
mark_as_advanced(tcl_inittcl)
CONFIG_H_APPEND(BRLCAD "#define TCL_SYSTEM_INITTCL_PATH \"${tcl_inittcl}\"\n")
endif(BRLCAD_TCL_BUILD)
mark_as_advanced(TCL_COMPILATION_TRACING)
mark_as_advanced(TCL_COMPILE_STATS)
mark_as_advanced(TCL_ENABLE_64BIT)
mark_as_advanced(TCL_TIMEZONE_DATA)
mark_as_advanced(TCL_STUB_LIBRARY)
mark_as_advanced(M_LIBRARY)
# Depending on the Tcl/Tk results, look for packages required by BRL-CAD. If
# building local Tcl/Tk, go ahead and enable all the packages as well - otherwise,
# check the found Tcl/Tk and enable what it doesn't supply. If doing a non-graphical
# build, only compile extensions that don't use Tk.
include("${BRLCAD_CMAKE_DIR}/ThirdParty_TCL.cmake")
# The first package to settle is Tk itself
set(tk_ALIASES ENABLE_TK)
set(tk_DESCRIPTION "
Option for enabling and disabling compilation of the Tk library
provided with BRL-CAD's source code. Default is AUTO, responsive to
the BRLCAD_TCL option and testing first for a system version if
BRLCAD_BUNDLED_LIBS is also AUTO. Option for enabling and disabling
compilation of the Tk graphics package for Tcl provided with BRL-CAD's
source distribution. Default is AUTO, auto-enabling if the BRLCAD_TCL
option is set to BUNDLED and testing first for a system version if
BRLCAD_TCL is set to AUTO or SYSTEM. If BRLCAD_TK is set to BUNDLED,
local copy is built even if a system version is present. This option
also depends on BRLCAD_ENABLE_TK being ON.
")
THIRD_PARTY_TCL_PACKAGE(Tk tk "${TCL_TCLSH}" "tcl" "BRLCAD_ENABLE_TCL;BRLCAD_ENABLE_TK;BRLCAD_LEVEL2" "tk" tk_ALIASES tk_DESCRIPTION)
if(BRLCAD_TK_BUILD)
# Let the BRL-CAD compilation know we have Tcl
CONFIG_H_APPEND(BRLCAD "#define HAVE_TK_H 1\n")
# Set the necessary variables ourselves since FindTCL.cmake doesn't know about our build
set(TK_LIBRARY tk CACHE STRING "TK_LIBRARY" FORCE)
set(TK_STUB_LIBRARY tkstub CACHE STRING "TK_LIBRARY" FORCE)
set(TK_WISH wish CACHE STRING "TK_WISH" FORCE)
# For the include path, use the TK_INCLUDE_PATH set in the tk build itself;
# we are not installing headers, so we have to look in the source tree
get_directory_property(TK_INCLUDE_PATH DIRECTORY tk DEFINITION TK_INCLUDE_PATH)
set(TK_INCLUDE_PATH "${TK_INCLUDE_PATH}" CACHE STRING "Tk include path" FORCE)
get_directory_property(TK_SYSTEM_GRAPHICS DIRECTORY tk DEFINITION TK_SYSTEM_GRAPHICS)
set(TK_SYSTEM_GRAPHICS "${TK_SYSTEM_GRAPHICS}" CACHE STRING "Tk system graphics type" FORCE)
# Let Distclean know it will have work to do both here and in
# the lib directory
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tk/doc/Makefile")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tk/doc/man1")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tk/doc/man3")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tk/doc/mann")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tk/library/Makefile")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tk/pkgIndex.tcl")
DISTCLEAN("${CMAKE_BINARY_DIR}/${LIB_DIR}/tk8.6")
DISTCLEAN("${CMAKE_BINARY_DIR}/${LIB_DIR}/tk8.6.10")
# Group the targets in Visual Studio project files
SetTargetFolder(wish "Third Party Executables")
SetTargetFolder(tk "Third Party Libraries")
SetTargetFolder(tkstub "Third Party Libraries")
elseif(BRLCAD_ENABLE_TK)
set(HAVE_TK_H 1)
# Packages probably still need to know the system graphics package
if (BRLCAD_ENABLE_AQUA)
set(TK_SYSTEM_GRAPHICS aqua)
elseif (BRLCAD_ENABLE_X11)
set(TK_SYSTEM_GRAPHICS x11)
elseif (WIN32)
set(TK_SYSTEM_GRAPHICS win32)
endif ()
set(TK_SYSTEM_GRAPHICS "${TK_SYSTEM_GRAPHICS}" CACHE STRING "Tk system graphics type" FORCE)
else(BRLCAD_TK_BUILD)
# If we're not using Tk, make sure the variables are empty - CMake won't be
# happy if they're set to NOTFOUND and used, and FindTCL.cmake may have set
# them.
TK_RESET_VARS()
unset(TK_SYSTEM_GRAPHICS CACHE)
endif(BRLCAD_TK_BUILD)
mark_as_advanced(TK_INCLUDE_PATH)
mark_as_advanced(TK_LIBRARY)
mark_as_advanced(TK_STUB_LIBRARY)
mark_as_advanced(TK_SYSTEM_GRAPHICS)
mark_as_advanced(TK_WISH)
# Now that Tcl/Tk is settled, define the HAVE_TK flag for the config.h
# file
if(BRLCAD_ENABLE_TK)
set(HAVE_TK 1 CACHE STRING "C level Tk flag" FORCE)
CONFIG_H_APPEND(BRLCAD "#cmakedefine HAVE_TK\n")
else(BRLCAD_ENABLE_TK)
set(HAVE_TK 0 CACHE STRING "C level Tk flag" FORCE)
endif(BRLCAD_ENABLE_TK)
mark_as_advanced(HAVE_TK)
# NOTE: Itcl/Itk 4 has a known behavior change that will cause an
# issue with Archer:
#
# http://core.tcl.tk/itcl/tktview/61952ca33e9e58df9e0519a0b4583a144e8ec77b
#
# Consequently we need to provide the older v3
set(ITCL_DIR itcl3)
set(ITCL_VER "3.4")
include("${CMAKE_CURRENT_SOURCE_DIR}/itcl3.dist")
CMAKEFILES_IN_DIR(itcl3_ignore_files itcl3)
set(ITK_DIR itk3)
set(ITK_VER "3.4")
include("${CMAKE_CURRENT_SOURCE_DIR}/itk3.dist")
CMAKEFILES_IN_DIR(itk3_ignore_files itk3)
set(itcl_ALIASES ENABLE_ITCL)
set(itcl_DESCRIPTION "
Option for enabling and disabling compilation of the IncrTcl package
for Tcl objects provided with BRL-CAD's source distribution. Default
is AUTO, auto-enabling if the BRLCAD_TCL option is set to BUNDLED and
testing first for a system version if BRLCAD_TCL is set to AUTO or
SYSTEM. If BRLCAD_ITCL is set to BUNDLED, local copy is built even if
a system version is present.
")
THIRD_PARTY_TCL_PACKAGE(Itcl ${ITCL_DIR} "${TCL_TCLSH}" "tcl" "BRLCAD_ENABLE_TCL;BRLCAD_LEVEL2" "" itcl_ALIASES itcl_DESCRIPTION)
if(BRLCAD_ITCL_BUILD)
set(ITCL_LIBRARY itcl CACHE STRING "ITCL_LIBRARY" FORCE)
set(ITCL_STUB_LIBRARY itclstub CACHE STRING "ITCL_STUB_LIBRARY" FORCE)
set(ITCL_VERSION "${ITCL_VER}" CACHE STRING "ITCL_VERSION" FORCE)
DISTCLEAN("${CMAKE_BINARY_DIR}/${LIB_DIR}/itcl${ITCL_VER}")
DISTCLEAN("${CMAKE_BINARY_DIR}/${INCLUDE_DIR}/itcl.h")
DISTCLEAN("${CMAKE_BINARY_DIR}/${INCLUDE_DIR}/itclDecls.h")
DISTCLEAN("${CMAKE_BINARY_DIR}/${INCLUDE_DIR}/itclInt.h")
DISTCLEAN("${CMAKE_BINARY_DIR}/${INCLUDE_DIR}/itclIntDecls.h")
SetTargetFolder(itcl "Third Party Libraries")
SetTargetFolder(itclstub "Third Party Libraries")
SetTargetFolder(itcl_pkgIndex "Third Party Libraries")
else(BRLCAD_ITCL_BUILD)
# We have Itcl package AND Itcl library - we're good.
set(ITCL_VERSION "${ITCL_PACKAGE_VERSION}" CACHE STRING "ITCL_VERSION" FORCE)
set(ITCL_LIBRARY ${ITCL_LIBRARY} CACHE STRING "ITCL_LIBRARY" FORCE)
endif(BRLCAD_ITCL_BUILD)
CONFIG_H_APPEND(BRLCAD "#cmakedefine ITCL_VERSION \"${ITCL_VERSION}\"\n")
mark_as_advanced(ITCL_LIBRARY)
mark_as_advanced(ITCL_STUB_LIBRARY)
mark_as_advanced(ITCL_VERSION)
# Look for IncrTcl's Itk.
set(itk_ALIASES ENABLE_ITK)
set(itk_DESCRIPTION "
Option for enabling and disabling compilation of the IncrTcl itk
package for Tk objects provided with BRL-CAD's source distribution.
Default is AUTO, auto-enabling if the BRLCAD_TCL option is set to
BUNDLED and testing first for a system version if BRLCAD_TCL is set to
AUTO or SYSTEM. If BRLCAD_ITK is set to BUNDLED, local copy is built
even if a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
")
THIRD_PARTY_TCL_PACKAGE(Itk ${ITK_DIR} "${TK_WISH}" "tcl;itcl;tk" "BRLCAD_ENABLE_TCL;BRLCAD_ENABLE_TK;BRLCAD_LEVEL3" "" itk_ALIASES itk_DESCRIPTION)
if(BRLCAD_ITK_BUILD)
SetTargetFolder(itk "Third Party Libraries")
SetTargetFolder(itkstub "Third Party Libraries")
SetTargetFolder(itk_pkgIndex "Third Party Libraries")
# does not handle C library settings.
set(ITK_LIBRARY itk CACHE STRING "ITK_LIBRARY" FORCE)
set(ITK_VERSION "3.4" CACHE STRING "ITK_VERSION" FORCE)
DISTCLEAN("${CMAKE_BINARY_DIR}/${LIB_DIR}/itk${ITK_VER}")
DISTCLEAN("${CMAKE_BINARY_DIR}/${INCLUDE_DIR}/itk.h")
DISTCLEAN("${CMAKE_BINARY_DIR}/${INCLUDE_DIR}/itkDecls.h")
else(BRLCAD_ITK_BUILD)
# We have Itcl/Itk packages AND Itcl/Itk libraries - we're good.
set(ITK_VERSION "${ITCL_VERSION}" CACHE STRING "ITK_VERSION" FORCE)
set(ITK_LIBRARY ${ITK_LIBRARY} CACHE STRING "ITK_LIBRARY" FORCE)
if(ITK_LIBRARY)
get_filename_component(ITK_BIN_PREFIX ${ITK_LIBRARY} PATH)
endif(ITK_LIBRARY)
endif(BRLCAD_ITK_BUILD)
mark_as_advanced(ITK_VERSION)
mark_as_advanced(ITK_LIBRARY)
set(iwidgets_ALIASES ENABLE_IWIDGETS)
set(iwidgets_DESCRIPTION "
Option for enabling and disabling compilation of the IWidgets Tk
widget package provided with BRL-CAD's source distribution. Default
is AUTO, auto-enabling if the BRLCAD_TCL option is set to BUNDLED and
testing first for a system version if BRLCAD_TCL is set to AUTO or
SYSTEM. If BRLCAD_IWIDGETS is set to BUNDLED, local copy is built even if
a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
")
set(IWIDGETS_VER "4.1.1")
THIRD_PARTY_TCL_PACKAGE(Iwidgets iwidgets "${TK_WISH}" "tcl;tk;itcl;itk" "BRLCAD_ENABLE_TCL;BRLCAD_ENABLE_TK;BRLCAD_LEVEL3" "" iwidgets_ALIASES iwidgets_DESCRIPTION)
if(BRLCAD_IWIDGETS_BUILD)
set(IWIDGETS_VERSION "${IWIDGETS_VER}" CACHE STRING "IWIDGETS_VERSION" FORCE)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/iwidgets/pkgIndex.tcl")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/iwidgets/iwidgets.tcl")
DISTCLEAN("${CMAKE_BINARY_DIR}/lib/Iwidgets${IWIDGETS_VER}")
ELSE(BRLCAD_IWIDGETS_BUILD)
set(IWIDGETS_VERSION "${IWIDGETS_PACKAGE_VERSION}" CACHE STRING "IWIDGETS_VERSION" FORCE)
endif(BRLCAD_IWIDGETS_BUILD)
CONFIG_H_APPEND(BRLCAD "#define IWIDGETS_VERSION \"${IWIDGETS_VERSION}\"\n")
mark_as_advanced(IWIDGETS_VERSION)
mark_as_advanced(COMPAT_SRCS)
set(tkhtml_ALIASES ENABLE_TKHTML)
set(tkhtml_DESCRIPTION "
Option for enabling and disabling compilation of the Tkhtml HTML
viewing package provided with BRL-CAD's source distribution. Default
is AUTO, auto-enabling if the BRLCAD_TCL option is set to BUNDLED and
testing first for a system version if BRLCAD_TCL is set to AUTO or
SYSTEM. If BRLCAD_TKHTML is set to BUNDLED, local copy is built even if
a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
")
THIRD_PARTY_TCL_PACKAGE(Tkhtml tkhtml "${TK_WISH}" "tcl;tk" "BRLCAD_ENABLE_TCL;BRLCAD_ENABLE_TK;BRLCAD_LEVEL3" "" tkhtml_ALIASES tkhtml_DESCRIPTION)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tkhtml/pkgIndex.tcl")
DISTCLEAN("${CMAKE_BINARY_DIR}/lib/Tkhtml3.0")
SetTargetFolder(Tkhtml "Third Party Libraries")
SetTargetFolder(tkhtml_n_gen "Compilation Utilities")
set(tktable_ALIASES ENABLE_TKTABLE)
set(tktable_DESCRIPTION "
Option for enabling and disabling compilation of the Tktable graphical
table widget package provided with BRL-CAD's source distribution.
Default is AUTO, auto-enabling if the BRLCAD_TCL option is set to
BUNDLED and testing first for a system version if BRLCAD_TCL is set to
AUTO or SYSTEM. If BRLCAD_TKTABLE is set to BUNDLED, local copy is built
even if a system version is present. This package will be disabled if
BRLCAD_ENABLE_TK is OFF.
")
THIRD_PARTY_TCL_PACKAGE(Tktable tktable "${TK_WISH}" "tcl;tk" "BRLCAD_ENABLE_TCL;BRLCAD_ENABLE_TK;BRLCAD_LEVEL3" "" tktable_ALIASES tktable_DESCRIPTION)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tktable/pkgIndex.tcl")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tktable/tktable_cfg.h")
DISTCLEAN("${CMAKE_BINARY_DIR}/lib/Tktable2.10")
SetTargetFolder(Tktable "Third Party Libraries")
SetTargetFolder(tktable_header_gen "Compilation Utilities")
#set(tktreectrl_ALIASES ENABLE_TKTREECTRL)
#set(tktreectrl_DESCRIPTION "
#Option for enabling and disabling compilation of the TkTreeCtrl graphical
#table widget package provided with BRL-CAD's source distribution.
#Default is AUTO, auto-enabling if the BRLCAD_TCL option is set to
#BUNDLED and testing first for a system version if BRLCAD_TCL is set to
#AUTO or SYSTEM. If BRLCAD_TKTREECTRL is set to BUNDLED, local copy is built
#even if a system version is present. This package will be disabled if
#BRLCAD_ENABLE_TK is OFF.
#")
#THIRD_PARTY_TCL_PACKAGE(tktreectrl tktreectrl "${TK_WISH}" "tcl;tk"
# "BRLCAD_ENABLE_TCL;BRLCAD_ENABLE_TK;BRLCAD_LEVEL3" "" tktreectrl_ALIASES tktreectrl_DESCRIPTION)
#DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tktreectrl/pkgIndex.tcl")
#DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tktreectrl/tktreectrl_cfg.h")
#DISTCLEAN("${CMAKE_BINARY_DIR}/lib/TkTreeCtrl2.4")
endif (BRLCAD_LEVEL3)
# OpenNURBS Library
set(opennurbs_DESCRIPTION "
Option for enabling and disabling compilation of the openNURBS 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.
")
THIRD_PARTY(openNURBS OPENNURBS openNURBS opennurbs_DESCRIPTION ALIASES
ENABLE_OPENNURBS FLAGS NOSYS)
add_subdirectory(openNURBS)
SetTargetFolder(openNURBS "Third Party Libraries")
SetTargetFolder(openNURBS-static "Third Party Libraries")
SetTargetFolder(openNURBS-obj "Third Party Libraries")
if(BRLCAD_OPENNURBS_BUILD)
set(OPENNURBS_INCLUDE_DIRS "${OPENNURBS_INCLUDE_DIR};${ZLIB_INCLUDE_DIRS}" CACHE STRING "Require opennurbs header includes" FORCE)
set(OPENNURBS_LIBRARIES "${OPENNURBS_LIBRARY};${ZLIB_LIBRARIES}" CACHE STRING "Require opennurbs libraries" FORCE)
mark_as_advanced(OPENNURBS_INCLUDE_DIRS)
mark_as_advanced(OPENNURBS_LIBRARIES)
get_directory_property(openNURBS_headers_orig DIRECTORY openNURBS DEFINITION OPENNURBS_HEADERS)
set(openNURBS_headers)
foreach(onhfile ${openNURBS_headers_orig})
set(openNURBS_headers ${openNURBS_headers} openNURBS/${onhfile})
endforeach(onhfile ${openNURBS_headers_orig})
BRLCAD_MANAGE_FILES(openNURBS_headers ${INCLUDE_DIR}/openNURBS)
endif(BRLCAD_OPENNURBS_BUILD)
if(BRLCAD_ENABLE_BINARY_ATTRIBUTES)
#=== LIBBSON ==================================================
# Libbson needed for binary attributes, always use this local version
set(libbson_DESCRIPTION "
Option for enabling and disabling compilation of the Libbson library
provided with BRL-CAD's source code. Default is BUNDLED, using
the included other/src version.
")
THIRD_PARTY(libbson BSON Libbson libbson_DESCRIPTION ALIASES
ENABLE_BSON FLAGS NOSYS UNDOCUMENTED)
if(BRLCAD_BSON_BUILD)
SetTargetFolder(libBSON "Third Party Libraries")
SetTargetFolder(libBSON-static "Third Party Libraries")
endif(BRLCAD_BSON_BUILD)
#=== END LIBBSON ==================================================
else(BRLCAD_ENABLE_BINARY_ATTRIBUTES)
include("${CMAKE_CURRENT_SOURCE_DIR}/libbson.dist")
CMAKEFILES_IN_DIR(libbson_ignore_files libbson)
endif(BRLCAD_ENABLE_BINARY_ATTRIBUTES)
# STEPcode
# Need Lemon/Perplex to build STEP - conditionalize
# Set some options for the SCL build
option(SC_PYTHON_GENERATOR "Compile exp2python" OFF)
option(SC_ENABLE_TESTING "Enable unittesting framework" OFF)
option(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
set(SC_IS_SUBBUILD ON)
set(SC_SKIP_EXEC_INSTALL ON)
set(SC_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
set(INCLUDE_INSTALL_DIR ${INCLUDE_DIR})
set(BIN_INSTALL_DIR ${BIN_DIR})
set(LIB_INSTALL_DIR ${LIB_DIR})
set(sc_ALIASES ENABLE_SCL ENABLE_STEP ENABLE_STEP_CLASS_LIBRARIES)
set(sc_DESCRIPTION "
Option for enabling and disabling compilation of the NIST Step Class
Libraries 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.
")
set(IS_SUBBUILD_STASH ${IS_SUBBUILD})
set(IS_SUBBUILD ON)
set(SC_BUILD_SCHEMAS "" CACHE STRING "Disable schema builds for BRL-CAD" FORCE)
# Lots of "libraries" associated with stepcode - use "stepcode" as the
# stand-in for the build target var.
THIRD_PARTY(stepcode SC stepcode sc_DESCRIPTION
REQUIRED_VARS LEMON_EXECUTABLE PERPLEX_EXECUTABLE BRLCAD_LEVEL3 BRLCAD_ENABLE_STEP
ALIASES ${sc_ALIASES} RESET_VARS
EXP2CXX_EXEC EXP2CXX_EXECUTABLE_TARGET FLAGS NOSYS)
if(BRLCAD_SC_BUILD)
set(EXP2CXX_EXEC exp2cxx CACHE STRING "Express to C++ executable" FORCE)
set(EXP2CXX_EXECUTABLE_TARGET exp2cxx CACHE STRING "Express to C++ executable target" FORCE)
mark_as_advanced(EXP2CXX_EXEC)
mark_as_advanced(EXP2CXX_EXECUTABLE_TARGET)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/stepcode/include/sc_cf.h.in")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/stepcode/include/sc_cf.h")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/stepcode/include/sc_version_string.h")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/stepcode/src/express/ExpParser_expparse/expparse.y")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/stepcode/src/express/express_md5gen.cmake")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/stepcode/src/express/express_verify.cmake")
endif(BRLCAD_SC_BUILD)
set(IS_SUBBUILD ${IS_SUBBUILD_STASH})
mark_as_advanced(SC_BUILD_TYPE)
mark_as_advanced(SC_BUILD_SCHEMAS)
mark_as_advanced(SC_GENERATE_LEXER_PARSER)
mark_as_advanced(SC_BUILD_SHARED_LIBS)
mark_as_advanced(SC_BUILD_STATIC_LIBS)
mark_as_advanced(SC_CPP_GENERATOR)
mark_as_advanced(SC_ENABLE_COVERAGE)
mark_as_advanced(SC_ENABLE_TESTING)
mark_as_advanced(SC_PYTHON_GENERATOR)
mark_as_advanced(SC_MEMMGR_ENABLE_CHECKS)
mark_as_advanced(SC_SDAI_ADDITIONAL_EXES_SRCS)
mark_as_advanced(SC_TRACE_FPRINTF)
SetTargetFolder(exp2cxx "Third Party Executables")
SetTargetFolder(core "Compilation Utilities")
SetTargetFolder(print_attrs "Compilation Utilities")
SetTargetFolder(print_schemas "Compilation Utilities")
SetTargetFolder(exppp "Third Party Executables")
SetTargetFolder(libexppp "Third Party Libraries")
SetTargetFolder(check-express "Third Party Executables")
SetTargetFolder(express "Third Party Libraries")
SetTargetFolder(express_md5gen "Third Party Executables")
SetTargetFolder(express_verify "Third Party Libraries")
SetTargetFolder(base "Third Party Libraries")
SetTargetFolder(stepcore "Third Party Libraries")
SetTargetFolder(stepdai "Third Party Libraries")
SetTargetFolder(stepeditor "Third Party Libraries")
SetTargetFolder(steputils "Third Party Libraries")
SetTargetFolder(version_string "Compilation Utilities")
if(BRLCAD_ENABLE_GECODE)
set(gecode_DESCRIPTION "
Option for enabling and disabling compilation of the Gecode Constraint
Solving Libraries 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.
")
set(GECODE_USE_QT OFF)
mark_as_advanced(GECODE_USE_QT)
THIRD_PARTY(gecode GECODE gecode gecode_DESCRIPTION REQUIRED_VARS BRLCAD_LEVEL3 ALIASES ENABLE_GECODE)
if(BRLCAD_GECODE_BUILD)
set(GECODE_LIBRARIES gecodesupport gecodekernel gecodesearch gecodeint
gecodeset gecodefloat gecodeminimodel gecodedriver gecodeflatzinc)
set(GECODE_LIBRARIES "${GECODE_LIBRARIES}" CACHE STRING "Gecode libraries in BRL-CAD" FORCE)
set(GECODE_INCLUDE_DIR "${BRLCAD_BINARY_DIR}/src/other/gecode;${BRLCAD_SOURCE_DIR}/src/other/gecode" CACHE STRING "Gecode headers in BRL-CAD" FORCE)
endif(BRLCAD_GECODE_BUILD)
endif(BRLCAD_ENABLE_GECODE)
# OpenSceneGraph Libraries
set(openscenegraph_DESCRIPTION "
Option for enabling and disabling compilation of the OpenSceneGraph
libraries 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.
")
THIRD_PARTY(openscenegraph OSG osg openscenegraph_DESCRIPTION
ALIASES ENABLE_OPENSCENEGRAPH REQUIRED_VARS "BRLCAD_ENABLE_OSG;BRLCAD_LEVEL3" FIND_NAME OpenSceneGraph FIND_COMPONENTS
osgText osgViewer FLAGS NOSYS)
if(BRLCAD_OSG_BUILD)
set(OSG_LIBRARY osg CACHE STRING "libosg" FORCE)
set(OSGUTIL_LIBRARY osgUtil CACHE STRING "osgutil" FORCE)
set(OSGDB_LIBRARY osgDB CACHE STRING "osgdb" FORCE)
set(OSGGA_LIBRARY osgGA CACHE STRING "osgGA" FORCE)
set(OSGTEXT_LIBRARY osgText CACHE STRING "osg Text library" FORCE)
set(OSGVIEWER_LIBRARY osgViewer CACHE STRING "osg Viewer library" FORCE)
set(OPENTHREADS_LIBRARY OpenThreads CACHE STRING "OpenThreads library" FORCE)
set(OPENTHREADS_INCLUDE_DIR
"${CMAKE_CURRENT_BINARY_DIR}/openscenegraph/src/OpenThreads/include"
"${BRLCAD_SOURCE_DIR}/src/other/openscenegraph/src/OpenThreads/include"
CACHE STRING "OpenThreads include dirs" FORCE
)
set(OSG_INCLUDE_DIR
"${CMAKE_CURRENT_BINARY_DIR}/openscenegraph/include"
"${BRLCAD_SOURCE_DIR}/src/other/openscenegraph/include"
CACHE STRING "OpenSceneGraph include dirs" FORCE
)
set(OSG_INCLUDE_DIR "${OSG_INCLUDE_DIR}" CACHE STRING "Directory containing OpenSceneGraph headers." FORCE)
set(OSG_LIBRARIES "${OSG_LIBRARY};${OSGUTIL_LIBRARY};${OSGDB_LIBRARY};${OSGGA_LIBRARY};${OSGTEXT_LIBRARY};${OSGVIEWER_LIBRARY};${OPENTHREADS_LIBRARY}" CACHE STRING "OpenSceneGraph Libraries")
SetTargetFolder(osg "Third Party Libraries")
SetTargetFolder(osgDB "Third Party Libraries")
SetTargetFolder(osgGA "Third Party Libraries")
SetTargetFolder(osgText "Third Party Libraries")
SetTargetFolder(osgViewer "Third Party Libraries")
SetTargetFolder(osgUtil "Third Party Libraries")
SetTargetFolder(osgWidget "Third Party Libraries")
SetTargetFolder(osgdb_freetype "Third Party Libraries")
SetTargetFolder(osgdb_osg "Third Party Libraries")
SetTargetFolder(osgdb_png "Third Party Libraries")
else(BRLCAD_OSG_BUILD)
if (BRLCAD_ENABLE_OSG)
find_package(OpenThreads)
endif (BRLCAD_ENABLE_OSG)
endif(BRLCAD_OSG_BUILD)
# Adaptagrams is not yet integrated as a src/other subbuild, but there
# is code that will make use of it if it is available. If that code
# becomes sufficiently useful, Adaptagrams will be integrated. In the
# meantime, locate the find logic for that package here.
# Adaptagrams library
#if(BRLCAD_LEVEL2)
# find_package(ADAPTAGRAMS)
# if(ADAPTAGRAMS_FOUND)
# CONFIG_H_APPEND(BRLCAD "#define HAVE_ADAPTAGRAMS 1\n")
# endif(ADAPTAGRAMS_FOUND)
# set(ADAPTAGRAMS_LIBRARIES "${ADAPTAGRAMS_LIBRARIES}" CACHE STRING "Adaptagrams libs" FORCE)
# set(ADAPTAGRAMS_FOUND "${ADAPTAGRAMS_FOUND}" CACHE BOOL "Adaptagrams status" FORCE)
# mark_as_advanced(ADAPTAGRAMS_FOUND)
# mark_as_advanced(ADAPTAGRAMS_LIBRARIES)
#endif(BRLCAD_LEVEL2)
set(OPENNURBS_INCLUDE_DIR "${BRLCAD_SOURCE_DIR}/src/other/openNURBS" CACHE STRING "Require opennurbs header includes" FORCE)
set(OPENNURBS_LIBRARY openNURBS CACHE STRING "Require opennurbs libraries" FORCE)
mark_as_advanced(OPENNURBS_INCLUDE_DIR)
mark_as_advanced(OPENNURBS_LIBRARY)
get_directory_property(openNURBS_headers_orig DIRECTORY openNURBS DEFINITION OPENNURBS_HEADERS)
set(openNURBS_headers)
foreach(onhfile ${openNURBS_headers_orig})
set(openNURBS_headers ${openNURBS_headers} openNURBS/${onhfile})
endforeach(onhfile ${openNURBS_headers_orig})
BRLCAD_MANAGE_FILES(openNURBS_headers ${INCLUDE_DIR}/openNURBS)
# Poly2Tri CDT library
# Note - this really should be embedded as part of libbg - it is simple, can be
@@ -871,79 +140,13 @@ add_subdirectory(poly2tri)
include("${CMAKE_CURRENT_SOURCE_DIR}/poly2tri.dist")
CMAKEFILES_IN_DIR(poly2tri_ignore_files poly2tri)
DISTCLEAN("${CMAKE_CURRENT_SOURCE_DIR}/poly2tri/Makefile")
set(P2T_LIBRARY "poly2tri" CACHE STRING "Poly2Tri library" FORCE)
set(P2T_INCLUDE_DIR "${BRLCAD_SOURCE_DIR}/src/other/poly2tri" CACHE STRING "Directory containing poly2tri header" FORCE)
set(POLY2TRI_LIBRARY "poly2tri" CACHE STRING "Poly2Tri library" FORCE)
set(POLY2TRI_INCLUDE_DIR "${BRLCAD_SOURCE_DIR}/src/other/poly2tri" CACHE STRING "Directory containing poly2tri header" FORCE)
SetTargetFolder(poly2tri "Third Party Libraries")
SetTargetFolder(poly2tri-static "Third Party Libraries")
mark_as_advanced(P2T_LIBRARY)
mark_as_advanced(P2T_INCLUDE_DIR)
mark_as_advanced(P2T_SHARED)
mark_as_advanced(P2T_STATIC)
mark_as_advanced(P2T_TESTS)
mark_as_advanced(POLY2TRI_LIBRARY)
mark_as_advanced(POLY2TRI_INCLUDE_DIR)
# PROJ.4 library - used by GDAL
set(proj4_DESCRIPTION "
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.
")
THIRD_PARTY(proj-4 PROJ4 proj4 proj4_DESCRIPTION REQUIRED_VARS "BRLCAD_ENABLE_GDAL;BRLCAD_LEVEL2" ALIASES ENABLE_PROJ4)
if(BRLCAD_PROJ4_BUILD)
set(PROJ4_LIBRARY proj CACHE STRING "libproj" FORCE)
set(PROJ4_LIBRARIES proj CACHE STRING "libproj" FORCE)
set(PROJ4_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/proj-4;${CMAKE_CURRENT_SOURCE_DIR}/proj-4/src" CACHE STRING "proj-4 includes" FORCE)
set(PROJ4_INCLUDE_DIRS "${PROJ4_INCLUDE_DIR}")
set(PROJ4_VERSION "4.9.3")
set(PROJ4_FOUND ON)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/proj-4/proj_config.h")
SetTargetFolder(proj "Third Party Libraries/GDAL")
SetTargetFolder(proj-static "Third Party Libraries/GDAL")
# Need data files in order for PROJ-4 to work...
get_directory_property(PROJ_DICTIONARY DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/proj-4/nad DEFINITION PROJ_DICTIONARY)
set(proj_dict)
foreach(pfile ${PROJ_DICTIONARY})
set(proj_dict ${proj_dict} proj-4/nad/${pfile})
endforeach(pfile ${PROJ_DICTIONARY})
BRLCAD_MANAGE_FILES("${proj_dict}" "${DATA_DIR}/proj")
endif(BRLCAD_PROJ4_BUILD)
mark_as_advanced(PROJ4_INCLUDE_DIRS)
mark_as_advanced(PROJ4_LIBRARY)
mark_as_advanced(USE_THREAD)
# GDAL library
set(gdal_DESCRIPTION "
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.
")
THIRD_PARTY(gdal GDAL gdal gdal_DESCRIPTION REQUIRED_VARS "BRLCAD_ENABLE_GDAL;BRLCAD_LEVEL2" ALIASES ENABLE_GDAL)
if(BRLCAD_GDAL_BUILD)
set(GDAL_LIBRARY gdal CACHE STRING "libgdal" FORCE)
set(GDAL_INCLUDE_DIR
"${CMAKE_CURRENT_BINARY_DIR}/gdal"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/port"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/gcore"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/alg"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/ogr"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/ogr/ogrsf_frmts"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/gnm"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/apps"
"${BRLCAD_SOURCE_DIR}/src/other/gdal/frmts/vrt"
)
set(GDAL_INCLUDE_DIR "${GDAL_INCLUDE_DIR}" CACHE STRING "libgdal includes" FORCE)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/gdal/cpl_config.h")
SetTargetFolder(gdal "Third Party Libraries/GDAL")
SetTargetFolder(gdal-static "Third Party Libraries/GDAL")
endif(BRLCAD_GDAL_BUILD)
mark_as_advanced(GDAL_CONFIG)
mark_as_advanced(GDAL_INCLUDE_DIR)
mark_as_advanced(GDAL_LIBRARY)
mark_as_advanced(GDAL_INCLUDE_DIRS)
mark_as_advanced(GDAL_LIBRARIES)
# GCT is a collection of algorithms for geometry processing and conversion
#add_subdirectory(gct)
@@ -957,6 +160,29 @@ CMAKEFILES_IN_DIR(linenoise_ignore_files linenoise)
# Eigen is header only
include("${CMAKE_CURRENT_SOURCE_DIR}/Eigen.dist")
CMAKEFILES_IN_DIR(Eigen_ignore_files Eigen)
set(SYS_INCLUDE_PATTERNS ${SYS_INCLUDE_PATTERNS} Eigen CACHE STRING "Bundled system include dirs" FORCE)
if (BRLCAD_ENABLE_TCL AND BRLCAD_ENABLE_TK)
# Tkhtml doesn't have an active upstream
add_subdirectory(tkhtml)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tkhtml/pkgIndex.tcl")
DISTCLEAN("${CMAKE_BINARY_DIR}/lib/Tkhtml3.0")
SetTargetFolder(Tkhtml "Third Party Libraries")
SetTargetFolder(tkhtml_n_gen "Compilation Utilities")
# Tktable is a borderline case. It does exist and is used in the Tcl/Tk
# ecosystem, but it is has the same problem we have generally with "package
# require" Tk package testing and there is very little upstream activity...
add_subdirectory(tktable)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tktable/pkgIndex.tcl")
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/tktable/tktable_cfg.h")
DISTCLEAN("${CMAKE_BINARY_DIR}/lib/Tktable2.10")
SetTargetFolder(Tktable "Third Party Libraries")
SetTargetFolder(tktable_header_gen "Compilation Utilities")
endif (BRLCAD_ENABLE_TCL AND BRLCAD_ENABLE_TK)
CMAKEFILES(README)
CMAKEFILES(CMakeLists.txt)
@@ -0,0 +1,439 @@
# This is based on the logic generated by CMake for EXPORT, but customized for
# use with ExternalProject:
#
# https://cmake.org/cmake/help/latest/module/ExternalProject.html
#
# The goal is to create an imported target based on the ExternalProject
# information, and then append the necessary install logic to manage RPath
# settings in the external projects as if the external files were built by the
# main CMake project.
# The catch to this is that the external project outputs MUST be built in a way
# that is compatible with CMake's RPath handling assumptions. See
# https://stackoverflow.com/questions/41175354/can-i-install-shared-imported-library
# for one of the issues surrounding this - file(RPATH_CHANGE) must be able to
# succeed, and it is up to the 3rd party build setups to prepare their outputs
# to be ready. The key variable CMAKE_BUILD_RPATH must be set correctly ahead
# of time - see RPath_Setup.cmake
# Be quite about tool outputs by default
if(NOT DEFINED EXTPROJ_VERBOSE)
set(EXTPROJ_VERBOSE 0)
endif(NOT DEFINED EXTPROJ_VERBOSE)
# cmake -E copy follows symlinks to get the final file, which is not what we
# want in this situation. To avoid this, we create a copy script which uses
# file(COPY) and run that script with cmake -P
file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/cp.cmake" "get_filename_component(DDIR \${DEST} DIRECTORY)\nfile(COPY \${SRC} DESTINATION \${DDIR})")
# When staging files in the build directory, we have to be aware of multiple
# configurations. This is done post-ExternalProject build, at the parent build
# time, so it needs to be a custom command. Until add_custom_command outputs
# can use $<CONFIG>, we use the old-school CMAKE_CFG_INTDIR variable in the OUTPUT
# path. This is key, because it allows the add_custom_command to be aware that
# it needs to execute the correct copy command for a current configuration at build
# time.
function(fcfgcpy outvar extproj root ofile dir tfile)
string(REPLACE "${CMAKE_BINARY_DIR}/" "" rdir "${dir}")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${rdir}/${tfile}"
COMMAND ${CMAKE_COMMAND} -DSRC="${root}/${rdir}/${ofile}" -DDEST="${CMAKE_BINARY_DIR}/$<CONFIG>/${rdir}/${tfile}" -P "${CMAKE_BINARY_DIR}/CMakeFiles/cp.cmake"
DEPENDS ${extproj}
)
set(TOUT ${TOUT} "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${rdir}/${tfile}")
set(${outvar} ${TOUT} PARENT_SCOPE)
endfunction(fcfgcpy file)
# Custom patch utility to replace the build directory path with the install
# directory path in text files - make sure CMAKE_BINARY_DIR and
# CMAKE_INSTALL_PREFIX are finalized before generating this file!
configure_file(${${CMAKE_PROJECT_NAME}_CMAKE_DIR}/buildpath_replace.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
add_executable(buildpath_replace ${CMAKE_CURRENT_BINARY_DIR}/buildpath_replace.cxx)
function(ExternalProject_ByProducts etarg extproj extroot dir)
cmake_parse_arguments(E "FIXPATH;NOINSTALL" "" "" ${ARGN})
if (EXTPROJ_VERBOSE)
list(LENGTH E_UNPARSED_ARGUMENTS FCNT)
if (E_FIXPATH)
if (FCNT GREATER 1)
message("${extproj}: Adding path adjustment and installation rules for ${FCNT} byproducts")
else (FCNT GREATER 1)
message("${extproj}: Adding path adjustment and installation rules for ${FCNT} byproduct")
endif (FCNT GREATER 1)
else (E_FIXPATH)
if (FCNT GREATER 1)
message("${extproj}: Adding install rules for ${FCNT} byproducts")
else (FCNT GREATER 1)
message("${extproj}: Adding install rules for ${FCNT} byproduct")
endif (FCNT GREATER 1)
endif (E_FIXPATH)
endif (EXTPROJ_VERBOSE)
if (NOT TARGET ${etarg}_stage)
add_custom_target(${etarg}_stage ALL)
endif (NOT TARGET ${etarg}_stage)
set(ALL_TOUT)
foreach (bpf ${E_UNPARSED_ARGUMENTS})
unset(TOUT)
fcfgcpy(TOUT ${extproj} ${extroot} ${bpf} "${dir}" ${bpf})
set(ALL_TOUT ${ALL_TOUT} ${TOUT})
if (NOT E_NOINSTALL)
install(FILES "${CMAKE_BINARY_ROOT}/${dir}/${bpf}" DESTINATION "${dir}/")
if (E_FIXPATH)
# Note - proper quoting for install(CODE) is extremely important for CPack, see
# https://stackoverflow.com/a/48487133
install(CODE "execute_process(COMMAND $<TARGET_FILE:buildpath_replace> \"\${CMAKE_INSTALL_PREFIX}/${dir}/${bpf}\")")
endif (E_FIXPATH)
endif (NOT E_NOINSTALL)
endforeach (bpf ${E_UNPARSED_ARGUMENTS})
if (ALL_TOUT)
string(MD5 UKEY "${ALL_TOUT}")
add_custom_target(${etarg}_${UKEY} ALL DEPENDS ${ALL_TOUT})
add_dependencies(${etarg}_stage ${etarg}_${UKEY})
endif (ALL_TOUT)
endfunction(ExternalProject_ByProducts)
function(ET_target_props etarg REL_DIR LINK_TARGET)
cmake_parse_arguments(ET "SHARED" "LINK_TARGET_DEBUG" "" ${ARGN})
if(NOT CMAKE_CONFIGURATION_TYPES)
# Note: per https://stackoverflow.com/a/49390802 need to set
# IMPORTED_NO_SONAME to get working linking for what we're trying to do
# here. Without that property set, build dir copies of libraries will use
# an incorrect relative link and fail to find the library.
set_property(TARGET ${etarg} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(${etarg} PROPERTIES
IMPORTED_NO_SONAME TRUE
IMPORTED_LOCATION_NOCONFIG "${CMAKE_BINARY_DIR}/${REL_DIR}/${LINK_TARGET}"
IMPORTED_SONAME_NOCONFIG "${LINK_TARGET}"
)
# For Windows, IMPORTED_IMPLIB is important for shared libraries.
# It is that property that will tell a toplevel target what to link against
# when building - pointing out the dll isn't enough by itself.
if(ET_SHARED AND MSVC)
string(REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}" ".lib" IMPLIB_FILE "${LINK_TARGET}")
string(REPLACE "${SHARED_DIR}" "${LIB_DIR}" REL_DIR "${REL_DIR}")
set_target_properties(${etarg} PROPERTIES
IMPORTED_IMPLIB_NOCONFIG "${CMAKE_BINARY_DIR}/${REL_DIR}/${IMPLIB_FILE}"
)
endif(ET_SHARED AND MSVC)
else(NOT CMAKE_CONFIGURATION_TYPES)
# If no config is set for multiconfig, default to Debug
set_target_properties(${etarg} PROPERTIES
IMPORTED_NO_SONAME TRUE
IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/Debug/${REL_DIR}/${LINK_TARGET}"
IMPORTED_SONAME "${LINK_TARGET}"
)
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
# The config variables need to be set in this mode.
if("${CFG_TYPE_UPPER}" STREQUAL "DEBUG" AND ET_LINK_TARGET_DEBUG)
set(C_LINK_TARGET ${ET_LINK_TARGET_DEBUG})
else()
set(C_LINK_TARGET ${LINK_TARGET})
endif()
# If we're multiconfig, define properties for each configuration
set_target_properties(${etarg} PROPERTIES
IMPORTED_CONFIGURATIONS "${CMAKE_CONFIGURATION_TYPES}"
IMPORTED_NO_SONAME_${CFG_TYPE_UPPER} TRUE
IMPORTED_LOCATION_${CFG_TYPE_UPPER} "${CMAKE_BINARY_DIR}/${CFG_TYPE}/${REL_DIR}/${LINK_TARGET}"
IMPORTED_SONAME_${CFG_TYPE_UPPER} "${LINK_TARGET}"
)
# For Windows, IMPORTED_IMPLIB is important for shared libraries.
# It is that property that will tell a toplevel target what to link against
# when building - pointing out the dll isn't enough by itself.
if(ET_SHARED AND MSVC)
string(REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}" ".lib" IMPLIB_FILE "${LINK_TARGET}")
string(REPLACE "${SHARED_DIR}" "${LIB_DIR}" REL_DIR "${REL_DIR}")
set_target_properties(${etarg} PROPERTIES
IMPORTED_IMPLIB_${CFG_TYPE_UPPER} "${CMAKE_BINARY_DIR}/${CFG_TYPE}/${REL_DIR}/${IMPLIB_FILE}"
)
endif(ET_SHARED AND MSVC)
endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
endif(NOT CMAKE_CONFIGURATION_TYPES)
endfunction(ET_target_props)
# For a given path, calculate the $ORIGIN style path needed relative
# to CMAKE_INSTALL_PREFIX
function(ET_Origin_Path POPATH INIT_PATH)
get_filename_component(CPATH "${INIT_PATH}" REALPATH)
set(RELDIRS)
set(FPATH)
while (NOT "${CPATH}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
get_filename_component(CDIR "${CPATH}" NAME)
get_filename_component(CPATH "${CPATH}" DIRECTORY)
if (NOT "${RELDIRS}" STREQUAL "")
set(RELDIRS "${CDIR}/${RELDIRS}")
set(FPATH "../${FPATH}")
else (NOT "${RELDIRS}" STREQUAL "")
set(RELDIRS "${CDIR}")
set(FPATH "../")
endif (NOT "${RELDIRS}" STREQUAL "")
endwhile()
set(FPATH "${FPATH}${RELDIRS}")
set(${POPATH} ${FPATH} PARENT_SCOPE)
endfunction(ET_Origin_Path)
# Mimic the magic of the CMake install(TARGETS) form of the install command.
# This is the key to treating external project build outputs as fully managed
# CMake outputs, and requires that the external project build in such a way
# that the rpath settings in the build outputs are compatible with this
# mechanism.
#
# When specifying OFILE, the path should be given relative to the root directory:
# For example:
#
# /usr/lib/libfoo.so -> lib/libfoo.so
# /usr/lib/bar-1.0/libbar.so -> lib/foo-1.0/libfoo.so
# /usr/bin/baz -> bin/baz
# /usr/bin/mypkg/baz -> bin/mypkg/baz
#
function(ET_RPath OFILE)
get_filename_component(OFPATH "${OFILE}" DIRECTORY)
get_filename_component(RRPATH "${CMAKE_INSTALL_PREFIX}/${OFPATH}" REALPATH)
set(OPATH)
ET_Origin_Path(OPATH "${RRPATH}")
if (NOT APPLE)
set(NEW_RPATH "$ENV{DESTDIR}${RRPATH}:$ORIGIN/${OPATH}")
else (NOT APPLE)
set(NEW_RPATH "$ENV{DESTDIR}${RRPATH}:@loader_path/${OPATH}")
endif (NOT APPLE)
if (NOT DEFINED CMAKE_BUILD_RPATH)
message(FATAL_ERROR "ET_RPath run without CMAKE_BUILD_RPATH defined - run cmake_set_rpath before defining external projects.")
endif (NOT DEFINED CMAKE_BUILD_RPATH)
# Note - proper quoting for install(CODE) is extremely important for CPack, see
# https://stackoverflow.com/a/48487133
install(CODE "
file(RPATH_CHANGE
FILE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OFILE}\"
OLD_RPATH \"${CMAKE_BUILD_RPATH}\"
NEW_RPATH \"${NEW_RPATH}\")
")
endfunction(ET_RPath)
# etype = EXEC;SHARED;STATIC
#
function(ExternalProject_Target etype etarg extproj extroot fname)
cmake_parse_arguments(E "RPATH" "LINK_TARGET;LINK_TARGET_DEBUG;SUBDIR" "SYMLINKS" ${ARGN})
#message("etype: ${etype}")
#message("etarg: ${etarg}")
#message("extproj: ${extproj}")
#message("extroot: ${extroot}")
#message("fname: ${fname}")
# If we have a static target but BUILD_STATIC_LIBS is off, we're done
if ("${etype}" STREQUAL "STATIC" AND NOT BUILD_STATIC_LIBS)
return()
endif ("${etype}" STREQUAL "STATIC" AND NOT BUILD_STATIC_LIBS)
# If we have something that's not a target, fatal error - this is a problem with the build logic
if(NOT TARGET ${extproj})
message(FATAL_ERROR "${extprog} is not a target")
endif(NOT TARGET ${extproj})
# Protect against redefinition of already defined targets - each etarg name should be unique, corresponding
# to a single executable or library from the foreign build.
if(TARGET ${etarg})
message(FATAL_ERROR "Target ${etarg} is already defined\n")
endif(TARGET ${etarg})
# For some platforms, we may want to target a symbolic link rather than the
# target itself for linking purposes. We also (grr) may need to target a
# configuration specific link. Go through the permutations and figure out
# what LINK_TARGET should be in this case.
unset(LINK_TARGET)
unset(LINK_TARGET_DEBUG)
if ("${etype}" STREQUAL "SHARED")
if (E_LINK_TARGET)
set(LINK_TARGET "${E_LINK_TARGET}")
endif (E_LINK_TARGET)
if (NOT LINK_TARGET)
# In case we have a relative path for fname, make sure we're using just
# the filename for linking purposes.
get_filename_component(LFILE "${fname}" NAME)
set(LINK_TARGET "${LFILE}")
endif (NOT LINK_TARGET)
if (E_LINK_TARGET_DEBUG)
set(LINK_TARGET_DEBUG "${E_LINK_TARGET_DEBUG}")
else (LINK_TARGET)
set(LINK_TARGET_DEBUG "${LINK_TARGET}")
endif ()
endif ("${etype}" STREQUAL "SHARED")
# Create imported target - need to both make the target itself
# and set the necessary properties. See also
# https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/Exporting-and-Importing-Targets
# Because the outputs are not properly build target outputs of the primary
# CMake project, we need to install as either FILES or PROGRAMS. Collect
# the file copying targets in a variable for later use.
set(TOUT)
# Shared library logic
if ("${etype}" STREQUAL "SHARED")
add_library(${etarg} SHARED IMPORTED GLOBAL)
if (MSVC)
set(SHARED_DIR ${BIN_DIR})
else (MSVC)
set(SHARED_DIR ${LIB_DIR})
endif (MSVC)
fcfgcpy(TOUT ${extproj} ${extroot} ${fname} ${SHARED_DIR} ${fname})
# On Windows, we need both a .dll and a .lib file to use a shared library for compilation
if (MSVC)
string(REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}" ".lib" IMPLIB_FILE "${fname}")
fcfgcpy(TOUT ${extproj} ${extroot} ${IMPLIB_FILE} ${LIB_DIR} ${IMPLIB_FILE})
endif (MSVC)
# Because we're using LINK_TARGET here rather than fname, we need to take any relative
# directories specified in fname and ppend them to SHARED_DIR. (For other cases we are
# just feeding fname directly, so there are no such concerns. TODO - should we just
# require relative dirs on all the symlinks instead?
get_filename_component(LDIR "${fname}" DIRECTORY)
ET_target_props(${etarg} "${SHARED_DIR}/${LDIR}" ${LINK_TARGET} SHARED LINK_TARGET_DEBUG "${LINK_TARGET_DEBUG}")
install(FILES "${CMAKE_BINARY_ROOT}/${SHARED_DIR}/${fname}" DESTINATION ${SHARED_DIR}/${E_SUBDIR})
if (MSVC)
install(FILES "${CMAKE_BINARY_ROOT}/${LIB_DIR}/${IMPLIB_FILE}" DESTINATION ${LIB_DIR}/${E_SUBDIR})
endif (MSVC)
# Let CMake know there is a target dependency here, despite this being an import target
add_dependencies(${etarg} ${extproj})
# additional (non-MSVC) work specific to shared libraries:
if (NOT MSVC)
# Perform RPath magic
if (E_RPATH)
ET_RPath("${SHARED_DIR}/${fname}")
endif (E_RPATH)
# Add install rules for any symlinks the caller has listed
foreach(slink ${E_SYMLINKS})
fcfgcpy(TOUT ${extproj} ${extroot} ${slink} ${SHARED_DIR} ${slink})
install(FILES "${CMAKE_BINARY_ROOT}/${SHARED_DIR}/${slink}" DESTINATION ${SHARED_DIR}/${E_SUBDIR})
endforeach(slink ${E_SYMLINKS})
endif (NOT MSVC)
endif ("${etype}" STREQUAL "SHARED")
# Static library logic
if ("${etype}" STREQUAL "STATIC" AND BUILD_STATIC_LIBS)
add_library(${etarg} STATIC IMPORTED GLOBAL)
fcfgcpy(TOUT ${extproj} ${extroot} ${fname} ${LIB_DIR} ${fname})
ET_target_props(${etarg} "${LIB_DIR}" ${fname} STATIC LINK_TARGET_DEBUG "${LINK_TARGET_DEBUG}")
install(FILES "${CMAKE_BINARY_ROOT}/${LIB_DIR}/${fname}" DESTINATION ${LIB_DIR}/${E_SUBDIR})
# Let CMake know there is a target dependency here, despite this being an import target
add_dependencies(${etarg} ${extproj})
# additional (non-MSVC) work specific to shared libraries:
if (NOT MSVC)
# Add install rules for any symlinks the caller has listed
foreach(slink ${E_SYMLINKS})
fcfgcpy(TOUT ${extproj} ${extroot} ${slink} ${LIB_DIR} ${slink})
install(FILES "${CMAKE_BINARY_ROOT}/${LIB_DIR}/${slink}" DESTINATION ${LIB_DIR})
endforeach(slink ${E_SYMLINKS})
endif (NOT MSVC)
endif ("${etype}" STREQUAL "STATIC" AND BUILD_STATIC_LIBS)
# Executable logic
if ("${etype}" STREQUAL "EXEC")
add_executable(${etarg} IMPORTED GLOBAL)
fcfgcpy(TOUT ${extproj} ${extroot} ${fname} ${BIN_DIR} ${fname})
ET_target_props(${etarg} "${BIN_DIR}" ${fname})
install(PROGRAMS "${CMAKE_BINARY_ROOT}/${BIN_DIR}/${fname}" DESTINATION ${BIN_DIR}/${E_SUBDIR})
# Let CMake know there is a target dependency here, despite this being an import target
add_dependencies(${etarg} ${extproj})
# additional (non-MSVC) work specific to shared libraries:
if (NOT MSVC)
# Perform RPath magic
if (E_RPATH)
ET_RPath("${BIN_DIR}/${fname}")
endif (E_RPATH)
endif (NOT MSVC)
endif ("${etype}" STREQUAL "EXEC")
# Set up the staging targets - these copy the files we are interested in from the
# 3rd party install directory to BRL-CAD's build tree. This allows us to achieve
# file level dependencies despite using ExternalProject_Add, since each output
# file uses a custom command to do the copy that depends on the external target
# and the staging target depends on all of those output files individually. In
# essence, those copy commands provide our CMake system with the explicit file
# information we could not otherwise get from ExternalProject_Add.
if (TOUT)
if (NOT TARGET ${etarg}_stage)
add_custom_target(${etarg}_stage ALL DEPENDS ${TOUT})
else (NOT TARGET ${etarg}_stage)
add_dependencies(${etarg}_stage ${TOUT})
endif (NOT TARGET ${etarg}_stage)
endif (TOUT)
# Set up dependencies for the imported target that will be used in *_LIBRARY variables
# to depend on the staging targets. This completes the dependency chain, and targets
# depending on the *_LIBRARY variables will now depend on the correct execution of
# the ExternalProject_Add system.
add_dependencies(${etarg} ${etarg}_stage)
endfunction(ExternalProject_Target)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+63
View File
@@ -0,0 +1,63 @@
# F I N D A D A P T A G R A M S . C M A K E
# BRL-CAD
#
# Copyright (c) 2012-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# - Find Adaptagrams libraries
#
# The following variables are set:
#
# AVOID_INCLUDE_DIR - where to find libavoid.h, etc.
# AVOID_LIBRARY - where to find libavoid.a
# The following variables are set:
#
# ADAPTAGRAMS_INCLUDE_DIRS - where to find libavoid.h, etc.
# ADAPTAGRAMS_LIBRARIES - List of libraries when using Adaptagrams.
# ADAPTAGRAMS_FOUND - True if libavoid is found.
find_path(AVOID_INCLUDE_DIR libavoid.h PATH_SUFFIXES libavoid)
find_library(AVOID_LIBRARY NAMES avoid)
set(ADAPTAGRAMS_INCLUDE_DIRS ${AVOID_INCLUDE_DIR} CACHE STRING "Adaptagrams headers")
set(ADAPTAGRAMS_LIBRARIES ${AVOID_LIBRARY} CACHE STRING "Adaptagrams libs")
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ADAPTAGRAMS DEFAULT_MSG AVOID_LIBRARY AVOID_INCLUDE_DIR)
MARK_AS_ADVANCED(ADAPTAGRAMS_LIBRARIES ADAPTAGRAMS_INCLUDE_DIRS AVOID_LIBRARY AVOID_INCLUDE_DIR)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+10
View File
@@ -0,0 +1,10 @@
# The module defines the following variables:
# ASTYLE_EXECUTABLE - the path to the astyle executable
#
#=============================================================================
find_program(ASTYLE_EXECUTABLE astyle DOC "path to the astyle executable")
mark_as_advanced(ASTYLE_EXECUTABLE)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASTYLE DEFAULT_MSG ASTYLE_EXECUTABLE)
+82
View File
@@ -0,0 +1,82 @@
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2014-2018 Esteban Tovagliari, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#
# Find appleseed headers and libraries.
#
# This module requires the following variables to be defined:
#
# APPLESEED_INCLUDE_DIR Path to the src/appleseed directory
# APPLESEED_LIBRARY Path to the appleseed library file
#
# This module defines the following variables:
#
# APPLESEED_FOUND True if appleseed was found
# APPLESEED_INCLUDE_DIRS Where to find appleseed header files
# APPLESEED_LIBRARIES List of appleseed libraries to link against
#
include (FindPackageHandleStandardArgs)
find_path (Appleseed_INCLUDE_DIR renderer/api/project.h
HINTS
${Appleseed_ROOT}
PATH_SUFFIXES
include
appleseed/include
)
find_library (Appleseed_LIBRARY
NAMES appleseed
HINTS
${Appleseed_ROOT}
PATH_SUFFIXES
lib64
lib
)
# Handle the QUIETLY and REQUIRED arguments and set Appleseed_FOUND.
find_package_handle_standard_args (Appleseed DEFAULT_MSG
Appleseed_INCLUDE_DIR
Appleseed_LIBRARY
)
# Set the output variables.
if (Appleseed_FOUND)
set (Appleseed_INCLUDE_DIRS ${Appleseed_INCLUDE_DIR})
set (Appleseed_LIBRARIES ${Appleseed_LIBRARY})
else ()
set (Appleseed_INCLUDE_DIRS)
set (Appleseed_LIBRARIES)
endif ()
mark_as_advanced (
Appleseed_INCLUDE_DIR
Appleseed_LIBRARY
)
+94
View File
@@ -0,0 +1,94 @@
# From https://github.com/mongodb/mongo-c-driver/blob/master/build/cmake/FindBSON.cmake
# License: Apache License Version 2.0, January 2004
# Read-Only variables:
# BSON_FOUND - system has the BSON library
# BSON_INCLUDE_DIR - the BSON include directory
# BSON_LIBRARIES - The libraries needed to use BSON
# BSON_VERSION - This is set to $major.$minor.$revision$path (eg. 0.4.1)
if (UNIX)
find_package(PkgConfig QUIET)
pkg_check_modules(_BSON QUIET libbson-1.0)
endif ()
find_path(BSON_INCLUDE_DIR
NAMES
libbson-1.0/bson.h
HINTS
${BSON_ROOT_DIR}
${_BSON_INCLUDEDIR}
PATH_SUFFIXES
include
)
set(BSON_INCLUDE_DIR "${BSON_INCLUDE_DIR}/libbson-1.0")
if(WIN32 AND NOT CYGWIN)
if(MSVC)
find_library(BSON
NAMES
"bson-1.0"
HINTS
${BSON_ROOT_DIR}
PATH_SUFFIXES
bin
lib
)
mark_as_advanced(BSON)
set(BSON_LIBRARIES ${BSON} ws2_32)
else()
# bother supporting this?
endif()
else()
find_library(BSON_LIBRARY
NAMES
bson-1.0
HINTS
${_BSON_LIBDIR}
PATH_SUFFIXES
lib
)
mark_as_advanced(BSON_LIBRARY)
find_package (Threads REQUIRED)
set(BSON_LIBRARIES ${BSON_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
endif()
if (BSON_INCLUDE_DIR)
if (_BSON_VERSION)
set(BSON_VERSION "${_BSON_VERSION}")
elseif(BSON_INCLUDE_DIR AND EXISTS "${BSON_INCLUDE_DIR}/bson-version.h")
file(STRINGS "${BSON_INCLUDE_DIR}/bson-version.h" bson_version_str
REGEX "^#define[\t ]+BSON_VERSION[\t ]+\([0-9.]+\)[\t ]+$")
string(REGEX REPLACE "^.*BSON_VERSION[\t ]+\([0-9.]+\)[\t ]+$"
"\\1" BSON_VERSION "${bson_version_str}")
endif ()
endif ()
include(FindPackageHandleStandardArgs)
if (BSON_VERSION)
find_package_handle_standard_args(BSON
REQUIRED_VARS
BSON_LIBRARIES
BSON_INCLUDE_DIR
VERSION_VAR
BSON_VERSION
FAIL_MESSAGE
"Could NOT find BSON version"
)
else ()
find_package_handle_standard_args(BSON "Could NOT find BSON"
BSON_LIBRARIES
BSON_INCLUDE_DIR
)
endif ()
mark_as_advanced(BSON_INCLUDE_DIR BSON_LIBRARIES)
+218
View File
@@ -0,0 +1,218 @@
# Copyright (c) DreamWorks Animation LLC
#
# All rights reserved. This software is distributed under the
# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
#
# Redistributions of source code must retain the above copyright
# and license notice and the following restrictions and disclaimer.
#
# * Neither the name of DreamWorks Animation nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY 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.
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
#
#[=======================================================================[.rst:
FindBlosc
---------
Find Blosc include dirs and libraries
Use this module by invoking find_package with the form::
find_package(Blosc
[version] [EXACT] # Minimum or EXACT version e.g. 1.5.0
[REQUIRED] # Fail with error if Blosc is not found
)
IMPORTED Targets
^^^^^^^^^^^^^^^^
``Blosc::blosc``
This module defines IMPORTED target Blosc::Blosc, if Blosc has been found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``Blosc_FOUND``
True if the system has the Blosc library.
``Blosc_VERSION``
The version of the Blosc library which was found.
``Blosc_INCLUDE_DIRS``
Include directories needed to use Blosc.
``Blosc_LIBRARIES``
Libraries needed to link to Blosc.
``Blosc_LIBRARY_DIRS``
Blosc library directories.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``Blosc_INCLUDE_DIR``
The directory containing ``blosc.h``.
``Blosc_LIBRARY``
The path to the Blosc library.
Hints
^^^^^
Instead of explicitly setting the cache variables, the following variables
may be provided to tell this module where to look.
``BLOSC_ROOT``
Preferred installation prefix.
``BLOSC_INCLUDEDIR``
Preferred include directory e.g. <prefix>/include
``BLOSC_LIBRARYDIR``
Preferred library directory e.g. <prefix>/lib
``SYSTEM_LIBRARY_PATHS``
Paths appended to all include and lib searches.
#]=======================================================================]
mark_as_advanced(
Blosc_INCLUDE_DIR
Blosc_LIBRARY
)
# Append BLOSC_ROOT or $ENV{BLOSC_ROOT} if set (prioritize the direct cmake var)
set(_BLOSC_ROOT_SEARCH_DIR "")
if(BLOSC_ROOT)
list(APPEND _BLOSC_ROOT_SEARCH_DIR ${BLOSC_ROOT})
else()
set(_ENV_BLOSC_ROOT $ENV{BLOSC_ROOT})
if(_ENV_BLOSC_ROOT)
list(APPEND _BLOSC_ROOT_SEARCH_DIR ${_ENV_BLOSC_ROOT})
endif()
endif()
# Additionally try and use pkconfig to find blosc
find_package(PkgConfig)
pkg_check_modules(PC_Blosc QUIET blosc)
# ------------------------------------------------------------------------
# Search for blosc include DIR
# ------------------------------------------------------------------------
set(_BLOSC_INCLUDE_SEARCH_DIRS "")
list(APPEND _BLOSC_INCLUDE_SEARCH_DIRS
${BLOSC_INCLUDEDIR}
${_BLOSC_ROOT_SEARCH_DIR}
${PC_Blosc_INCLUDE_DIRS}
${SYSTEM_LIBRARY_PATHS}
)
# Look for a standard blosc header file.
find_path(Blosc_INCLUDE_DIR blosc.h
NO_DEFAULT_PATH
PATHS ${_BLOSC_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES include
)
if(EXISTS "${Blosc_INCLUDE_DIR}/blosc.h")
file(STRINGS "${Blosc_INCLUDE_DIR}/blosc.h"
_blosc_version_major_string REGEX "#define BLOSC_VERSION_MAJOR +[0-9]+ "
)
string(REGEX REPLACE "#define BLOSC_VERSION_MAJOR +([0-9]+).*$" "\\1"
_blosc_version_major_string "${_blosc_version_major_string}"
)
string(STRIP "${_blosc_version_major_string}" Blosc_VERSION_MAJOR)
file(STRINGS "${Blosc_INCLUDE_DIR}/blosc.h"
_blosc_version_minor_string REGEX "#define BLOSC_VERSION_MINOR +[0-9]+ "
)
string(REGEX REPLACE "#define BLOSC_VERSION_MINOR +([0-9]+).*$" "\\1"
_blosc_version_minor_string "${_blosc_version_minor_string}"
)
string(STRIP "${_blosc_version_minor_string}" Blosc_VERSION_MINOR)
unset(_blosc_version_major_string)
unset(_blosc_version_minor_string)
set(Blosc_VERSION ${Blosc_VERSION_MAJOR}.${Blosc_VERSION_MINOR})
endif()
# ------------------------------------------------------------------------
# Search for blosc lib DIR
# ------------------------------------------------------------------------
set(_BLOSC_LIBRARYDIR_SEARCH_DIRS "")
list(APPEND _BLOSC_LIBRARYDIR_SEARCH_DIRS
${BLOSC_LIBRARYDIR}
${_BLOSC_ROOT_SEARCH_DIR}
${PC_Blosc_LIBRARY_DIRS}
${SYSTEM_LIBRARY_PATHS}
)
# Static library setup
if(UNIX AND BLOSC_USE_STATIC_LIBS)
set(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif()
set(BLOSC_PATH_SUFFIXES
lib64
lib
)
find_library(Blosc_LIBRARY blosc
NO_DEFAULT_PATH
PATHS ${_BLOSC_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${BLOSC_PATH_SUFFIXES}
)
if(UNIX AND BLOSC_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
unset(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
endif()
# ------------------------------------------------------------------------
# Cache and set Blosc_FOUND
# ------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Blosc
FOUND_VAR Blosc_FOUND
REQUIRED_VARS
Blosc_LIBRARY
Blosc_INCLUDE_DIR
VERSION_VAR Blosc_VERSION
)
if(Blosc_FOUND)
set(Blosc_LIBRARIES ${Blosc_LIBRARY})
set(Blosc_INCLUDE_DIRS ${Blosc_INCLUDE_DIR})
set(Blosc_DEFINITIONS ${PC_Blosc_CFLAGS_OTHER})
get_filename_component(Blosc_LIBRARY_DIRS ${Blosc_LIBRARY} DIRECTORY)
if(NOT TARGET Blosc::blosc)
add_library(Blosc::blosc UNKNOWN IMPORTED)
set_target_properties(Blosc::blosc PROPERTIES
IMPORTED_LOCATION "${Blosc_LIBRARIES}"
INTERFACE_COMPILE_DEFINITIONS "${Blosc_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${Blosc_INCLUDE_DIRS}"
)
endif()
elseif(Blosc_FIND_REQUIRED)
message(FATAL_ERROR "Unable to find Blosc")
endif()
+101
View File
@@ -0,0 +1,101 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindFontconfig
--------------
Find Fontconfig headers and library.
Imported Targets
^^^^^^^^^^^^^^^^
``Fontconfig::Fontconfig``
The Fontconfig library, if found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables in your project:
``Fontconfig_FOUND``
true if (the requested version of) Fontconfig is available.
``Fontconfig_VERSION``
the version of Fontconfig.
``Fontconfig_LIBRARIES``
the libraries to link against to use Fontconfig.
``Fontconfig_INCLUDE_DIRS``
where to find the Fontconfig headers.
``Fontconfig_COMPILE_OPTIONS``
this should be passed to target_compile_options(), if the
target is not used for linking
#]=======================================================================]
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig QUIET)
pkg_check_modules(PKG_FONTCONFIG QUIET fontconfig)
set(Fontconfig_COMPILE_OPTIONS ${PKG_FONTCONFIG_CFLAGS_OTHER})
set(Fontconfig_VERSION ${PKG_FONTCONFIG_VERSION})
find_path( Fontconfig_INCLUDE_DIR
NAMES
fontconfig/fontconfig.h
HINTS
${PKG_FONTCONFIG_INCLUDE_DIRS}
/usr/X11/include
)
find_library( Fontconfig_LIBRARY
NAMES
fontconfig
PATHS
${PKG_FONTCONFIG_LIBRARY_DIRS}
)
if (Fontconfig_INCLUDE_DIR AND NOT Fontconfig_VERSION)
file(STRINGS ${Fontconfig_INCLUDE_DIR}/fontconfig/fontconfig.h _contents REGEX "^#define[ \t]+FC_[A-Z]+[ \t]+[0-9]+$")
unset(Fontconfig_VERSION)
foreach(VPART MAJOR MINOR REVISION)
foreach(VLINE ${_contents})
if(VLINE MATCHES "^#define[\t ]+FC_${VPART}[\t ]+([0-9]+)$")
set(Fontconfig_VERSION_PART "${CMAKE_MATCH_1}")
if(Fontconfig_VERSION)
string(APPEND Fontconfig_VERSION ".${Fontconfig_VERSION_PART}")
else()
set(Fontconfig_VERSION "${Fontconfig_VERSION_PART}")
endif()
endif()
endforeach()
endforeach()
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Fontconfig
FOUND_VAR
Fontconfig_FOUND
REQUIRED_VARS
Fontconfig_LIBRARY
Fontconfig_INCLUDE_DIR
VERSION_VAR
Fontconfig_VERSION
)
if(Fontconfig_FOUND AND NOT TARGET Fontconfig::Fontconfig)
add_library(Fontconfig::Fontconfig UNKNOWN IMPORTED)
set_target_properties(Fontconfig::Fontconfig PROPERTIES
IMPORTED_LOCATION "${Fontconfig_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${Fontconfig_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${Fontconfig_INCLUDE_DIR}"
)
endif()
mark_as_advanced(Fontconfig_LIBRARY Fontconfig_INCLUDE_DIR)
if(Fontconfig_FOUND)
set(Fontconfig_LIBRARIES ${Fontconfig_LIBRARY})
set(Fontconfig_INCLUDE_DIRS ${Fontconfig_INCLUDE_DIR})
endif()
+100
View File
@@ -0,0 +1,100 @@
# F I N D G E C O D E . C M A K E
# BRL-CAD
#
# Copyright (c) 2011-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# - Find Gecode constraint programming libraries
#
# The following variables are set:
#
# GECODE_INCLUDE_DIR
# GECODE_LIBRARIES
find_path(GECODE_INCLUDE_DIR gecode/search.hh)
find_library(GECODE_SUPPORT_LIB NAMES gecodesupport)
find_library(GECODE_KERNEL_LIB NAMES gecodekernel)
find_library(GECODE_SEARCH_LIB NAMES gecodesearch)
find_library(GECODE_INT_LIB NAMES gecodeint)
find_library(GECODE_SET_LIB NAMES gecodeset)
find_library(GECODE_FLOAT_LIB NAMES gecodefloat)
find_library(GECODE_MINIMODEL_LIB NAMES gecodeminimodel)
find_library(GECODE_DRIVER_LIB NAMES gecodedriver)
find_library(GECODE_FLATZINC_LIB NAMES gecodeflatzinc)
set(GECODE_LIBRARIES
${GECODE_SUPPORT_LIB}
${GECODE_KERNEL_LIB}
${GECODE_SEARCH_LIB}
${GECODE_INT_LIB}
${GECODE_SET_LIB}
${GECODE_FLOAT_LIB}
${GECODE_MINIMODEL_LIB}
${GECODE_DRIVER_LIB}
${GECODE_FLATZINC_LIB}
)
set(GECODE_LIBRARIES "${GECODE_LIBRARIES}" CACHE STRING "Gecode libraries")
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GECODE DEFAULT_MSG
GECODE_SUPPORT_LIB
GECODE_KERNEL_LIB
GECODE_SEARCH_LIB
GECODE_INT_LIB
GECODE_SET_LIB
GECODE_FLOAT_LIB
GECODE_MINIMODEL_LIB
GECODE_DRIVER_LIB
GECODE_FLATZINC_LIB
)
mark_as_advanced(
GECODE_SUPPORT_LIB
GECODE_KERNEL_LIB
GECODE_SEARCH_LIB
GECODE_INT_LIB
GECODE_SET_LIB
GECODE_FLOAT_LIB
GECODE_MINIMODEL_LIB
GECODE_DRIVER_LIB
GECODE_FLATZINC_LIB
)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+294
View File
@@ -0,0 +1,294 @@
# F I N D G L . C M A K E
# BRL-CAD
#
# Copyright (c) 2001-2020 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# - Try to find OpenGL
# Once done this will define
#
# OPENGL_FOUND - system has OpenGL
# OPENGL_XMESA_FOUND - system has XMESA
# OPENGL_GLU_FOUND - system has GLU
# OPENGL_INCLUDE_DIR_GL - the GL include directory
# OPENGL_INCLUDE_DIR_GLX - the GLX include directory
# OPENGL_LIBRARIES - Link these to use OpenGL and GLU
#
# If you want to use just GL you can use these values
# OPENGL_gl_LIBRARY - Path to OpenGL Library
# OPENGL_glu_LIBRARY - Path to GLU Library
#
# Define controlling option OPENGL_USE_AQUA if on Apple -
# if this is not true, look for the X11 OpenGL. Defaults
# to true.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ------------------------------------------------------------------------------
#
# The above copyright and license notice applies to distributions of
# CMake in source and binary form. Some source files contain additional
# notices of original copyright by their contributors; see each source
# for details. Third-party software packages supplied with CMake under
# compatible licenses provide their own copyright notices documented in
# corresponding subdirectories.
#
# ------------------------------------------------------------------------------
#
# CMake was initially developed by Kitware with the following sponsorship:
#
# * National Library of Medicine at the National Institutes of Health
# as part of the Insight Segmentation and Registration Toolkit (ITK).
#
# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
# Visualization Initiative.
#
# * National Alliance for Medical Image Computing (NAMIC) is funded by the
# National Institutes of Health through the NIH Roadmap for Medical Research,
# Grant U54 EB005149.
#
# * Kitware, Inc.
#
#=============================================================================
if(WIN32)
if(CYGWIN)
find_library(OPENGL_gl_LIBRARY opengl32 )
find_library(OPENGL_glu_LIBRARY glu32 )
find_path(OPENGL_INCLUDE_DIR_GL GL/gl.h )
endif(CYGWIN)
if(BORLAND)
set(OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
set(OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
endif(BORLAND)
if (NOT CYGWIN AND NOT BORLAND)
set(OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
set(OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
endif (NOT CYGWIN AND NOT BORLAND)
else (WIN32)
# The first line below is to make sure that the proper headers
# are used on a Linux machine with the NVidia drivers installed.
# They replace Mesa with NVidia's own library but normally do not
# install headers and that causes the linking to
# fail since the compiler finds the Mesa headers but NVidia's library.
# Make sure the NVIDIA directory comes BEFORE the others.
# - Atanas Georgiev <atanas@cs.columbia.edu>
set(OPENGL_INC_SEARCH_PATH
/usr/share/doc/NVIDIA_GLX-1.0/include
/usr/X11/include
/usr/X11R7/include
/usr/X11R6/include
/usr/include/X11
/usr/local/include/X11
/usr/local/include
/usr/include
/usr/openwin/share/include
/usr/openwin/include
/usr/pkg/xorg/include
/opt/X11/include
/opt/graphics/OpenGL/include
)
# Handle HP-UX cases where we only want to find OpenGL in either hpux64
# or hpux32 depending on if we're doing a 64 bit build.
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
else(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(HPUX_IA_OPENGL_LIB_PATH
/opt/graphics/OpenGL/lib/hpux64/
/opt/graphics/OpenGL/lib/pa20_64)
endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
get_property(SEARCH_64BIT GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if(SEARCH_64BIT)
set(64BIT_DIRS "/usr/lib64/X11;/usr/lib64;/usr/lib/x86_64-linux-gnu")
else(SEARCH_64BIT)
set(32BIT_DIRS "/usr/lib/X11;/usr/lib;/usr/lib/i386-linux-gnu")
endif(SEARCH_64BIT)
set(OPENGL_LIB_SEARCH_PATH
${64BIT_DIRS}
${32BIT_DIRS}
/usr/X11/lib
/usr/X11R7/lib
/usr/X11R6/lib
/usr/shlib
/usr/openwin/lib
/opt/X11/lib
/opt/graphics/OpenGL/lib
/usr/pkg/xorg/lib
${HPUX_IA_OPENGL_LIB_PATH}
)
if(APPLE)
OPTION(OPENGL_USE_AQUA "Require native OSX Framework version of OpenGL." ON)
endif(APPLE)
if(OPENGL_USE_AQUA)
find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX" )
find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
find_path(OPENGL_INCLUDE_DIR_GL OpenGL/gl.h DOC "Include for OpenGL on OSX")
else(OPENGL_USE_AQUA)
# If we're on Apple and not using Aqua, we don't want frameworks
set(CMAKE_FIND_FRAMEWORK_CACHED "${CMAKE_FIND_FRAMEWORK}")
set(CMAKE_FIND_FRAMEWORK "NEVER")
find_path(OPENGL_INCLUDE_DIR_GL GL/gl.h ${OPENGL_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH)
find_path(OPENGL_INCLUDE_DIR_GLX GL/glx.h ${OPENGL_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH)
find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h ${OPENGL_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH)
find_library(OPENGL_gl_LIBRARY NAMES GL MesaGL PATHS ${OPENGL_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH)
find_library(OPENGL_gldispatch_LIBRARY NAMES GLdispatch PATHS ${OPENGL_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH)
# On Unix OpenGL most certainly always requires X11.
# Feel free to tighten up these conditions if you don't
# think this is always true.
# It's not true on OSX.
if(OPENGL_gl_LIBRARY)
if(NOT X11_FOUND)
include(FindX11)
endif(NOT X11_FOUND)
if(X11_FOUND)
set(OPENGL_LIBRARIES ${X11_LIBRARIES})
endif(X11_FOUND)
endif(OPENGL_gl_LIBRARY)
find_library(OPENGL_glu_LIBRARY NAMES GLU MesaGLU PATHS ${OPENGL_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH)
set(CMAKE_FIND_FRAMEWORK "${CMAKE_FIND_FRAMEWORK_CACHED}")
endif(OPENGL_USE_AQUA)
endif(WIN32)
set( OPENGL_FOUND "NO" )
if(X11_FOUND)
if(OPENGL_INCLUDE_DIR_GLX AND OPENGL_INCLUDE_DIR_GL AND OPENGL_gl_LIBRARY)
set(OPENGL_FOUND "YES" )
endif(OPENGL_INCLUDE_DIR_GLX AND OPENGL_INCLUDE_DIR_GL AND OPENGL_gl_LIBRARY)
else(X11_FOUND)
if(MSVC)
if(OPENGL_gl_LIBRARY)
set(OPENGL_FOUND "YES" )
endif(OPENGL_gl_LIBRARY)
else(MSVC)
if(OPENGL_INCLUDE_DIR_GL AND OPENGL_gl_LIBRARY)
set(OPENGL_FOUND "YES" )
endif(OPENGL_INCLUDE_DIR_GL AND OPENGL_gl_LIBRARY)
endif(MSVC)
endif(X11_FOUND)
if(OPENGL_FOUND)
if(OPENGL_xmesa_INCLUDE_DIR)
set( OPENGL_XMESA_FOUND "YES" )
else(OPENGL_xmesa_INCLUDE_DIR)
set( OPENGL_XMESA_FOUND "NO" )
endif(OPENGL_xmesa_INCLUDE_DIR)
set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
if(OPENGL_glu_LIBRARY)
set(OPENGL_GLU_FOUND "YES" )
set(OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
else(OPENGL_glu_LIBRARY)
set( OPENGL_GLU_FOUND "NO" )
endif(OPENGL_glu_LIBRARY)
if(OPENGL_gldispatch_LIBRARY)
set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES} ${OPENGL_gldispatch_LIBRARY})
endif(OPENGL_gldispatch_LIBRARY)
# This deprecated setting is for backward compatibility with CMake1.4
set(OPENGL_LIBRARY ${OPENGL_LIBRARIES})
else(OPENGL_FOUND)
# We don't have enough, so no partials - clean up
set(OPENGL_INCLUDE_DIR_GL "" CACHE STRING "OpenGL not found" FORCE)
set(OPENGL_INCLUDE_DIR_GLX "" CACHE STRING "OpenGL not found" FORCE)
set(OPENGL_xmesa_INCLUDE_DIR "" CACHE STRING "OpenGL not found" FORCE)
set(OPENGL_glu_LIBRARY "" CACHE STRING "OpenGL not found" FORCE)
set(OPENGL_gl_LIBRARY "" CACHE STRING "OpenGL not found" FORCE)
endif(OPENGL_FOUND)
mark_as_advanced(
OPENGL_INCLUDE_DIR_GL
OPENGL_INCLUDE_DIR_GLX
OPENGL_xmesa_INCLUDE_DIR
OPENGL_glu_LIBRARY
OPENGL_gl_LIBRARY
)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

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