Compare commits

..

243 Commits

Author SHA1 Message Date
Binrui Dong ef85f3ce35 Backporting #52847 Remove duplicate ATM spawn from movie theater palette 2021-11-27 23:34:10 +08:00
Binrui Dong 5decd88fa6 Add translations for backported translation bugfixes 2021-11-27 23:34:10 +08:00
Binrui Dong 384143400f Backporting #52612 Fix more untranslated messages 2021-11-27 23:34:09 +08:00
Binrui Dong 58f5dd5716 Backporting #52580 Fix an untranslated message in ATM deposit menu 2021-11-27 23:34:09 +08:00
Binrui Dong c83633d76f Backporting #52356 Add more missing translations 2021-11-27 23:34:09 +08:00
Binrui Dong 32943e7906 Backporting #52289 Add omitted translation calls 2021-11-27 23:34:09 +08:00
Binrui Dong 54113a5c12 Backporting #52243 Add missing translation in aiming UI 2021-11-27 23:34:09 +08:00
Binrui Dong 9adb9a7a0b Backporting #50021 Translate monster death function messages 2021-11-27 23:34:08 +08:00
eso d6b727449d backporting tilesets from I-am-Erk/CDDA-Tilesets
used I-am-Erk/CDDA-Tilesets/releases/tag/2021-08-08 for ultica/chibi ultica
used #52474 for other tilesets
2021-11-27 16:36:58 +03:00
Binrui Dong fb7ce8197d Backporting #52656 Fix compile error on LLVM/Clang 13 2021-11-27 16:36:57 +03:00
Binrui Dong c5f9b905b2 Add translations for backported #51096, #51100, #51911 2021-11-27 16:36:57 +03:00
Binrui Dong d3840370f8 Backporting #52247 Fix compile errors on LLVM/Clang 13 2021-11-27 16:36:56 +03:00
Binrui Dong 8f53b248a5 Backporting #52197 Fix crash when getting related recipes with no components and results for current recipe 2021-11-27 16:36:56 +03:00
Binrui Dong 46e0eb9885 Backporting #52257 Fragile television 2021-11-27 16:36:56 +03:00
Binrui Dong d8682b4e2c Backporting #52010 Fix insect flesh vitamins 2021-11-27 16:36:56 +03:00
Binrui Dong edb0ef5c36 Backporting #52063 Fix NPCs cannot climb chickenwire fences but players can 2021-11-27 16:36:56 +03:00
Binrui Dong 9c8fd03bc8 Backporting #51911 Don't allow swapping places with NPC while grabbing something 2021-11-27 16:36:56 +03:00
Binrui Dong ba65d73d08 Backporting #51754 Fix: Force stereo when opening audio device 2021-11-27 16:36:56 +03:00
Binrui Dong fb00770a0b Backporting #51524 Fix eating demihuman not affecting morale 2021-11-27 16:36:56 +03:00
Binrui Dong 8320c3d319 Backporting #51529 Make monster::power_rating() use is_ranged_attacker() 2021-11-27 16:36:56 +03:00
Binrui Dong 16f47f5b7b Backporting #51381 Fix NC_JUNK_SHOPKEEP item list 2021-11-27 16:36:56 +03:00
Binrui Dong 698ecfd0f3 Backporting #51460 Actually throttle monster thinking 2021-11-27 16:36:56 +03:00
Binrui Dong 2bb3708135 Backporting #51362 Add DESTROYS, PUSH_MON to albertosaurus 2021-11-27 16:36:56 +03:00
Binrui Dong b92facbe8b Backporting #51282 Invalidate weight carried cache 2021-11-27 16:36:56 +03:00
Binrui Dong 600a2ed591 Backporting #51319 Fixed Filter Paper Always Hitting 2021-11-27 16:36:56 +03:00
Binrui Dong 9e3c288944 Backporting #51262 Fix sealed containers being targets for pickup actions 2021-11-27 16:36:56 +03:00
Binrui Dong 100ccdaf5e Backporting #51275 Iridescent cats now visible at night 2021-11-27 16:36:56 +03:00
Binrui Dong 51f819f5f9 Backporting #51205 A few microoptimizations 2021-11-27 16:36:56 +03:00
Binrui Dong 9ca0b0500a Backporting #51227 Fix: inedible MELTS while FROZEN (milkshake) 2021-11-27 16:36:56 +03:00
Binrui Dong 2d42991702 Backporting #51220 Ice cream is edible frozen 2021-11-27 16:36:56 +03:00
Binrui Dong 4547c69d5b Backporting #51124 Street facing churches 2021-11-27 16:36:56 +03:00
Binrui Dong 1048093919 Backporting #51226 Fix choppy vehicle animation 2021-11-27 16:36:56 +03:00
Binrui Dong 7e1440203a Backporting #51129 Fix infinitely falling vehicle 2021-11-27 16:36:56 +03:00
Binrui Dong 57af6033b0 Backporting #51086 In crafting every tool is displayed only once 2021-11-27 16:36:56 +03:00
Binrui Dong 4c58201d88 Backporting #51096 Prevent inserting an item with NO_UNWIELD into a container 2021-11-27 16:36:56 +03:00
Binrui Dong 0d755dba4a Backporting #51136 Fix spammy warning in string_formatter.h when using clang on Windows 2021-11-27 16:36:56 +03:00
Binrui Dong 5b7b0b2c2e Backporting #51250 Capping shakes duration to prevent month-long shakes after withdrawal is gone 2021-11-27 16:36:56 +03:00
Binrui Dong dfe37d4bbc Backporting #51411 Adjust cannibal trait cost 2021-11-27 16:36:56 +03:00
Binrui Dong 539d1c2e43 Backporting #51295 Limit zombie_fuse, other size change to within tiny-huge 2021-11-27 16:36:56 +03:00
Binrui Dong 9799bea8ce Backporting #51441 If want successful test output, include messages 2021-11-27 16:36:55 +03:00
Binrui Dong 0e6679d133 Backporting #51498 Make paper soft so it will fit in small pockets 2021-11-27 16:36:55 +03:00
Binrui Dong 8e58c8fae2 Revert Terminus blacklist on Mac (#50609) 2021-11-27 16:36:55 +03:00
Binrui Dong 4e5233edd7 Backporting #50933 Fix siphon from and fill to the same tank 2021-11-27 16:36:55 +03:00
Binrui Dong 7606834247 Backporting #50760 Fix for WEBWALK flag 2021-11-27 16:36:55 +03:00
Binrui Dong ac38b1e567 Fix compile error from backporting #47253 Unlimited map memory 2021-11-27 16:36:55 +03:00
Binrui Dong 67c9272716 Backporting #50834 Added fruit as a material in fruit wine 2021-11-27 16:36:55 +03:00
Binrui Dong 91a528e86f Backporting #50881 Silence warnings reported from inside SDL header 2021-11-27 16:36:55 +03:00
Binrui Dong f7c4c23a89 Backporting #49828 Fix health test 2021-11-27 16:36:55 +03:00
Binrui Dong 7d100dd6a0 Backporting #51131 Adds missing knives to the Krav Maga list 2021-11-27 16:36:55 +03:00
Binrui Dong 8c653d294a Backporting #51406 Make Gozu and Amigara yield demihuman meat 2021-11-27 16:36:55 +03:00
Binrui Dong c54f1412de Backporting #51519 Fix poppies unharvestable in Dark Skies mod 2021-11-27 16:36:55 +03:00
Binrui Dong 7c0357dc96 Backporting #51100 Fix clerical errors about Demihuman 2021-11-27 16:36:55 +03:00
Binrui Dong f7eb341099 Backporting #51199 Fix horde indicators showing in elements outside of sidebar overmap 2021-11-27 16:36:55 +03:00
Binrui Dong c9d5737aee Backporting #52413 Fix tabbing in character creation saving info 2021-11-27 16:36:55 +03:00
Binrui Dong bc3cd26000 Backporting #51711 Reset scenarios unconditionally 2021-11-27 16:36:55 +03:00
Binrui Dong 55758b8c45 Backporting #51710 Reset whitelist flag on scenario blacklist reset 2021-11-27 16:36:55 +03:00
Binrui Dong a1bcf205a8 Backporting #51447 Change item list highlight color to white 2021-11-27 16:36:55 +03:00
Binrui Dong c0089f6a2c Backporting #51439 Display name of loaded ammo instead of ammo type 2021-11-27 16:36:55 +03:00
Binrui Dong a1d3ee8cc3 Backporting #51458 Add the "mayfail" flag to the fire spreading test 2021-11-27 16:36:55 +03:00
Binrui Dong ad0a57d41e Backporting #51287 Animated background 2021-11-27 16:36:55 +03:00
Binrui Dong 5140ff9bf1 Backporting #51385 Fix bug when grabbing a vehicle 2021-11-27 16:36:55 +03:00
Binrui Dong 9717911148 Backporting #52133 Verify font can be rendered successfully at runtime 2021-11-27 16:36:55 +03:00
Binrui Dong 44be7a3353 Backporting #51407 Workaround for heavy slowdown caused by eager evaluation of debug message strings 2021-11-27 16:36:55 +03:00
Binrui Dong b9e47b64db Backporting #51257 Allow multitile sprites to be animated 2021-11-27 16:36:54 +03:00
Binrui Dong 6487fb5d34 Backporting #51580 Fix stair navigation 2021-11-27 16:36:54 +03:00
Binrui Dong a7edd2c418 Backporting #53019 Fix pathfinding hash functions for 32-bit systems 2021-11-27 16:36:54 +03:00
Binrui Dong 8ed5ce4491 Add translations for the new auto drive system 2021-11-27 16:36:54 +03:00
anothersimulacrum 25590f46f4 Remove strong stomach section of effects test
Remove the strong stomach immunity check in the tests, as it was removed
from the game in a96f069cd8
2021-11-27 16:36:53 +03:00
Binrui Dong fd74395ef3 Backporting #50835 Improved overmap pathfinding in 3D
Conflicts:
	src/overmap.cpp
	src/overmap_ui.cpp
	src/sdltiles.cpp
2021-11-27 16:36:53 +03:00
Binrui Dong adde31e02f Backporting #50803 Render one frame per turn during autodrive
Conflicts:
	src/do_turn.cpp
2021-11-27 16:36:53 +03:00
Binrui Dong 935f08d4c3 Backporting #50670 Make autowalk more like autodrive 2021-11-27 16:36:53 +03:00
Binrui Dong 1439253b73 Backporting #50695 Overmap path fixes 2021-11-27 16:36:53 +03:00
Binrui Dong 09b0ff2c32 Backporting #50637 Offroad autodrive
Conflicts:
	src/do_turn.cpp
	src/overmap_ui.cpp
2021-11-27 16:36:53 +03:00
Binrui Dong 289696c340 Backporting #49772 Autodrive v2 2021-11-27 16:36:53 +03:00
Binrui Dong 9fee3300da Backporting #50360 Handle window events during long operations
Conflicts:
	src/player_hardcoded_effects.cpp
	src/savegame.cpp
2021-11-27 16:36:53 +03:00
Binrui Dong cc20c9463a Backporting #49906 Return an invalid mm_submap if the map_memory is not prepared 2021-11-27 16:36:53 +03:00
Binrui Dong f1cfff8534 Backporting #47253 Unlimited map memory 2021-11-27 16:36:53 +03:00
Binrui Dong 4d9914ccc8 Update 0.F translations (#53037) 2021-11-27 16:36:53 +03:00
Binrui Dong 6b031ae7cc Update 0.F translations (#51742) 2021-11-27 16:36:52 +03:00
Binrui Dong a1c1be5e42 Update 0.F translations 2021-09-02 16:39:17 +08:00
ZhilkinSerg bd09f289fc Backporting #51147 Fix crash resulting from NPC activity migration (loading 0.F saves) 2021-08-31 16:23:05 +03:00
ZhilkinSerg 58b9625600 Backporting #51035 Resolve a bug in partial stack dropping/using and unify ui behaviour 2021-08-31 16:22:01 +03:00
ZhilkinSerg 54eb56477f Backporting #50814 Prevent endless loop during butchering 2021-08-31 16:21:14 +03:00
ZhilkinSerg 8d4ab327c9 Backporting #50452 Fix dropping worn items from AIM 2021-08-31 16:21:09 +03:00
ZhilkinSerg 4047cbbc46 Backporting #50877 Catch SecurityException in SDL getSerialNumber 2021-08-31 16:16:38 +03:00
ZhilkinSerg 8c7366e861 Remove excessive flag 2021-08-16 10:39:23 +03:00
ZhilkinSerg af757339fb Add missing flag 2021-08-15 21:19:36 +03:00
ZhilkinSerg 70df41c057 Backporting #50577 Fixed unpack leaving containers invalid 2021-08-15 01:12:07 +03:00
ZhilkinSerg 58ccc0a309 Backporting #50646 Recolor the blackjack oak 2021-08-15 01:12:07 +03:00
ZhilkinSerg 0dddd5f56b Backporting #50547 Do not remove vehicle label when canceling input 2021-08-15 01:12:06 +03:00
ZhilkinSerg d5b87fb673 Backporting #50606 Backport BN's MSVC sound fix 2021-08-15 01:12:06 +03:00
ZhilkinSerg 5a34702aa0 Backporting #50609 Disable Terminus.ttf on Mac 2021-08-15 01:12:05 +03:00
ZhilkinSerg f0a676648b Backporting #50610 Fix duplicate unitfont.ttf in config/fonts.json 2021-08-15 01:12:05 +03:00
ZhilkinSerg 855f7f5801 Backporting #50618 Billous Soldier Zombie acid-attack description fix 2021-08-15 01:12:04 +03:00
ZhilkinSerg 33753c81b1 Backporting #50616 Add repairs_like to runner pack 2021-08-15 01:12:04 +03:00
ZhilkinSerg f95dc0c4ae Backporting #50620 iwyu cuboid_rectangle.h 2021-08-15 01:12:04 +03:00
ZhilkinSerg 2a5958a0b2 Backporting #50601 Fix Bathroom scale symbol 2021-08-15 01:12:03 +03:00
ZhilkinSerg c3df285b1e Backporting #50602 Add a crafting recipe for skirts 2021-08-15 01:12:03 +03:00
ZhilkinSerg 059e11ab2a Backporting #50598 Camp NPCs will refuse to eat inedible animal food 2021-08-15 01:12:02 +03:00
ZhilkinSerg 4bfa5038ad Backporting #50607 Fixed density of legume products 2021-08-15 01:12:02 +03:00
ZhilkinSerg d23d0a6fca Backporting #50546 Avoid crashing when the player's gun is destroyed while firing. 2021-08-15 01:12:01 +03:00
ZhilkinSerg aca85182ff Backporting #50581 cmake: set RELEASE variable to generate install target 2021-08-15 01:12:01 +03:00
ZhilkinSerg fc2858fb0d Backporting #50588 Fix the wooden privacy gate name 2021-08-15 01:12:00 +03:00
ZhilkinSerg 4c7c1365ea Backporting #50478 Clarify the mission descriptions in the pizzaiolo quest line 2021-08-15 01:11:59 +03:00
ZhilkinSerg 21c9e66169 Backporting #50494 Fix the mission 'Visit the Isherwoods' that was impossible to complete 2021-08-15 01:11:59 +03:00
ZhilkinSerg b7f19fe57b Backporting #50385 Spawn correct underwear for female True Foodperson 2021-08-15 01:11:59 +03:00
ZhilkinSerg 8c63794209 Backporting #50528 random cosmetic traits respect scenario (#50224) 2021-08-15 01:11:58 +03:00
ZhilkinSerg 33f911e581 Backporting #50562 cmake: install core and help directories 2021-08-15 01:11:57 +03:00
ZhilkinSerg 007f136908 Backporting #50564 cmake: don't use PREFIX variable 2021-08-15 01:11:57 +03:00
ZhilkinSerg 6ea3bbba20 Backporting #50550 Avoid placing hospitals in the woods during MISSION_SCIENCE_REP_1 2021-08-15 01:11:56 +03:00
ZhilkinSerg da9d9d5577 Backporting #50448 Prevent display of martial arts traits as traits 2021-08-15 01:11:56 +03:00
ZhilkinSerg 6c0bb4cff2 Backporting #50487 Audit lawn mower length 2021-08-15 01:11:56 +03:00
ZhilkinSerg f7697317e6 Backporting #50555 Add missing dot and the end of the sencence 2021-08-15 01:11:55 +03:00
ZhilkinSerg 1e8c6acf86 Backporting #50556 Make ironshod quarterstaff looks like quarterstaff 2021-08-15 01:11:55 +03:00
ZhilkinSerg 443fd2aa09 Backporting #50471 Atomic headlamp should not have DURABLE_MELEE 2021-08-15 01:11:54 +03:00
ZhilkinSerg a747ab6691 Backporting #50508 Balance 'Rebar cage breaks into concrete floor, not pit' 2021-08-15 01:11:54 +03:00
ZhilkinSerg ac0566e0e7 Backporting #50525 Fixes crash during save due to invalid ammo_location 2021-08-15 01:11:53 +03:00
ZhilkinSerg 2c22bb59ab Backporting #50543 Avoid division-by-zero in lerped_multiplier 2021-08-15 01:11:53 +03:00
ZhilkinSerg 444a03c956 Backporting #50536 Fishing spears can be stored in spear strap 2021-08-15 01:11:52 +03:00
ZhilkinSerg b652f34b25 Backporting #50460 Modified the Batwing Zombie Description (#50383) 2021-08-15 01:11:52 +03:00
ZhilkinSerg ad514d1e05 Backporting #50000 Bugfixes 'Port fix for 'phantom fuel' from Cataclysm-BN' 2021-08-15 01:11:51 +03:00
ZhilkinSerg aac395c996 Backporting #50443 [DinoMod] dinos don't hear great 2021-08-15 01:11:51 +03:00
ZhilkinSerg 0edac6e6b2 Backporting #50371 Update Crowbars with DURABLE_MELEE 2021-08-15 01:11:50 +03:00
ZhilkinSerg 5da5a0bbdd Backporting #50240 Fix inconsistencies on all sleeveless dusters 2021-08-15 01:11:50 +03:00
ZhilkinSerg e89cfd82b8 Backporting #50416 set number to 1 if no charges 2021-08-15 01:11:49 +03:00
ZhilkinSerg f8374c8723 Backporting #50353 Fixed safe spawning on top of shrub in one of the houses 2021-08-15 01:11:49 +03:00
ZhilkinSerg 39fb5db51a Backporting #50174 Modified stained glass description to reflect the fact it is a wall with a high window, changed all external walls to stone walls for cathedral (#49440) 2021-08-15 01:11:48 +03:00
ZhilkinSerg e9e2b6542c Backporting #50309 Added barred window with no glass (#48453) 2021-08-15 01:11:48 +03:00
ZhilkinSerg 4ab2b3e73e Backporting #50401 Change armored car to use JP8 (#50252) 2021-08-15 01:11:47 +03:00
ZhilkinSerg 03f35cd113 Backporting #50381 Prevent stacking AIM windows when moving NO_UNWIELD flagged items 2021-08-15 01:11:47 +03:00
ZhilkinSerg 8bd75a66df Backporting #50251 Fix NPC claiming to eat FROZEN food without EDIBLE_FROZEN flag 2021-08-15 01:11:46 +03:00
ZhilkinSerg eb45251378 Backporting #50172 Reduce River weight to under 1k 2021-08-15 01:11:46 +03:00
ZhilkinSerg 513313ab51 Backporting #50403 fix strong stomach granting nausea immunity 2021-08-15 01:11:45 +03:00
ZhilkinSerg 217e48ef01 Backporting #50100 Fix resuming mass disassembly not working 2021-08-15 01:11:45 +03:00
ZhilkinSerg 587c439da5 Backporting #48864 Don't add magazines to all guns, don't show '(empty)' on unreloadable guns. 2021-08-15 01:11:44 +03:00
ZhilkinSerg e92e3de6c3 Backporting #49953 Serialize moves_total 2021-08-15 01:11:44 +03:00
ZhilkinSerg 3deb02e504 Backporting #50216 ASCII tileset QoL changes 2021-08-15 01:11:43 +03:00
ZhilkinSerg 46fa896d28 Backporting #50222 Fix layer ordering of demon skin 2021-08-15 01:11:43 +03:00
ZhilkinSerg ee7d7ebf13 Backporting #50272 Display kicking monster name 2021-08-15 01:11:42 +03:00
ZhilkinSerg 31a9445079 Backporting #50230 Bondage mask layer mismatch 2021-08-15 01:11:42 +03:00
ZhilkinSerg a7521fbde1 Backporting #50184 [DinoMod] wilderness spawn counts and fixes 2021-08-15 01:11:41 +03:00
ZhilkinSerg 3096e240f3 Backporting #49769 Remove CROWS turrets from irradiator overmap special 2021-08-15 01:11:41 +03:00
ZhilkinSerg 76eff7b68a Backporting #50243 Add Boxing to Self-Defense Classes 2021-08-15 01:11:40 +03:00
ZhilkinSerg b9b7f369ec Backporting #50170 Add permeable flag to appropriate windows 2021-08-15 01:11:40 +03:00
ZhilkinSerg d875153bf4 Backporting #50107 [Aftershock] Increase volume/weight of lichen, fix processing not neutralizing toxins 2021-08-15 01:11:39 +03:00
ZhilkinSerg b0c0d52b3b Backporting #49593 Raise the proportional AP value of handloaded 5.7mm 2021-08-15 01:11:39 +03:00
ZhilkinSerg d06496cf2b Backporting #49595 Target to Mac OS X 10.12+ in release build workflow 2021-08-15 01:11:38 +03:00
ZhilkinSerg 2bb04c9714 Backporting #50132 Fix armor pen from martial arts buffs not working 2021-08-15 01:11:38 +03:00
ZhilkinSerg 1931f386ec Backporting #50180 Fix multitile variations 2021-08-15 01:11:37 +03:00
ZhilkinSerg cfbbeeed6b Backporting #50134 Modified mass ratio of sheep wool on harvest to give similar to shearing returns (#48962) 2021-08-15 01:11:37 +03:00
ZhilkinSerg 5567139827 Backporting #50182 Fix wind not updating 2021-08-15 01:11:36 +03:00
ZhilkinSerg 09f9e523d2 Backporting #50165 Added condom to item restriction on travel wallet (#49932) 2021-08-15 01:11:36 +03:00
ZhilkinSerg 5a8be3ab5f Backporting #50074 Check skill requirements for vehicle most_repairable_part 2021-08-15 01:11:35 +03:00
ZhilkinSerg c2ac25e232 Backporting #48794 Ability to configure user-defined map extra symbols 2021-08-15 01:11:35 +03:00
ZhilkinSerg 6f5e946f5d Backporting #47257 Stand up peek 2021-08-15 01:11:34 +03:00
ZhilkinSerg 9b52ea2fdf Backporting #48462 Colorize spells in spellbooks 2021-08-15 01:11:34 +03:00
ZhilkinSerg 718816c213 Backporting #50114 Fix disappearance of CRIT vest on activation 2021-08-15 01:11:33 +03:00
ZhilkinSerg b7deccaab7 Backporting #50046 Recompute overmap::safe_at_worldgen during unserialize() 2021-08-15 01:11:33 +03:00
ZhilkinSerg 105d897757 Backporting #50096 Added batch cook times to Granola and Cookies (#50089) 2021-08-15 01:11:32 +03:00
ZhilkinSerg 06f22106e8 Backporting #50086 Update cordage and cordage ropes crafting time. 2021-08-15 01:11:32 +03:00
ZhilkinSerg 5f748564c4 Backporting #50006 vehicles: helicopters do not have 100% load in idle() 2021-08-15 01:11:31 +03:00
ZhilkinSerg 2df3253937 Backporting #50053 Require hemostatic powder to require *powdered* chitin only. 2021-08-15 01:11:31 +03:00
ZhilkinSerg cc47a76610 Backporting #50061 Changed morphine description to naturally occurring drug (#48710) 2021-08-15 01:11:30 +03:00
ZhilkinSerg 3741814bd3 Backporting #50044 Change stone chopper requirement from fab (3) to fab (2) to resolve crafting bottleneck. 2021-08-15 01:11:30 +03:00
ZhilkinSerg 1557248b36 Backporting #49949 Prevent UB passing 0 to LIGHT_RANGE 2021-08-15 01:11:29 +03:00
ZhilkinSerg 1a5545a27c Backporting #50043 Hatchets aren't melee durable 2021-08-15 01:11:29 +03:00
ZhilkinSerg 9ae4fd4d66 Backporting #49377 Prevent overmap mongroups from spawning on top of faction bases 2021-08-15 01:11:28 +03:00
ZhilkinSerg 35d7289212 Backporting #48930 Butchering use best tool in crafting radius 2021-08-15 01:11:28 +03:00
ZhilkinSerg c2508456ad Backporting #49957 Improve chance to find hidden lab in MISSION_SCIENCE_REP_3 2021-08-15 01:11:27 +03:00
ZhilkinSerg 417ee01443 Backporting #49879 Dogs zombify 2021-08-15 01:11:27 +03:00
ZhilkinSerg 573aea9608 Backporting #49919 [Dinomod] Duplicate entry caused CTD 2021-08-15 01:11:26 +03:00
ZhilkinSerg 389638045a Backporting #49995 Fix ammo capitalization 2021-08-15 01:11:26 +03:00
ZhilkinSerg f4a602417a Backporting #50032 Changed Humvee jerrycans to use JP8 fuel (#50008) 2021-08-15 01:11:25 +03:00
ZhilkinSerg 8b19e25533 Backporting #48662 When telling NPCs to read something, include all columns in the 'choose a book' popup 2021-08-15 01:11:25 +03:00
ZhilkinSerg 80b88879c9 Backporting #50003 Chainlink fence posts now require pipe fittings to build 2021-08-15 01:11:24 +03:00
ZhilkinSerg 9e07fe4776 Backporting #49997 Use positional arguments for 'It should take %d minutes to finish washing items in the %s.' 2021-08-15 01:11:24 +03:00
ZhilkinSerg 426e239c51 Backporting #49442 Change Hobo Stove to deployable furniture 2021-08-15 01:11:23 +03:00
ZhilkinSerg 7e8a0262c6 Backporting #49962 fixed reload times of guns 2021-08-15 01:11:23 +03:00
ZhilkinSerg fbb5a54071 Backporting #49931 Hide vehicle UI when pouring on the ground 2021-08-15 01:11:22 +03:00
ZhilkinSerg 889cbed161 Backporting #49946 Remove TRADER_AVOID flag from mre containers 2021-08-15 01:11:22 +03:00
ZhilkinSerg d7bc6e9421 Backporting #49934 Allow MISSION_FREE_MERCHANTS_HUB_DELIVERY_1 to complete after player has already met HUB-01 2021-08-15 01:11:21 +03:00
ZhilkinSerg 0ef911946c Backporting #49904 Fix weapons dropping without message on reload 2021-08-15 01:11:21 +03:00
ZhilkinSerg c063bc408d Backporting #49805 Fix weight of wild yeast 2021-08-15 01:11:20 +03:00
ZhilkinSerg 91de948d3b Backporting #49861 fix meatarian/vegetarian text 2021-08-15 01:11:20 +03:00
ZhilkinSerg be03766bbb Backporting #49883 Increased volume and length of western holster to accommodate other revolvers (#48532) 2021-08-15 01:11:19 +03:00
ZhilkinSerg 37cb20105e Backporting #49871 Makes flammable arrow components reflect the damage. 2021-08-15 01:11:19 +03:00
ZhilkinSerg 6c73abfbcc Backporting #49613 Changed time and energy to create a washboard. 2021-08-15 01:11:18 +03:00
ZhilkinSerg febf03a99b Backporting #49764 Reordered magazine type for M17/M18 2021-08-15 01:11:17 +03:00
ZhilkinSerg 4d167d0b8d Backporting #49729 Sword cane should fit in the hollow cane 2021-08-15 01:11:17 +03:00
ZhilkinSerg dd13624aca Backporting #49217 [Magiclysm] More magical loot in wizard towers 2021-08-15 01:11:17 +03:00
ZhilkinSerg e18a3ff5da Backporting #48746 [Magiclysm] Leprechaun adjustments 2021-08-15 01:11:16 +03:00
ZhilkinSerg af57ba3281 Backporting #49844 Correct the plural name of 'mana infused blood' 2021-08-15 01:11:16 +03:00
ZhilkinSerg cf1ed0efbd Backporting #48078 [Magiclysm] Add mutations to manatouched 2021-08-15 01:11:15 +03:00
ZhilkinSerg 9f0d802aa0 Backporting #48651 [Magiclysm] Can't cast if Stunned 2021-08-15 01:11:15 +03:00
ZhilkinSerg d55e25c9b7 Backporting #49751 Correct monster_size_capacity to creature_size_capacity 2021-08-15 01:11:14 +03:00
ZhilkinSerg 52d66a603e Backporting #49794 Move workshop toolbox recipe to containers tab 2021-08-15 01:11:14 +03:00
ZhilkinSerg 42c105e5d8 Backporting #49758 Make cooking oil unhealthy 2021-08-15 01:11:13 +03:00
ZhilkinSerg 46bea9c96f Backporting #49799 Fix healthy rounding bug 2021-08-15 01:11:13 +03:00
ZhilkinSerg ea26b17cad Backporting #49778 Force place_special_forced to place special in forced mode 2021-08-15 01:11:12 +03:00
ZhilkinSerg a24052b771 Backporting #49759 Fix CBM install data retrieval when installing CBM on NPC 2021-08-15 01:11:12 +03:00
ZhilkinSerg 0b3fc418fb Backporting #45584 Balance tactical helmets 2021-08-15 01:11:11 +03:00
ZhilkinSerg 9c3b8f26ef Backporting #49279 Remove additional spawns from Wander Hordes 2021-08-15 01:11:11 +03:00
ZhilkinSerg 3e1f17f1db Backporting #49762 Change recipe sort to difficulty, name, crafting time 2021-08-15 01:11:10 +03:00
ZhilkinSerg ba21f23db1 Backporting #47986 Populated Bone Skewers into recipes, made Skewers millable 2021-08-15 01:11:10 +03:00
ZhilkinSerg 2eab49c39e Backporting #49109 fix feints and lightly clean up some miss recovery and grab break code; 2021-08-15 01:11:09 +03:00
ZhilkinSerg 7c89846f24 Backporting #49380 10mm adheres to GAME_BALANCE.md 2021-08-15 01:11:09 +03:00
ZhilkinSerg 23a1cddda2 Backporting #49760 Improve error message re armor portions 2021-08-15 01:11:08 +03:00
ZhilkinSerg 4211d63ea9 Backporting #48960 Fix various meaty comestibles' vitamin values 2021-08-15 01:11:07 +03:00
ZhilkinSerg 01cb5819f2 Backporting #49512 Reworked brewing, now with merge conflicts resolved 2021-08-15 01:11:07 +03:00
ZhilkinSerg 5b5418d744 Backporting #48827 Replace MREs with itemgroups 2021-08-15 01:11:06 +03:00
ZhilkinSerg c0290c0357 Backporting #49596 Roof and general improvements for orchard_apple 2021-08-15 01:11:06 +03:00
ZhilkinSerg 4cc95c1067 Backporting #48637 Fix fur/scales loop in Chimera 2021-08-15 01:11:05 +03:00
ZhilkinSerg c36b12a422 Backporting #49303 Adjust Burrowing mutation's description/effects 2021-08-15 01:11:04 +03:00
ZhilkinSerg 6499b6dac0 Backporting #49734 Reduce solder in electronics control unit from 150 to 40 2021-08-15 01:11:04 +03:00
ZhilkinSerg 564a690586 Backporting #49550 Colt Delta Damage 2021-08-15 01:11:04 +03:00
ZhilkinSerg 376d6e7b95 Backporting #49318 Ignore pocket settings when manually inserting stackable items 2021-08-15 01:11:03 +03:00
ZhilkinSerg 7772c175ce Backporting #49513 Fix Cut Logs faction camp mission difficulty disp. 2021-08-15 01:11:03 +03:00
ZhilkinSerg fd6b19662b Backporting #49534 Made Tea batch crafting mod equal to boiling plain water 2021-08-15 01:11:02 +03:00
ZhilkinSerg 9b2586beb3 Backporting #49559 Add belt clip ability to webbing belt 2021-08-15 01:11:02 +03:00
ZhilkinSerg 796a2873c5 Backporting #45787 Lowered encumbrance and tweaked belts 2021-08-15 01:11:01 +03:00
ZhilkinSerg f87f219948 Backporting #49577 Fix orc village's name 2021-08-15 01:11:01 +03:00
ZhilkinSerg ce5758b4a1 Backporting #49622 Make Tallon Mutation allow fingerless gloves 2021-08-15 01:11:00 +03:00
ZhilkinSerg 6b7e868469 Backporting #49599 Prophylactic antivenom pills rename 2021-08-15 01:11:00 +03:00
ZhilkinSerg 08ed12a1b2 Backporting #49421 Change time to install oars from 60 m to 60 s 2021-08-15 01:10:59 +03:00
ZhilkinSerg b7d70d1ce8 Backporting #49690 Fix typo in stone.json 2021-08-15 01:10:59 +03:00
ZhilkinSerg 3e4f08fa64 Backporting #49741 Fix:Ninjutsu martial art does incorrect damage due to multiplicative … 2021-08-15 01:10:58 +03:00
ZhilkinSerg 6be7e6d3d2 Backporting #49628 Update keg description to no longer errorneously suggest they can be used for fermenting 2021-08-15 01:10:58 +03:00
ZhilkinSerg ce30683220 Backporting #49715 Update monster_attacks.json 2021-08-15 01:10:57 +03:00
ZhilkinSerg 5b5525f4c3 Backporting #49597 Allow a region overlay to set all weights to zero 2021-08-15 01:10:57 +03:00
ZhilkinSerg bac86e6f19 Backporting #49631 Add the missing door in private resort 2021-08-15 01:10:56 +03:00
ZhilkinSerg 796ebea2b3 Backporting #49401 Chitin Leg Guards and Tails 2021-08-15 01:10:56 +03:00
ZhilkinSerg ca3188ade5 Backporting #49589 Migrate legacy wheels and fix memory corruption in vehicle deserialization 2021-08-15 01:10:56 +03:00
ZhilkinSerg b25fd9cb2a Backporting #48882 Fix magiclysm 1L V-Twin Engine has infinite fuel 2021-08-15 01:10:55 +03:00
ZhilkinSerg e765381d53 Backporting #49568 Add back legacy wheel definitions 2021-08-15 01:10:55 +03:00
ZhilkinSerg 18087c6795 Backporting #49565 Add version to debugmsg 2021-08-15 01:10:54 +03:00
ZhilkinSerg bbf92bebc2 Backporting #49211 Add lesser magic items to pawn and hunting itemgroups 2021-08-15 01:10:54 +03:00
ZhilkinSerg f5a0d72329 Backporting #48607 Mapgen road connections improved in the absence of overmap cities 2021-08-15 01:10:53 +03:00
ZhilkinSerg 04f5f0ec68 Backporting #49543 Only apply disabled effect for main bodyparts 2021-08-15 01:10:53 +03:00
ZhilkinSerg 53444d52f5 Backporting #49537 Fix incorrect conditional name of smoked wasteland sausage 2021-08-15 01:10:52 +03:00
ZhilkinSerg 87e68dbf04 Backporting #49396 Fix classic zombies map extras chance values which could cause debugmsg 2021-08-15 01:10:52 +03:00
exuvo 7525457c6e Fix manually assigned item letter being removed on unwield (#50173)
* Fix auto inventory letters only assigning wield or wear, stop duplicating letters.
* Fix unwielding item removing manually assigned letter
* Add new argument to inventory add functions for if item comes from character inventory

Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
2021-08-07 00:41:54 -07:00
Álvaro 1bc09a8212 Fix overmap NPC names showing for NPCs out of range (#50534) 2021-08-07 00:31:01 -07:00
Hirmuolio aaa1898805 update old weld req 2021-07-06 18:41:25 -07:00
8145 changed files with 5992432 additions and 12674896 deletions
+28
View File
@@ -0,0 +1,28 @@
version: '{branch}.{build}'
image: Visual Studio 2019
configuration: Release
platform: x86
shallow_clone: true
clone_folder: C:\Projects\Cataclysm-DDA
cache:
- c:\tools\vcpkg\installed
- c:\Users\appveyor\AppData\Local\vcpkg\
install:
- cmd: cd c:\tools\vcpkg\
- cmd: git pull
- cmd: bootstrap-vcpkg.bat -disableMetrics
- cmd: vcpkg --triplet %PLATFORM%-windows-static install sdl2 sdl2-image sdl2-mixer[libflac,mpg123,libmodplug,libvorbis] sdl2-ttf gettext --recurse
build:
project: /msvc-full-features/Cataclysm-vcpkg-static.sln
parallel: true
verbosity: minimal
only_commits:
files:
- '.appveyor.yml'
- 'msvc-full-features/**'
- 'src/**'
- 'tests/**'
branches:
only:
- master
-5
View File
@@ -49,8 +49,3 @@
# insert space padding around parentheses on the inside only
--pad-paren-in
# exclude src/third-party
--exclude=src/third-party
# but don't be sad about no tests/src/third-party
--ignore-exclude-errors-x
+21 -36
View File
@@ -4,30 +4,6 @@
# this codebase and we do not intend to fix. The disabled checks appearing
# thereafter in a separate alphabetical list have yet to be triaged. We may
# fix their errors or recategorise them as checks we don't care about.
#
# Comments on the checks we have decided are not worthwhile:
#
# * cert-dcl21-cpp (postfix operator++ and operator-- should return const objects)
# This is an unconventional code style, and conflicts with
# readability-const-return-type.
#
# * cert-env33-c (calls to system, popen)
# Unlikely to catch bugs, and using system is convenient for portability.
#
# * cert-err58-cpp (exceptions from static variable declarations)
# We have lots of memory allocations in static variable declarations, and
# that's fine.
#
# * modernize-use-auto
# We prefer an almost-always-avoid-auto style.
#
# * modernize-use-trailing-return-type
# An arbitrary style convention we haven't adopted.
#
# * readability-braces-around-statements
# Covered by astyle and buggy in clang-tidy 8. Can enable once we have a newer
# clang-tidy.
Checks: "\
bugprone-*,\
cata-*,\
@@ -45,33 +21,42 @@ modernize-*,\
-modernize-use-trailing-return-type,\
performance-*,\
readability-*,\
-readability-braces-around-statements,\
-bugprone-misplaced-widening-cast,\
-bugprone-narrowing-conversions,\
-misc-no-recursion,\
-bugprone-unused-return-value,\
-cert-err34-c,\
-cert-flp30-c,\
-cert-msc30-c,\
-cert-msc32-c,\
-cert-msc50-cpp,\
-cert-msc51-cpp,\
-misc-non-private-member-variables-in-classes,\
-modernize-avoid-c-arrays,\
-modernize-pass-by-value,\
-modernize-return-braced-init-list,\
-modernize-use-default-member-init,\
-modernize-use-nodiscard,\
-readability-convert-member-functions-to-static,\
-modernize-use-emplace,\
-performance-inefficient-vector-operation,\
-performance-noexcept-move-constructor,\
-performance-implicit-conversion-in-loop,\
-performance-inefficient-string-concatenation,\
-performance-type-promotion-in-math-fn,\
-performance-unnecessary-value-param,\
-readability-braces-around-statements,\
-readability-else-after-return,\
-readability-function-cognitive-complexity,\
-readability-function-size,\
-readability-implicit-bool-conversion,\
-readability-isolate-declaration,\
-readability-magic-numbers,\
-readability-named-parameter,\
-readability-use-anyofallof,\
"
WarningsAsErrors: '*'
HeaderFilterRegex: '(src|test|tools).*'
FormatStyle: none
CheckOptions:
- key: cata-large-inline-function.MaxStatements
value: 5
- key: cata-text-style.EscapeUnicode
value: 0
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: true
- key: readability-uppercase-literal-suffix.NewSuffixes
value: 'L;UL;LL;ULL'
- key: cata-text-style.EscapeUnicode
value: 0
# vim:tw=0
-1
View File
@@ -15,4 +15,3 @@ end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
+7 -7
View File
@@ -7,25 +7,25 @@
/data/mods/DinoMod/ @ephemeralstoryteller @damien @LyleSY
/data/mods/Graphical_Overmap/ @Kilvoctu @Larwck
/data/mods/MMA/ @Hymore246
/data/mods/No_Fungi/ @I-am-Erk
/data/mods/blazemod/ @SouP
/data/mods/classic_zombies/ @I-am-Erk
/data/mods/crt_expansion/ @Soupster89
/data/mods/desertpack/ @davidpwbrown
/data/mods/desertpack/ @davidpwbrown
/data/mods/generic_guns/ @tenmillimaster
/data/mods/Magiclysm/ @KorGgenT
/data/mods/My_Sweet_Cataclysm/ @Fris0uman
/data/mods/ruralbiome/ @I-am-Erk
/data/mods/speedydex/ @KorGgenT
/data/mods/stats_through_kills/ @KorGgenT
/data/mods/Xedra_Evolved/ @Maleclypse
/data/mods/Dark-Skies-Above/ @ephemeralstoryteller
/data/mods/No_Hope/ @Night-Pryanik
/data/mods/innawood/ @Light-Wave
/data/mods/MA/ @ZhilkinSerg
magic*.cpp @KorGgenT
magic*.h @KorGgenT
/data/json/itemgroups/SUS/ @I-am-Erk
/data/json/npcs/refugee_center/ @I-am-Erk
/data/json/npcs/Backgrounds/ @I-am-Erk
/data/json/snippets/ @I-am-Erk
/gfx/ @I-am-Erk
/tools/ @int-ua
/lang/ @BrettDong
widget.cpp @wapcaplet @dseguin
widget.h @wapcaplet @dseguin
+325
View File
@@ -0,0 +1,325 @@
# Contribute
**Opening a new issue?** Please read [ISSUES.md](../ISSUES.md) first.
Contributing to Cataclysm: Dark Days Ahead is easy — simply fork the repository here on GitHub, make your changes, and then send us a pull request.
Cataclysm:Dark Days Ahead is released under the Creative Commons Attribution ShareAlike 3.0 license. The code and content of the game is free to use, modify, and redistribute for any purpose whatsoever. See http://creativecommons.org/licenses/by-sa/3.0/ for details.
This means any contribution you make to the project will also be covered by the same license, and this license is irrevocable.
## Guidelines
There are a couple of guidelines we suggest sticking to:
* Add this repository as an `upstream` remote.
* Keep your `master` branch clean. This means you can easily pull changes made to this repository into yours.
* Create a new branch for each new feature or set of related bug fixes.
* Never merge from your local branches into your `master` branch. Only update that by pulling from `upstream/master`.
## Code Style
Code style is enforced across the codebase by `astyle`.
See [CODE_STYLE](../doc/CODE_STYLE.md) for details.
## Translations
The translation of Cataclysm: DDA is done using Transifex.
Look at the [translation project](https://www.transifex.com/cataclysm-dda-translators/cataclysm-dda/) for an up-to-date list of supported languages.
See [TRANSLATING](../doc/TRANSLATING.md) for more information:
* [For translators](../doc/TRANSLATING.md#translators)
* [For developers](../doc/TRANSLATING.md#developers)
* [For maintainers](../doc/TRANSLATING.md#maintainers)
## Doxygen Comments
Extensive documentation of classes and class members will make the code more readable to new contributors. New doxygen comments for existing classes are a welcomed contribution.
Use the following template for commenting classes:
```c++
/**
* Brief description
*
* Lengthy description with many words. (optional)
*/
class foo {
```
Use the following template for commenting functions:
```c++
/**
* Brief description
*
* Lengthy description with many words. (optional)
* @param param1 Description of param1 (optional)
* @return Description of return (optional)
*/
int foo(int param1);
```
Use the following template for commenting member variables:
```c++
/** Brief description **/
int foo;
```
Helpful pages:
* [Doxygen Manual - Special Commands](https://www.doxygen.nl/manual/commands.html)
* [Doxygen Manual - Standard Markdown](https://www.doxygen.nl/manual/markdown.html#markdown_std)
* [Doxygen Manual - Frequently Asked Questions](https://www.doxygen.nl/manual/faq.html)
### Guidelines for adding documentation
* Doxygen comments should describe behavior towards the outside, not implementation, but since many classes in Cataclysm are intertwined, it's often necessary to describe implementation.
* Describe things that aren't obvious to newcomers just from the name.
* Don't describe redundantly: `/** Map **/; map* map;` is not a helpful comment.
* When documenting X, describe how X interacts with other components, not just what X itself does.
### Building the documentation for viewing it locally
* Install doxygen
* `doxygen doxygen_doc/doxygen_conf.txt `
* `firefox doxygen_doc/html/index.html` (replace firefox with your browser of choice)
## Example Workflow
#### Setup your environment
*(This only needs to be done once.)*
1. Fork this repository here on GitHub.
2. Clone your fork locally.
$ git clone https://github.com/YOUR_USERNAME/Cataclysm-DDA.git
# Clones your fork of the repository into the current directory in terminal
3. Set commit message template.
$ git config --local commit.template .gitmessage
4. Add this repository as a remote.
$ cd Cataclysm-DDA
# Changes the active directory in the prompt to the newly cloned "Cataclysm-DDA" directory
$ git remote add -f upstream https://github.com/CleverRaven/Cataclysm-DDA.git
# Assigns the original repository to a remote called "upstream"
For further details about commit message guidelines please visit:
- [codeinthehole.com](https://codeinthehole.com/tips/a-useful-template-for-commit-messages/)
- [chris.beams.io](https://chris.beams.io/posts/git-commit/)
- [help.github.com](https://help.github.com/articles/closing-issues-using-keywords/)
#### Update your `master` branch
1. Make sure you have your `master` branch checked out.
$ git checkout master
2. Pull the changes from the `upstream/master` branch.
$ git pull --ff-only upstream master
# gets changes from "master" branch on the "upstream" remote
* Note: If this gives you an error, it means you have committed directly to your local `master` branch. [Click here for instructions on how to fix this issue](#why-does-git-pull---ff-only-result-in-an-error).
$ git push origin master
# optionally, push the synced master state to your fork
#### Make your changes
0. Update your `master` branch, if you haven't already.
1. For each new feature or bug fix, create a new branch.
$ git branch new_feature
# Creates a new branch called "new_feature"
$ git checkout new_feature
# Makes "new_feature" the active branch
2. Once you've committed some changes locally, you need to push them to your fork here on GitHub.
$ git push origin new_feature
# origin was automatically set to point to your fork when you cloned it
3. Once you're finished working on your branch, and have committed and pushed all your changes, submit a pull request from your `new_feature` branch to this repository's `master` branch.
* Note: any new commits to the `new_feature` branch on GitHub will automatically be included in the pull request, so make sure to only commit related changes to the same branch.
## Drafts
If you file a PR but you're still working on it, please make it a [Draft](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
![screenshot](https://docs.github.com/assets/images/help/pull_requests/pullrequest-send.png)
This will tell the reviewers that you still intend to add more to the PR and we don't need to review it yet. When it's ready to be reviewed for a merger, just click the [`Ready for review`](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request) button.
![screenshot](https://docs.github.com/assets/images/help/pull_requests/ready-for-review-button.png)
Please convert all your existing PRs with `[WIP]` in the title to Drafts.
![screenshot](https://docs.github.com/assets/images/help/pull_requests/convert-to-draft-link.png)
This can help speed up our review process by allowing us to only review the things that are ready for it, and will help prevent merging in anything that isn't completely ready.
## Comment requests
If you are also looking for suggestions then add a [CR] before the title text — "comments requested". Feel free to remove [CR] when you feel you got enough information to proceed.
It is not required to solve or reference an open issue to file a PR, however, if you do so, you need to explain the problem your PR is solving in full detail.
### All PRs should have a "Summary" section with one line
Summary is a one-line description of your change that will be extracted and added to [the project changelog](../data/changelog.txt).
The format is:
```
#### Summary
Category "description"
```
The categories to choose from are: Features, Content, Interface, Mods, Balance, Bugfixes, Performance, Infrastructure, Build, I18N.
Example:
```
#### Summary
Content "Adds new mutation category 'Mouse'"
```
Or, if you want it treated as a minor tweak that doesn't appear in the changelog:
```
#### Summary
None
```
See [the Changelog Guidelines](../doc/CHANGELOG_GUIDELINES.md) for explanations of the categories.
### Closing issues using keywords
One more thing: when marking your PR as closing, fixing, or resolving issues, please include "XXXX #???" somewhere in the description, where XXX is on this list:
* close
* closes
* closed
* fix
* fixes
* fixed
* resolve
* resolves
* resolved
The "???" is the issue number. This automatically closes the issue when the PR is pulled in, and allows merges to work slightly faster. To close multiple issues format it as "XXXX #???, XXXX#???".
See https://help.github.com/articles/closing-issues-using-keywords/ for more.
## Keep your PR description relevant
Make sure your PR description is still relevant every time you change your branch after discussion or additional thought.
## Tooling support
Various tools are available to help you keep your contributions conforming to the appropriate style. See [the relevant docs](../doc/DEVELOPER_TOOLING.md) for more details.
## Advanced Techniques
These guidelines aren't essential, but they can make keeping things in order much easier.
#### Using remote tracking branches
Remote tracking branches allow you to easily stay in touch with this repository's `master` branch, as they automatically know which remote branch to get changes from.
$ git branch -vv
* master xxxx [origin/master] ....
new_feature xxxx ....
Here you can see we have two branches; `master` which is tracking `origin/master`, and `new_feature` which isn't tracking any branch. In practice, what this means is that git won't know where to get changes from.
$ git checkout new_feature
Switched to branch 'new_feature'
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
In order to easily pull changes from `upstream/master` into the `new_feature` branch, we can tell git which branch it should track. (You can even do this for your local master branch.)
$ git branch -u upstream/master new_feature
Branch new_feature set up to track remote branch master from upstream.
$ git pull
Updating xxxx..xxxx
....
You can also set the tracking information at the same time as creating the branch.
$ git branch new_feature_2 --track upstream/master
Branch new_feature_2 set up to track remote branch master from upstream.
* Note: Although this makes it easier to pull from `upstream/master`, it doesn't change anything with regards to pushing. `git push` fails because you don't have permission to push to `upstream/master`.
$ git push
error: The requested URL returned error: 403 while accessing https://github.com/CleverRaven/Cataclysm-DDA.git
fatal: HTTP request failed
$ git push origin
....
To https://github.com/YOUR_USERNAME/Cataclysm-DDA.git
xxxx..xxxx new_feature -> new_feature
## Unit tests
There is a suite of tests built into the source tree at tests/
You should run the test suite after ANY change to the game source.
An ordinary invocation of `make` will build the test executable at tests/cata_test, and it can be invoked like any ordinary executable, or via `make check`.
Running `test/cata_test` with no arguments will run the entire test suite; running it with `--help` will print a number of invocation options you can use to adjust its operation.
$ make
... compilation details ...
$ tests/cata_test
Starting the actual test at Fri Nov 9 04:37:03 2018
===============================================================================
All tests passed (1324684 assertions in 94 test cases)
Ended test at Fri Nov 9 04:37:45 2018
The test took 41.772 seconds
I recommend habitually invoking make like ``make YOUR BUILD OPTIONS && make check``.
If you're working with Visual Studio (and don't have `make`), see [Visual Studio-specific advice](../doc/COMPILING/COMPILING-VS-VCPKG.md#running-unit-tests).
If you want/need to add a test, see [TESTING.md](../doc/TESTING.md)
## In-game testing, test environment and the debug menu
Whether you are implementing a new feature or whether you are fixing a bug, it is always a good practice to test your changes in-game. It can be a hard task to create the exact conditions by playing a normal game to be able to test your changes, which is why there is a debug menu. There is no default key to bring up the menu so you will need to assign one first.
Bring up the keybindings menu (press `Escape` then `1`), scroll down almost to the bottom and press `+` to add a new key binding. Press the letter that corresponds to the *Debug menu* item, then press the key you want to use to bring up the debug menu. To test your changes, create a new world with a new character. Once you are in that world, press the key you just assigned for the debug menu and you should see something like this:
```
┌───────────────────────────────────────────────────────────────────────────┐
│ Debug Functions - Using these will cheat not only the game, but yourself. │
├───────────────────────────────────────────────────────────────────────────┤
│ i Info │
│ Q Quit to main menu │
│ s Spawning… │
│ p Player… │
│ t Teleport… │
│ m Map… │
└───────────────────────────────────────────────────────────────────────────┘
```
With these commands, you should be able to recreate the proper conditions to test your changes. You can find some more information about the debug menu on [the official wiki](http://cddawiki.chezzo.com/cdda_wiki/index.php).
## Frequently Asked Questions
#### Why does `git pull --ff-only` result in an error?
If `git pull --ff-only` shows an error, it means that you've committed directly to your local `master` branch. To fix this, we create a new branch with these commits, find the point at which we diverged from `upstream/master`, and then reset `master` to that point.
$ git pull --ff-only upstream master
From https://github.com/CleverRaven/Cataclysm-DDA
* branch master -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.
$ git branch new_branch master # mark the current commit with a tmp branch
$ git merge-base master upstream/master
cc31d0... # the last commit before we committed directly to master
$ git reset --hard cc31d0....
HEAD is now at cc31d0... ...
Now that `master` has been cleaned up, we can easily pull from `upstream/master`, and then continue working on `new_branch`.
$ git pull --ff-only upstream master
# gets changes from the "upstream" remote for the matching branch, in this case "master"
$ git checkout new_branch
For more frequently asked questions, see the [developer FAQ](../doc/DEVELOPER_FAQ.md).
+59
View File
@@ -0,0 +1,59 @@
---
name: Bug report
about: Create a report to help us improve
---
<!-- Please follow the template below -->
# Describe the bug
<!-- A clear and concise description of what the bug is. -->
# Steps To Reproduce
<!-- Steps to reproduce the behavior:
1. Make a player with a gun, magazine, and some ammo.
2. Try to aim at a wall.
3. There's no way to increase aim level. -->
# Expected behavior
<!-- A clear and concise description of what you expected to happen.
Ideally also describe *why* you expect it to happen. -->
# Screenshots
<!-- **If applicable**, add screenshots to help explain your problem.
Do not take a screenshot of the crashing window. Please provide the crash logs in the "Additional context" -->
# Versions and configuration
<!-- Please complete the following information; you can now go to:
- "Main menu (ESC) > Debug Menu > Info > Generate game report" to generate this report.
- Please update your OS version with a more precise version.
- OS: [e.g. iOS 8 or Windows 10 or Ubuntu 18.04]
- Game Version: [from the main menu, e.g. 0.C-29938-g90f5268437]
- Graphics version: [Tiles or Terminal]
- Ingame language: [Arabic or Bulgarian or Chinese (Simplified) or Chinese (Traditional) or Dutch or Esperanto or French or German or Italian (Italy) or Japanese or Korean or Polish or Portuguese (Brazil) or Russian or Serbian or Spanish (Argentina) or Spanish (Spain) or Turkish]
- Mods loaded: [e.g.dda, boats, hacktheplanet, StatsThroughSkills]
-->
# Additional context
<!-- Add any other context about the problem here.
Crash: if your problem refers to a crash, please add the following files to the "Additional Context" paragraph:
- From the /config folder (you can zip them both together):
- crash.log file.
- debug.log file.
- Your save file (zipped)
- note #1: you can drag and drop files in this issue post!
- note #2: it is very important for us that you provide a save file in case of a crash. It really helps the developers
to reproduce the bug and fix it. If possible, try to provide a save file that occurs in the right conditions, just
before the crash happens. -->
-100
View File
@@ -1,100 +0,0 @@
name: Bug Report 🐛
description: Create a report to help us improve
labels: ["(S1 - Need confirmation)"]
body:
- type: markdown
attributes:
value: |
Please take the time to fill out all the fields below.
- type: textarea
id: description-of-bug
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
placeholder: There is no way for aim level to increase.
validations:
required: true
- type: textarea
id: save-file
attributes:
label: Attach save file
description: |
`ESC`Main Menu -> `b`Debug Menu -> `i`Info -> `!`Generate minimized save archive
placeholder: |
Write N/A if not applicable.
- this bug report is unlikely to get resolved without a save file, unless it's trivially
reproducible or the reproduction steps are complete.
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. Make a player with a gun, magazine, and some ammo.
2. Try to aim at a wall.
3. There's no way to increase aim level.
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: |
A clear and concise description of what you expected to happen.
Ideally also describe *why* you expect it to happen.
placeholder: I expected that aim level would increase, because all other skills can increase in level.
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: |
**If applicable**, add screenshots to help explain your problem.
Do not take a screenshot of the crashing window. Please provide the crash logs in the "Additional context"
validations:
required: false
- type: textarea
id: versions-and-config
attributes:
label: Versions and configuration
description: |
`ESC`Main Menu -> `b`Debug Menu -> `i`Info -> `r`Generate game report
placeholder: |
- OS: [e.g. iOS 8 or Windows 10 or Ubuntu 18.04]
- Game Version: [e.g. 0.C-29938-g90f5268437]
- Graphics version: [Tiles or Terminal]
- Ingame language: [Arabic or Bulgarian or Chinese (Simplified) or Chinese (Traditional) or Dutch or Esperanto or French or German or Italian (Italy) or Japanese or Korean or Polish or Portuguese (Brazil) or Russian or Serbian or Spanish (Argentina) or Spanish (Spain) or Turkish]
- Mods loaded: [e.g. dda, boats, hacktheplanet, StatsThroughSkills]
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the problem here.
placeholder: |
Crash: if your problem refers to a crash, please add the following files to the "Additional Context" paragraph:
- From the /config folder (you can zip them both together):
- crash.log file.
- debug.log file.
- Your save file (zipped)
- note #1: you can drag and drop files in this issue post!
- note #2: it is very important for us that you provide a save file in case of a crash. It really helps the developers
to reproduce the bug and fix it. If possible, try to provide a save file that occurs in the right conditions, just
before the crash happens.
validations:
required: false
-3
View File
@@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Tileset Issues
url: https://github.com/I-am-Erk/CDDA-Tilesets/issues
about: For issues concerning the built-in tilesets.
- name: Github Discussion
url: https://github.com/CleverRaven/Cataclysm-DDA/discussions
about: For nonspecific feature requests, balance concerns, and questions about the game, prefer opening a discussion to an issue.
+17
View File
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
# Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
# Describe the solution you'd like
A clear and concise description of what you want to happen.
# Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
# Additional context
Add any other context (such as mock-ups, proof of concepts or screenshots) about the feature request here.
@@ -1,45 +0,0 @@
name: Feature Request ✨
description: Suggest an idea for this project
labels: ["<Suggestion / Discussion>"]
body:
- type: markdown
attributes:
value: |
Please take the time to fill out all the fields below.
- type: textarea
id: description-of-bug
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is that made you submit this report.
placeholder: I am always frustrated, when...
validations:
required: true
- type: textarea
id: description-of-solution
attributes:
label: Solution you would like.
description: A clear and concise description of what you want to happen.
placeholder: Instead of behaving like this, there should be...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you have considered.
description: A clear and concise description of any alternative solutions or features you have considered.
placeholder: Another workaround that would work, is...
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context (such as mock-ups, proof of concepts or screenshots) about the feature request here.
validations:
required: false
-40
View File
@@ -1,40 +0,0 @@
# https://github.com/rytswd/comvent
trigger: specific
# list of users allowed to use these commands, from labeling an issue in
# a specific way to mark as duplicate, closing issues, the sky is the limit
# TODO implement more commands, add more users
users:
active:
- casswedson
- Maleclypse
- Termineitor244
- Faalagorn
- Ilysen
- Aerin-of-the-Toast
- anoobindisguise
- PatrikLundell
- TheShadowFerret
- Jan-Blasiak
- MNG-cataclysm
- mqrause
- andrei8l
- haveric
- MylieDaniels
- nopenoperson
- Inglonias
- GuardianDll
- hexagonrecursion
- ANickelN
- a-chancey
- Cimanyd0
- LyranRenegade
- Stadler76
- sonphantrung
- sadenar
- RenechCDDA
- irwiss
keywords:
- name: confirm-bug
value: '\/(C|c)onfirm.*'
-273
View File
@@ -1,273 +0,0 @@
"[C++]":
- "**/*.cpp"
- "**/*.h"
"[JSON]":
- "**/*.json"
"[Markdown]":
- "**/*.md"
"Game: Achievements / Conducts / Scores":
- "**/scores**"
- "**/**statistics**"
- "**/statistics**"
- "**/**achievement**"
- "**/achievement**"
- "**/**conducts**"
- "**/conducts**"
"[Python]":
- "**/*.py"
"<Documentation>":
- "**/*.md"
- "doc/**"
- "doxygen_doc/**"
"Code: Tooling":
- ".github/**"
- "utilities/**"
- any: ['tools/**', '!tools/spell_checker/dictionary.txt']
"Code: Tests":
- "tests/**"
- "data/mods/TEST_DATA/**"
"Character / World Generation":
- "**/newcharacter**"
- "**/worldfactory**"
"Code: Build":
- "build-data/**"
- "build-scripts/**"
- "**/Makefile"
- "**/CMakeLists.txt"
- "**/*.cmake"
"Code: Infrastructure / Style / Static Analysis":
- .astylerc
- .clang-tidy
- .editorconfig
- .lgtm.yml
"Crafting / Construction / Recipes":
- "**/**crafting**"
- "**/crafting**"
- "**/**recipe**"
- "**/recipe**"
- "**/**construction**"
- "**/construction**"
"EOC: Effects On Condition":
- "**/**effect_on_condition**"
- "**/effect_on_condition**"
- "**/**eocs**"
- "**/eocs**"
- "**/condition**"
"Fields / Furniture / Terrain / Traps":
- "**/**furniture**"
- "**/furniture**"
- "**/**field**"
- "**/field**"
- "**/**terrain**"
- "**/terrain**"
- "**/**trap**"
- "**/trap**"
"Items: Food / Vitamins":
- "**/**food**"
- "**/food**"
- "**/**comestible**"
- "**/comestible**"
"NPC / Factions":
- "**/**npc**"
- "**/npc**"
- "**/**NPC**"
- "**/NPC**"
"Melee":
- "**/**melee**"
- "**/melee**"
- "**/**techniques**"
- "**/techniques**"
"Missions":
- "**/**mission**"
- "**/mission**"
"Info / User Interface":
- "src/**ui**"
- "**/ui/**"
- "**/**widget**"
- "**/widget**"
- "**/**view**"
- "**/view**"
"Items: Archery":
- "**/archery**"
- "**/crossbow**"
"Items: Armor / Clothing":
- "**/**armor**"
- "**/armor**"
- "**/armor/**"
"Items: Battery / UPS":
- "**/**battery**"
- "**/battery**"
"Items: Containers":
- "**/container**"
- "**/**pocket**"
- "**/pocket**"
- "**/**contents**"
- "**/contents**"
"Items: Magazines":
- "**/**magazine**"
- "**/magazine**"
"Appliance/Power Grid":
- "**/**appliance**"
- "**/appliance**"
"Monsters":
- "**/**monsters**"
- "**/monsters**"
"Mutations / Traits / Professions/ Hobbies":
- "**/**profession**"
- "**/profession**"
- "**/**mutations**"
- "**/mutation**"
- "**/hobbies**"
"Lore":
- data/json/npcs/BG_trait_groups.json
- data/json/npcs/Personality_trait_groups.json
- data/json/npcs/personality_traits.json
- "**/**Backgrounds**"
- "**/Backgrounds**"
- "**/**snippets**"
- "**/snippets**"
"Limbs":
- "**/**bodypart**"
- "**/bodypart**"
- "data/json/limb_scores.json"
"Spawn":
- "**/**itemgroup**"
- "**/itemgroup**"
- "**/itemgroups/**"
- "**/**monstergroup**"
- "**/monstergroup**"
- "**/monstergroups/**"
"Bionics":
- "**/bionic**"
- "**/**bionic**"
"Map / Mapgen":
- "**/**mapgen**"
- "**/mapgen**"
- "**/**overmap**"
- "**/overmap**"
"Martial Arts":
- "**/martialart**"
"Player Faction Base / Camp":
- "**/basecamp**"
- "**/faction_camp**"
"Items: Ammo / Guns":
- "**/**gun**"
- "**/gun**"
- "**/**ammo**"
- "**/ammo**"
"Items: Gunmod / Toolmod":
- "**/**gunmod**"
- "**/gunmod**"
- "**/**toolmod**"
- "**/toolmod**"
"SDL: Tiles / Sound":
- "gfx/**"
- "sound/**"
"Scenarios":
- "**/scenario**"
- "**/start_location**"
"Translation":
- "lang/**"
- "**/**translation**"
- "**/translation**"
"Mods: Aftershock":
- data/mods/Aftershock/**/*
- data/mods/aftershock_exoplanet/**/*
"Mods: Dark Days of the Dead":
- data/mods/classic_zombies/**/*
"Mods: Dark Skies":
- data/mods/Dark-Skies-Above/**/*
"Mods: Desert Region":
- data/mods/desert_region/**/*
"Mods: DinoMod":
- data/mods/DinoMod/**/*
"Mods: Generic Guns":
- data/mods/Generic_Guns/**/*
"Mods: MA":
- data/mods/MA/**/*
"Mods: MMA":
- data/mods/MMA/**/*
"Mods: Magiclysm":
- data/mods/Magiclysm/**/*
"Mods: Innawood 🌲":
- data/mods/innawood/**/*
"Mods: No Hope":
- data/mods/No_Hope/**/*
"Mods: TropiCataclysm 🌴":
- data/mods/TropiCataclysm/**/*
"Mods: Tamable Wildlife":
- data/mods/Tamable_Wildlife/**/*
"Mods: Xedra Evolved":
- data/mods/Xedra_Evolved/**/*
"Mods":
- any: [ 'data/mods/**' ]
all: [ '!data/mods/TEST_DATA/**' ]
"Mechanics: Enchantments / Spells":
- "**/**enchantment**"
- "**/enchantment**"
- "**/**spells**"
- "**/spells**"
- "**/Spells/**"
- any: ['**/**spell**', '!tools/**']
"Mechanics: Weather":
- "**/weather**"
"Vehicles":
- "**/**vehicle**"
- "**/vehicle**"
- "src/veh_**"
+3 -16
View File
@@ -1,18 +1,11 @@
<!-- HOW TO USE: Under each "#### Heading" below, enter information relevant to your pull request.
Leave the headings unless they don't apply to your PR.
Please read carefully and don't delete the comments delimited by "< !--" and "-- >"
Once a pull request is submitted, automatic stylistic and consistency checks will be performed on the PR's changes.
The results of these can be either seen under the "Files changed" section of a PR or in the check's details.
Leave the headings unless they don't apply to your PR, and remove the comment blocks (surrounded with <!–– and ––>) when you are done.
NOTE: Please grant permission for repository maintainers to edit your PR. It is EXTREMELY common for PRs to be held up due to trivial changes being requested and the author being unavailable to make them. -->
#### Summary
Category "Brief description"
<!-- This section should consist of exactly one line, edit the one above.
1. Replace the word "Category" with one of these words: Features, Content, Interface, Mods, Balance, Bugfixes, Performance, Infrastructure, Build, I18N.
2. Replace the text inside the quotes with a brief description of your changes.
Or if you don't want a changelog entry, replace the whole line with just the word "None" (with no quotes).
Category must be one of these: Features, Content, Interface, Mods, Balance, Bugfixes, Performance, Infrastructure, Build, I18N. Or replace the whole line with just the word None for no changelog entry.
For more on the meaning of each category, see:
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/CHANGELOG_GUIDELINES.md
If approved and merged, your summary will be added to the project changelog:
@@ -20,7 +13,7 @@ https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/changelog.txt -->
#### Purpose of change
<!-- With a few sentences, describe your reasons for making this change. If it relates to an existing issue, you can link it with a # followed by the GitHub issue number, like #1234. If your pull request *fully* resolves an issue, include the word "Fix" or "Fixes" before the issue number, like: Fixes #xxxx
<!-- With a few sentences, describe your reasons for making this change. If it relates to an existing issue, you can link it with a # followed by the GitHub issue number, like #1234. If your pull request *fully* resolves an issue, include the word "Fix" or "Fixes" before the issue number, like: Fixes #1234.
If there is no related issue, explain here what issue, feature, or other concern you are addressing. If this is a bugfix, include steps to reproduce the original bug, so your fix can be verified. -->
#### Describe the solution
@@ -38,9 +31,3 @@ If there is no related issue, explain here what issue, feature, or other concern
#### Additional context
<!-- Add any other context (such as mock-ups, proof of concepts or screenshots) about the feature or bugfix here. -->
<!--README: Cataclysm: Dark Days Ahead is released under the Creative Commons Attribution ShareAlike 3.0 license.
The code and content of the game is free to use, modify, and redistribute for any purpose whatsoever.
By contributing to the project you agree to the term of the license and that any contribution you make will also be covered by the same license.
See http://creativecommons.org/licenses/by-sa/3.0/ for details. -->
+77
View File
@@ -0,0 +1,77 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 30
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 30
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- <Bug>
- <Bugfix>
- "<Crash / Freeze>"
- "Organization: Bounty"
- "(P1 - Critical)"
- "(P2 - High)"
- "(P3 - Medium)"
- "(P4 - Low)"
- "(P5 - Long-term)"
- "(S2 - Confirmed)"
- "0.E Feature Freeze"
- "0.E Content Freeze"
- "0.F Feature Freeze"
- "0.F Content Freeze"
- "0.F String Freeze"
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: true
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: true
# Label to use when marking as stale
staleLabel: stale
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions. Please do not \'bump\' or comment on this issue
unless you are actively working on it. Stale issues, and stale issues that
are closed are still considered.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been automatically closed due to lack of activity. This does
not mean that we do not value the issue. Feel free to request that it be
re-opened if you are going to actively work on it
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 2
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.
# issues:
# exemptLabels:
# - confirmed
-42
View File
@@ -1,42 +0,0 @@
version: v1
labels:
- label: "<Enhancement / Feature>"
matcher:
body: "(\\s|^)#### Summary\\s*Features +\".+\"\\s*(\n|$)"
- label: "Info / User Interface"
matcher:
body: "(\\s|^)#### Summary\\s*Interface +\".+\"\\s*(\n|$)"
- label: "Mods"
matcher:
body: "(\\s|^)#### Summary\\s*Mods +\".+\"\\s*(\n|$)"
- label: "Game: Balance"
matcher:
body: "(\\s|^)#### Summary\\s*Balance +\".+\"\\s*(\n|$)"
- label: "<Bugfix>"
matcher:
body: "(\\s|^)#### Summary\\s*Bugfixes +\".+\"\\s*(\n|$)"
- label: "<Bugfix>"
matcher:
body: ".*((C|c)lose(s|d)?|(F|f)ix(es|ed)?|(R|r)esolve(s|d)?):? #([1-9][0-9]{3,6})(\\s*|$)"
- label: "Code: Performance"
matcher:
body: "(\\s|^)#### Summary\\s*Performance +\".+\"\\s*(\n|$)"
- label: "Code: Infrastructure / Style / Static Analysis"
matcher:
body: "(\\s|^)#### Summary\\s*Infrastructure +\".+\"\\s*(\n|$)"
- label: "Code: Build"
matcher:
body: "(\\s|^)#### Summary\\s*Build +\".+\"\\s*(\n|$)"
- label: "Translation"
matcher:
body: "(\\s|^)#### Summary\\s*I18N +\".+\"\\s*(\n|$)"
-13
View File
@@ -1,13 +0,0 @@
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 65a98efbe..2f99f28f1 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -352,7 +352,7 @@ endmacro()
# - HAVE_SDL_LOADSO opt
macro(CheckLibSampleRate)
if(SDL_LIBSAMPLERATE)
- find_package(SampleRate QUIET)
+ find_package(SampleRate CONFIG REQUIRED)
if(SampleRate_FOUND AND TARGET SampleRate::samplerate)
set(HAVE_LIBSAMPLERATE TRUE)
set(HAVE_LIBSAMPLERATE_H TRUE)
-130
View File
@@ -1,130 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO akrieger/SDL
REF release-2.26.4_qrox_math
SHA512 aa8c0552ac92bbf85dd3f9339088ebd41e0d09b1d46492462b47b632bab5d850c62b7938950accbfb51798b9f5664c1896fc75bdb8dd42b2c1cee84eebd59e13
HEAD_REF main
PATCHES
deps.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SDL_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SDL_SHARED)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" FORCE_STATIC_VCRT)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
vulkan SDL_VULKAN
x11 SDL_X11
wayland SDL_WAYLAND
samplerate SDL_LIBSAMPLERATE
ibus SDL_IBUS
)
if ("x11" IN_LIST FEATURES)
message(WARNING "You will need to install Xorg dependencies to use feature x11:\nsudo apt install libx11-dev libxft-dev libxext-dev\n")
endif()
if ("wayland" IN_LIST FEATURES)
message(WARNING "You will need to install Wayland dependencies to use feature wayland:\nsudo apt install libwayland-dev libxkbcommon-dev libegl1-mesa-dev\n")
endif()
if ("ibus" IN_LIST FEATURES)
message(WARNING "You will need to install ibus dependencies to use feature ibus:\nsudo apt install libibus-1.0-dev\n")
endif()
if(VCPKG_TARGET_IS_UWP)
set(configure_opts WINDOWS_USE_MSBUILD)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
${configure_opts}
OPTIONS ${FEATURE_OPTIONS}
-DSDL_STATIC=${SDL_STATIC}
-DSDL_SHARED=${SDL_SHARED}
-DSDL_FORCE_STATIC_VCRT=${FORCE_STATIC_VCRT}
-DSDL_LIBC=ON
-DSDL_TEST=OFF
-DSDL_INSTALL_CMAKEDIR="cmake"
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
-DSDL_LIBSAMPLERATE_SHARED=OFF
MAYBE_UNUSED_VARIABLES
SDL_FORCE_STATIC_VCRT
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH cmake)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/bin/sdl2-config"
"${CURRENT_PACKAGES_DIR}/debug/bin/sdl2-config"
"${CURRENT_PACKAGES_DIR}/SDL2.framework"
"${CURRENT_PACKAGES_DIR}/debug/SDL2.framework"
"${CURRENT_PACKAGES_DIR}/share/licenses"
"${CURRENT_PACKAGES_DIR}/share/aclocal"
)
file(GLOB BINS "${CURRENT_PACKAGES_DIR}/debug/bin/*" "${CURRENT_PACKAGES_DIR}/bin/*")
if(NOT BINS)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/bin"
"${CURRENT_PACKAGES_DIR}/debug/bin"
)
endif()
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_UWP AND NOT VCPKG_TARGET_IS_MINGW)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link")
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/SDL2main.lib" "${CURRENT_PACKAGES_DIR}/lib/manual-link/SDL2main.lib")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/SDL2maind.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/SDL2maind.lib")
endif()
file(GLOB SHARE_FILES "${CURRENT_PACKAGES_DIR}/share/sdl2/*.cmake")
foreach(SHARE_FILE ${SHARE_FILES})
vcpkg_replace_string("${SHARE_FILE}" "lib/SDL2main" "lib/manual-link/SDL2main")
endforeach()
endif()
vcpkg_copy_pdbs()
set(DYLIB_COMPATIBILITY_VERSION_REGEX "set\\(DYLIB_COMPATIBILITY_VERSION (.+)\\)")
set(DYLIB_CURRENT_VERSION_REGEX "set\\(DYLIB_CURRENT_VERSION (.+)\\)")
file(STRINGS "${SOURCE_PATH}/CMakeLists.txt" DYLIB_COMPATIBILITY_VERSION REGEX ${DYLIB_COMPATIBILITY_VERSION_REGEX})
file(STRINGS "${SOURCE_PATH}/CMakeLists.txt" DYLIB_CURRENT_VERSION REGEX ${DYLIB_CURRENT_VERSION_REGEX})
string(REGEX REPLACE ${DYLIB_COMPATIBILITY_VERSION_REGEX} "\\1" DYLIB_COMPATIBILITY_VERSION "${DYLIB_COMPATIBILITY_VERSION}")
string(REGEX REPLACE ${DYLIB_CURRENT_VERSION_REGEX} "\\1" DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION}")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2main" "-lSDL2maind")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2 " "-lSDL2d ")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2-static " "-lSDL2-staticd ")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/sdl2.pc" "-lSDL2-static " " ")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2-staticd " " ")
endif()
endif()
if(VCPKG_TARGET_IS_UWP)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/sdl2.pc" "$<$<CONFIG:Debug>:d>.lib" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/sdl2.pc" "-l-nodefaultlib:" "-nodefaultlib:")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "$<$<CONFIG:Debug>:d>.lib" "d")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-l-nodefaultlib:" "-nodefaultlib:")
endif()
endif()
vcpkg_fixup_pkgconfig()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
-8
View File
@@ -1,8 +0,0 @@
sdl2 provides CMake targets:
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(main
PRIVATE
$<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
)
-58
View File
@@ -1,58 +0,0 @@
{
"name": "sdl2",
"version": "2.26.4",
"description": "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.",
"homepage": "https://www.libsdl.org/download-2.0.php",
"license": "Zlib",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"base"
],
"features": {
"base": {
"description": "Base functionality for SDL",
"dependencies": [
{
"name": "sdl2",
"default-features": false,
"features": [
"ibus",
"wayland",
"x11"
],
"platform": "linux"
}
]
},
"ibus": {
"description": "Build with ibus IME support",
"supports": "linux"
},
"samplerate": {
"description": "Use libsamplerate for audio rate conversion",
"dependencies": [
"libsamplerate"
]
},
"vulkan": {
"description": "Vulkan functionality for SDL"
},
"wayland": {
"description": "Build with Wayland support",
"supports": "linux"
},
"x11": {
"description": "Build with X11 support",
"supports": "!windows"
}
}
}
@@ -1,5 +0,0 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
-5
View File
@@ -1,5 +0,0 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_BUILD_TYPE release)
@@ -1,5 +0,0 @@
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
-5
View File
@@ -1,5 +0,0 @@
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_BUILD_TYPE release)
+27 -7
View File
@@ -4,21 +4,41 @@ on:
push:
branches:
- master
workflow_dispatch:
paths:
- '**.cpp'
- '**.h'
- '**.c'
- '**/CMakeLists.txt'
- '**/Makefile'
- '**.hpp'
- '**.cmake'
- '.github/workflows/CBA.yml'
pull_request:
branches:
- master
paths:
- '**.cpp'
- '**.h'
- '**.c'
- '**/CMakeLists.txt'
- '**/Makefile'
- '**.hpp'
- '**.cmake'
- '.github/workflows/CBA.yml'
# Mixing in event_name so that a master push and a workflow dispatch can run at the same time.
concurrency: clang_build_analyzer-${{ github.event_name }}
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: install dependencies
run: sudo apt-get install libncursesw5-dev gettext
run: sudo apt-get install libncursesw5-dev
- name: Prepare Build Analyzer
run: |
cd
@@ -33,7 +53,7 @@ jobs:
- name: make
run: |
ClangBuildAnalyzer --start .
CLANG=clang++-14 CXXFLAGS=-ftime-trace make
CLANG=clang++-10 CXXFLAGS=-ftime-trace make
ClangBuildAnalyzer --stop . buildAnalysis
- name: Analyze
run: ClangBuildAnalyzer --analyze buildAnalysis
@@ -1,16 +0,0 @@
name: Detect missions that are missing .start.assign_mission_target.om_special
on:
pull_request:
paths:
- '**.json'
permissions:
contents: read
jobs:
run-the-tool:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ./tools/json_tools/assign_mission_target_needs_om_special.bash 2>&1
+12 -26
View File
@@ -1,34 +1,22 @@
name: astyle
on: pull_request
on:
pull_request:
paths:
- '**.cpp'
- '**.h'
- '**.c'
jobs:
skip-duplicates:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
paths: '[".github/workflows/astyle.yml", "Makefile", ".astylerc", "**.cpp", "**.h", "**.c"]'
- run: echo ${{ github.event.number }} > pull_request_id
- uses: actions/upload-artifact@v2
with:
name: pull_request_id
path: pull_request_id
astyle-code:
name: astyle check
needs: skip-duplicates
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: install dependencies
run: sudo apt-get install astyle
@@ -36,10 +24,8 @@ jobs:
- name: astyle check
run: make astyle-check
- name: Format
if: failure()
run: make astyle-fast
- name: Display Corrections
if: failure()
run: git diff --color
run: |
make astyle
git diff
-24
View File
@@ -1,24 +0,0 @@
name: Check pull request head branch name
on:
pull_request_target:
types:
- opened
jobs:
check_branch_name:
runs-on: ubuntu-latest
if: github.head_ref == 'master' && github.repository == 'CleverRaven/Cataclysm-DDA'
steps:
- name: Post warning
uses: actions/github-script@v6.3.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "You are creating a pull request with the master branch as the head branch. This is likely a mistake unless you really know what you are doing. You may read https://docs.github.com/en/get-started/quickstart/contributing-to-projects#creating-a-branch-to-work-on for a typical workflow of contributing to a project on GitHub."
});
-3
View File
@@ -6,9 +6,6 @@ on:
- 'lang/po/*.po'
- 'tools/check_po_printf_format.py'
permissions:
contents: read
jobs:
check-po-printf:
runs-on: ubuntu-20.04
+25 -49
View File
@@ -1,77 +1,53 @@
name: Clang-tidy (clang-12, tiles)
name: Clang-tidy (clang-8, tiles)
on:
push:
branches:
- master
paths:
- '**.cpp'
- '**.h'
- '**.c'
- '**/CMakeLists.txt'
- '**/Makefile'
- '**.hpp'
- '**.cmake'
pull_request:
branches:
- master
# We only care about the latest revision of a PR, so cancel all previous instances.
concurrency:
group: clang-tidy-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
paths:
- '**.cpp'
- '**.h'
- '**.c'
- '**/CMakeLists.txt'
- '**/Makefile'
- '**.hpp'
- '**.cmake'
jobs:
skip-duplicates:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
paths: '[ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**/Makefile", "**.hpp", "**.cmake", ".github/workflows/clang-tidy.yml" ]'
build:
needs: skip-duplicates
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' }}
runs-on: ubuntu-20.04
runs-on: ubuntu-16.04
env:
CMAKE: 1
CLANG: clang++-12
COMPILER: clang++-12
CLANG: clang++-8
COMPILER: clang++-8
CATA_CLANG_TIDY: plugin
TILES: 1
SOUND: 1
steps:
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: install dependencies
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main"
#sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main"
sudo apt-get update
sudo apt-get install libncursesw5-dev clang-12 libclang-12-dev llvm-12-dev llvm-12-tools \
sudo apt-get install libncursesw5-dev clang-8 libclang-8-dev llvm-8-dev llvm-8-tools \
libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev ccache \
gettext jq
gettext
- name: prepare
run: bash ./build-scripts/requirements.sh
- name: determine changed files
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v5
with:
script: |
var fs = require('fs');
const response = await github.paginate(github.rest.pulls.listFiles,
{
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
}
);
const files = response.map(x => x.filename);
for (const path of files) {
console.log(path);
}
fs.writeFileSync("files_changed", files.join('\n'));
- uses: ammaraskar/gcc-problem-matcher@master
- name: run clang-tidy
run: bash ./build-scripts/clang-tidy.sh
run: bash ./build-scripts/build.sh
+1 -4
View File
@@ -16,15 +16,12 @@ on:
- '**.cmake'
- '**.cmake.in'
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: install cmakelang
-31
View File
@@ -1,31 +0,0 @@
name: "Comment Commands"
on:
issue_comment:
types:
- created
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
jobs:
confirm-bug:
if: ${{ !github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set-up Comvent
uses: rytswd/comvent@v0.3
id: comvent
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-path: .github/comment-commands.yml
- if: steps.comvent.outputs.confirm-bug != ''
name: Handle confirmation command - Label
run: |
gh issue edit "$ISSUE_NUMBER" --remove-label "(S1 - Need Confirmation)"
gh issue edit "$ISSUE_NUMBER" --add-label "(S2 - Confirmed)"
@@ -1,59 +0,0 @@
name: Detect translation file changes
on:
pull_request_target:
paths:
- lang/po/*.po
- lang/po/*.pot
jobs:
detect-translation-file-changes:
runs-on: ubuntu-latest
steps:
- name: "Detect translation file changes"
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const skip_phrase = 'Translation file changes are intended';
if (context.payload.pull_request.body.includes(skip_phrase)) {
console.log('PR body contains skip phrase. Exiting.');
return;
}
core.setFailed('Translation file changes detected, but a skip phrase is not found in the PR body.')
console.log(
'Fetching comments of pull request %d of repository %s/%s.',
context.issue.number, context.repo.owner, context.repo.repo
);
const comments = await github.paginate(
github.rest.issues.listComments,
{
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
}
);
const body = 'It appears you modified a `.po` or `.pot` file. '
+ 'These translation files are automatically generated, '
+ 'pushed to, and pulled from Transifex, and should not be '
+ 'modified otherwise. If these changes are intended, please '
+ 'add `' + skip_phrase + '` to the '
+ 'PR body.';
const bot_comments = comments.filter(
comment => comment.user.type === 'Bot'
&& comment.user.login === 'github-actions[bot]'
&& comment.body === body
);
if (bot_comments.length > 0) {
console.log('Comment already exists. Exiting.');
return;
}
console.log('Posting comment.');
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
+1 -4
View File
@@ -12,16 +12,13 @@ on:
paths:
- '**.py'
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: install dependencies
+9 -23
View File
@@ -1,36 +1,22 @@
name: JSON Validation
on: pull_request
on:
pull_request:
paths:
- '**.json'
jobs:
skip-duplicates:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
paths: '["**.json", ".github/workflows/json.yml"]'
- run: echo ${{ github.event.number }} > pull_request_id
- uses: actions/upload-artifact@v2
with:
name: pull_request_id
path: pull_request_id
style-json:
name: JSON style check
runs-on: ubuntu-latest
needs: skip-duplicates
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: JSON style check
run: make style-all-json-parallel RELEASE=1
run: make style-json
- name: Display Corrections
if: failure()
run: git diff --color
run: git diff
-19
View File
@@ -1,19 +0,0 @@
name: "Pull Request Labeler"
on:
- pull_request_target
permissions:
contents: read
jobs:
triage:
permissions:
contents: read # for actions/labeler to determine modified files
pull-requests: write # for actions/labeler to add labels to PRs
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# I don't want no bot removing stuff for me
sync-labels: ""
-41
View File
@@ -1,41 +0,0 @@
name: Code Style Reviewer
on:
pull_request_target:
paths:
- '**.json'
- '**.cpp'
- '**.h'
- '**.c'
pull_request:
paths:
- '**.json'
- '**.cpp'
- '**.h'
- '**.c'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.run_id }}
cancel-in-progress: true
jobs:
style-code:
if: ${{ github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: '${{ github.event.pull_request.head.sha }}'
- run: sudo apt-get install astyle
- run: make astyle-fast
- run: make style-all-json-parallel
- name: 'suggester / JSON & C++'
uses: reviewdog/action-suggester@v1
if: ${{ always() }}
with:
tool_name: 'JSON & C++ formatters'
+80 -284
View File
@@ -4,340 +4,136 @@ on:
push:
branches:
- master
paths-ignore:
- 'android/**'
- 'build-data/osx/**'
- 'doc/**'
- 'doxygen_doc/**'
- 'lgtm/**'
- 'msvc-full-features/**'
- 'msvc-object_creator/**'
- 'object_creator/**'
- 'tools/**'
- 'utilities/**'
pull_request:
branches:
- master
paths-ignore:
- 'android/**'
- 'build-data/osx/**'
- 'doc/**'
- 'doxygen_doc/**'
- 'lgtm/**'
- 'msvc-full-features/**'
- 'msvc-object_creator/**'
- 'object_creator/**'
- 'tools/**'
- 'utilities/**'
# We only care about the latest revision of a PR, so cancel all previous instances.
# Allow running master builds to complete to help with ccache refreshes.
concurrency:
group: general-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# Overall strategy for what sorts of builds to include:
# We want a build for the newest and oldest supported version of each compiler.
# We want a build for each platform.
# We also want to ensure that each of the following tweaks are covered in at
# least one PR build:
# - TILES=1
# - SOUND=1
# - RELEASE=1
# - CMAKE=1
# - LOCALIZE=0
# - LTO=1
# - LIBBACKTRACE=1 (on Linux and Windows)
# - Tests with important mods enabled (Magiclysm)
# - A clang-tidy run
# - SANITIZE=address,undefined
# We try to minimize the number of builds subject to those constraints.
#
# To see what toolchains are available, the following may be useful:
# https://launchpad.net/%7Eubuntu-toolchain-r/+archive/ubuntu/test/+index
# https://apt.llvm.org/
jobs:
skip-duplicates-code:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip_code: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["android/**", "build-data/osx/**", "doc/**", "doxygen_doc/**", "lgtm/**", "msvc-**", "object_creator/**", "tools/**", "utilities/**", "data/**", "lang/**"]'
skip-duplicates-data:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip_data: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["android/**", "build-data/osx/**", "doc/**", "doxygen_doc/**", "lgtm/**", "msvc-**", "object_creator/**", "tools/**", "utilities/**"]'
matrix-variables:
permissions:
contents: none
continue-on-error: true
runs-on: ubuntu-latest
outputs:
fail_fast: ${{ steps.matrix_vars.outputs.fail_fast }}
skip_tests: ${{ steps.matrix_vars.outputs.skip_tests }}
max_parallel: ${{ steps.matrix_vars.outputs.max_parallel }}
steps:
- id: matrix_vars
run: |
echo "fail_fast=$([ "$GITHUB_REF_NAME" = "master" ] && echo false || echo true)" >> $GITHUB_OUTPUT
echo "skip_tests=$([ "$GITHUB_REF_NAME" = "master" ] && echo true || echo false)" >> $GITHUB_OUTPUT
echo "max_parallel=$([ "$GITHUB_REF_NAME" = "master" ] && echo 20 || echo 1)" >> $GITHUB_OUTPUT
varied_builds:
needs: [ skip-duplicates-code, skip-duplicates-data, matrix-variables ]
strategy:
fail-fast: ${{ fromJSON(needs.matrix-variables.outputs.fail_fast) }}
max-parallel: ${{ fromJSON(needs.matrix-variables.outputs.max_parallel) }}
matrix:
include:
- compiler: clang++-10
os: ubuntu-20.04
tiles: 0
sound: 0
release: 1
- compiler: g++-9
os: ubuntu-latest
cmake: 0
localize: 1
tiles: 0
test-stage: 1
native: linux64
archive-success: basic-build
dont_skip_data_only_changes: 1
title: Basic Build and Test (Clang 10, Ubuntu, Curses)
# ~190MB in a clean build
# ~30MB compressed
# observed usage: 3.0GB -> 300MB
ccache_limit: 2G
ccache_key: linux-llvm-10
- compiler: g++-9
os: ubuntu-latest
release: 1
cmake: 0
tiles: 0
sound: 0
localize: 1
gold: 1
lto: 1
libbacktrace: 1
native: linux64
title: GCC 9, Curses, LTO
# ~850MB in a clean build
# ~370MB compressed
# observed usage: 4.0GB -> 1.5GB
ccache_limit: 3G
ccache_key: linux-gcc-9-lto
- compiler: clang++-12
os: ubuntu-22.04
release: 0
cmake: 0
tiles: 1
sound: 0
localize: 1
native: linux64
sanitize: address
cxxflags: --gcc-toolchain=/opt/mock-gcc-11
mods: --mods=magiclysm
dont_skip_data_only_changes: 1
title: Clang 12, Ubuntu, Tiles, ASan
# ~390MB in a clean build
# ~50MB compressed
# observed usage: 4.0GB -> 400MB
ccache_limit: 3G
ccache_key: linux-llvm-12-asan
- compiler: g++-11
title: GCC 9, Ubuntu, Curses, LTO
- compiler: g++-7
os: ubuntu-latest
release: 0
cmake: 0
tiles: 0
sound: 0
localize: 1
native: linux64
sanitize: address
title: GCC 11, Ubuntu, Curses, ASan
# ~480MB in a clean build
# ~50MB compressed
# observed usage: 4.4GB -> 400MB
ccache_limit: 4G
ccache_key: linux-gcc-11-asan
- compiler: clang++
os: macos-12
release: 0
cmake: 0
native: osx
sanitize: undefined
tiles: 1
sound: 1
localize: 1
title: Clang 14, macOS 12, Tiles, Sound, UBSan
# ~880MB ccache-compressed in a clean build
# ~100 compressed
# observed usage: 3.85GB -> 500MB
ccache_limit: 4G
ccache_key: macos-llvm-14
- compiler: g++
os: ubuntu-latest
release: 0
cmake: 0
native:
tiles: 1
sound: 1
localize: 1
libbacktrace: 1
title: GCC 12, Ubuntu cross-compile to MinGW-Win64, Tiles, Sound
ldflags: -static-libgcc -static-libstdc++
mxe_target: x86_64-w64-mingw32.static.gcc12
wine: wine
# ~285MB in a clean build
# ~36MB compressed
# observed usage: 3.0GB -> 350MB
ccache_limit: 2G
ccache_key: mingw-gcc-12
- compiler: g++-9
os: ubuntu-latest
release: 1
cmake: 1
tiles: 1
sound: 1
localize: 0
native: linux64
title: GCC 9, Ubuntu, Tiles, Sound, CMake
# ~180MB in a clean build
# ~25MB compressed
# observed usage: 3.0GB -> 300MB
ccache_limit: 2G
ccache_key: linux-gcc-9-cmake
# Reserving space for msvc ccache & vcpkg cache
# observed usage:
# vcpkg: ??? -> 500MB
# ccache: 8GB -> 1.0GB
title: GCC 7, Ubuntu, Tiles, CMake
- compiler: g++-8
os: ubuntu-latest
cmake: 0
tiles: 1
sanitize: address
native: linux64
title: GCC 8, Ubuntu, Tiles, ASan
- compiler: clang++-12
os: ubuntu-latest
cmake: 0
tiles: 1
sanitize: address,undefined
native: linux64
title: Clang 12, Ubuntu, Tiles, ASan, UBSan
- compiler: clang++
os: macos-10.15
cmake: 0
tiles: 1
native: osx
title: Clang 12, macOS 10.15, Tiles
name: ${{ matrix.title }}
runs-on: ${{ matrix.os }}
env:
ZSTD_CLEVEL: 17
CMAKE: ${{ matrix.cmake }}
COMPILER: ${{ matrix.compiler }}
MXE_TARGET: ${{ matrix.mxe_target }}
WINE: ${{ matrix.wine }}
OS: ${{ matrix.os }}
TILES: ${{ matrix.tiles }}
SOUND: ${{ matrix.sound }}
LOCALIZE: ${{ matrix.localize }}
MODS: ${{ matrix.mods }}
SOUND: ${{ matrix.tiles }}
SANITIZE: ${{ matrix.sanitize }}
TEST_STAGE: ${{ matrix.test-stage }}
CXXFLAGS: ${{ matrix.cxxflags }}
LDFLAGS: ${{ matrix.ldflags }}
EXTRA_TEST_OPTS: --error-format=github-action
NUM_TEST_JOBS: ${{ matrix.num_test_jobs }}
NATIVE: ${{ matrix.native }}
GOLD: ${{ matrix.gold }}
LTO: ${{ matrix.lto }}
LIBBACKTRACE: ${{ matrix.libbacktrace }}
RELEASE: ${{ matrix.release }}
ARCHIVE_SUCCESS: ${{ matrix.archive-success }}
CCACHE_LIMIT: ${{ matrix.ccache_limit }}
CCACHE_FILECLONE: true
CCACHE_HARDLINK: true
CCACHE_NOCOMPRESS: true
SKIP: ${{ ( github.event.pull_request.draft == true && matrix.title != 'Basic Build and Test (Clang 10, Ubuntu, Curses)' ) || ( matrix.dont_skip_data_only_changes == 0 && needs.skip-duplicates.outputs.should_skip_code == 'true' ) || ( matrix.dont_skip_data_only_changes != 0 && needs.skip-duplicates-mods.outputs.should_skip_data == 'true' ) }}
SKIP_TESTS: ${{ needs.matrix-variables.outputs.skip_tests }}
RELEASE: 1
steps:
- name: checkout repository
if: ${{ env.SKIP == 'false' }}
uses: actions/checkout@v2
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: install dependencies (ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' }}
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libncursesw5-dev ccache gettext parallel
- name: install SDL2 dependencies (ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && matrix.tiles == 1 }}
sudo apt-get install libncursesw5-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev \
libsdl2-mixer-dev libpulse-dev ccache gettext parallel
- name: install old GCC (ubuntu)
if: runner.os == 'Linux' && (matrix.compiler == 'g++-7' || matrix.compiler == 'g++-8')
run: |
sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev
- name: install recent ccache on ubuntu 20.04
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && matrix.os == 'ubuntu-20.04' }}
sudo apt-get install g++-7 g++-8
- name: install dependencies (mac)
if: runner.os == 'macOS'
run: |
sudo apt-get remove --purge -y ccache
curl -sL https://github.com/ccache/ccache/releases/download/v4.8/ccache-4.8-linux-x86_64.tar.xz | sudo tar Jxvf - --strip-components 1 -C /usr/bin ccache-4.8-linux-x86_64/ccache
ccache --version
- name: set up a mock GCC toolchain root for Clang (Ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && (matrix.compiler == 'clang++-12') }}
run: |
sudo mkdir /opt/mock-gcc-11
sudo ln -s /usr/include /opt/mock-gcc-11/include
sudo ln -s /usr/bin /opt/mock-gcc-11/bin
sudo mkdir -p /opt/mock-gcc-11/lib/gcc/x86_64-linux-gnu
sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/11 /opt/mock-gcc-11/lib/gcc/x86_64-linux-gnu/11
- name: install runtime dependencies (mac)
if: ${{ env.SKIP == 'false' && runner.os == 'macOS' }}
uses: BrettDong/setup-sdl2-frameworks@v1
with:
sdl2: latest
sdl2-ttf: latest
sdl2-image: latest
sdl2-mixer: latest
- name: install build dependencies (mac)
if: ${{ env.SKIP == 'false' && runner.os == 'macOS' }}
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install gettext ccache parallel
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel
- name: prepare
if: ${{ env.SKIP == 'false' }}
run: bash ./build-scripts/requirements.sh
- name: Get ccache vars
id: get-vars
if: ${{ env.SKIP == 'false' }}
- name: Get Date
id: get-date
run: |
echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT
echo "ccache-path=$([ "$RUNNER_OS" = "macOS" ] && echo '/Users/runner/Library/Caches/ccache' || echo '~/.cache/ccache')" >> $GITHUB_OUTPUT
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d%H%M")"
shell: bash
- name: ccache cache files
if: ${{ env.SKIP == 'false' && ( runner.os == 'Linux' || runner.os == 'macOS' ) }}
- name: ccache cache files (ubuntu)
if: runner.os == 'Linux'
uses: actions/cache@v2
with:
path: ${{ steps.get-vars.outputs.ccache-path }}
# double-dash after compiler is not a typo, it is to disambiguate between g++-<date> and g++-11-<date> for restore key prefix matching
key: ccache-${{ github.ref_name }}-${{ matrix.ccache_key }}--${{ steps.get-vars.outputs.datetime }}
path: ~/.ccache
key: ccache-linux-${{ matrix.compiler }}-${{ steps.get-date.outputs.date }}
restore-keys: |
ccache-master-${{ matrix.ccache_key }}--
ccache-linux-${{ matrix.compiler }}-
- name: ccache cache files (mac)
if: runner.os == 'macOS'
uses: actions/cache@v2
with:
path: /Users/runner/Library/Caches/ccache
key: ccache-mac-${{ matrix.compiler }}-${{ steps.get-date.outputs.date }}
restore-keys: |
ccache-mac-${{ matrix.compiler }}-
- uses: ammaraskar/gcc-problem-matcher@master
- name: build
if: ${{ env.SKIP == 'false' }}
run: bash ./build-scripts/gha_compile_only.sh
- name: post-build ccache manipulation
if: ${{ env.SKIP == 'false' && !failure() && (runner.os == 'Linux' || runner.os == 'macOS') }}
run: |
ccache --show-stats --verbose
ccache -M ${{ env.CCACHE_LIMIT }}
ccache -c
ccache --show-stats --verbose
- name: clear ccache on PRs
if: ${{ github.ref_name != 'master' && env.SKIP == 'false' && !failure() && (runner.os == 'Linux' || runner.os == 'macOS') }}
run: |
ccache -C
# TODO: post ccache here, however actions/cache@v2 does not support manual upload step
- name: run tests
if: ${{ env.SKIP == 'false' && env.SKIP_TESTS == 'false' }}
run: bash ./build-scripts/gha_test_only.sh
- run: |
echo ${{ github.event.number }} > pull_request_id
echo "true" > ${{ env.ARCHIVE_SUCCESS }}
if: ${{ env.ARCHIVE_SUCCESS && success() }}
- run: |
echo ${{ github.event.number }} > pull_request_id
echo "false" > ${{ env.ARCHIVE_SUCCESS }}
if: ${{ env.ARCHIVE_SUCCESS && failure() }}
- uses: actions/upload-artifact@v2
if: ${{ always() && env.ARCHIVE_SUCCESS }}
with:
name: pull_request_id
path: pull_request_id
- uses: actions/upload-artifact@v2
if: ${{ always() && env.ARCHIVE_SUCCESS }}
with:
name: ${{ env.ARCHIVE_SUCCESS }}
path: ${{ env.ARCHIVE_SUCCESS }}
- name: build and test
run: bash ./build-scripts/build.sh
- name: upload artifacts if failed
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v1
if: failure()
with:
name: cata_test
path: tests/cata_test*
if-no-files-found: ignore
path: tests/cata_test
-211
View File
@@ -1,211 +0,0 @@
name: Cataclysm Windows build
on:
push:
branches:
- master
paths-ignore:
- 'android/**'
- 'build-data/osx/**'
- 'doc/**'
- 'doxygen_doc/**'
- 'gfx/**'
- 'lang/**'
- 'lgtm/**'
- 'tools/**'
- '!tools/format/**'
- 'utilities/**'
pull_request:
branches:
- master
paths-ignore:
- 'android/**'
- 'build-data/osx/**'
- 'doc/**'
- 'doxygen_doc/**'
- 'gfx/**'
- 'lang/**'
- 'lgtm/**'
- 'tools/**'
- '!tools/format/**'
- 'utilities/**'
# We only care about the latest revision of a PR, so cancel previous instances.
concurrency:
group: msvc-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
env:
# Enable pretty backtraces
BACKTRACE: 1
# Compressed size ~1GB based on observations
CCACHE_LIMIT: 8GB
CDDA_CCACHE_PATH: ${{ github.workspace }}\ccache\
CDDA_USE_CCACHE: true
# There's not enough disk space to build both release and debug versions of
# our dependencies, so we hack the triplet file to build only release versions
# Have to use github.workspace because runner namespace isn't available yet.
VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}\.github\vcpkg_triplets
# Also conveniently disable ccache internal compression
CCACHE_HARDLINK: true
# vcpkg with object_creator deps totals ~500MB at this compression level
ZSTD_CLEVEL: 17
jobs:
build_catatclysm:
name: Build
runs-on: windows-2019
steps:
- name: checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Use GNU tar to enable zstd for actions/cache
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
shell: cmd
- name: Restore artifacts, or run vcpkg, build and cache artifacts
uses: lukka/run-vcpkg@v10
id: runvcpkg
with:
# run-vcpkg tries to hash vcpkg.json but complans if it finds more than one.
# That said, we also have our custom vcpkg_triplets to hash, so we keep everything the same.
appendedCacheKey: ${{ hashFiles( 'msvc-full-features/vcpkg.json', 'msvc-object_creator/vcpkg.json', '.github/vcpkg_triplets/**', '.github/vckg_ports/**' ) }}
# Rev this value to drop cache without changing vcpkg commit
prependedCacheKey: v1-x64-full
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
# We have to use at least this version of vcpkg to include fixes for yasm-tool's
# availability only as an x86 host tool. Keep it in sync with the builtin-baseline
# field in vcpkg.json. Caching happens as a post-action which runs at the end of
# the whole workflow, after vcpkg install happens during msbuild run.
vcpkgGitCommitId: 'd08e708c2111893da3cc7e49b597ee4654c8076e'
- name: Integrate vcpkg
run: |
vcpkg integrate install --vcpkg-root '${{ runner.workspace }}\b\vcpkg'
- name: Download ccache
uses: robinraju/release-downloader@v1.4
with:
repository: 'ccache/ccache'
tag: 'v4.6.1'
fileName: 'ccache-4.6.1-windows-x86_64.zip'
- name: Install ccache
id: install-ccache
run: |
unzip ccache-4.6.1-windows-x86_64.zip
cp ccache-4.6.1-windows-x86_64/ccache.exe ccache-4.6.1-windows-x86_64/cl.exe
cp ccache-4.6.1-windows-x86_64/ccache.exe ccache-4.6.1-windows-x86_64/clang-cl.exe
mv ccache-4.6.1-windows-x86_64 ${{ env.CDDA_CCACHE_PATH }}
- name: Get ccache vars
id: get-vars
run: |
echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT
echo "ccache-path=$(echo "$APPDATA\\ccache")" >> $GITHUB_OUTPUT
shell: bash
- name: ccache cache files
uses: actions/cache@v3
with:
path: ${{ steps.get-vars.outputs.ccache-path }}
# double-dash after compiler is not a typo, it is to disambiguate between g++-<date> and g++-11-<date> for restore key prefix matching
key: ccache-${{ github.ref_name }}-${{ runner.os }}-msvc--${{ steps.get-vars.outputs.datetime }}
restore-keys: |
ccache-master-${{ runner.os }}-msvc--
- name: Configure ccache
run: |
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -M 10G
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -s -v
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -z
- name: Symlink intermediates to C
run: |
mkdir -p "$env:TEMP\objwin"
New-Item -ItemType SymbolicLink -Target "$env:TEMP\objwin" objwin
- name: Build
run: |
msbuild -m -p:Configuration=Release -p:Platform=x64 "-target:Cataclysm-vcpkg-static;Cataclysm-test-vcpkg-static;JsonFormatter-vcpkg-static" msvc-full-features/Cataclysm-vcpkg-static.sln
msbuild -m -p:Configuration=Release -p:Platform=x64 "-target:ObjectCreator-vcpkg-static" msvc-object_creator/ObjectCreator-vcpkg-static.sln
- name: Post-build ccache manipulation
if: ${{ !failure() }}
run: |
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -s -v
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -M ${{ env.CCACHE_LIMIT }}
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -c
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -s -v
- name: clear ccache on PRs
if: ${{ github.ref_name != 'master' }}
run: |
${{ env.CDDA_CCACHE_PATH }}\ccache.exe -C
- name: Dump vcpkg logs if build failed
if: failure()
run: |
echo =================================================
Get-ChildItem "${{ runner.workspace }}/Cataclysm-DDA/msvc-full-features/vcpkg_installed" -Recurse
echo =================================================
Get-ChildItem "${{ runner.workspace }}/Cataclysm-DDA/msvc-object_creator/vcpkg_installed" -Recurse
echo =================================================
Get-ChildItem "${{ runner.workspace }}/b/vcpkg/buildtrees" |
Foreach-Object {
Get-ChildItem $_.FullName -Filter *.log |
Foreach-Object {
echo =================================================
echo $_.FullName
echo =================================================
type $_.FullName
}
}
- name: Compile .mo files for localization
if: ${{ github.ref_name != 'master' }}
run: |
& "C:\msys64\mingw64\bin\mingw32-make" -C lang -j2
mkdir -p ./data/mods/TEST_DATA/lang/mo/ru/LC_MESSAGES -ErrorAction SilentlyContinue
msgfmt -f -o ./data/mods/TEST_DATA/lang/mo/ru/LC_MESSAGES/TEST_DATA.mo ./data/mods/TEST_DATA/lang/po/ru.po
- name: Enable GitHub Actions problem matchers
if: ${{ github.ref_name != 'master' }}
run: |
Write-Output "::add-matcher::build-scripts/problem-matchers/catch2.json"
Write-Output "::add-matcher::build-scripts/problem-matchers/debugmsg.json"
- name: Run tests
if: ${{ github.ref_name != 'master' }}
run: |
.\Cataclysm-test-vcpkg-static-Release-x64.exe --min-duration 0.2 --rng-seed time
- name: Dump disk usage logs if job failed
if: failure()
run: |
echo =================================================
df
echo =================================================
du -sh *
echo =================================================
du -sh msvc-full-features/*
echo =================================================
du -sh msvc-object_creator/*
echo =================================================
du -sh tools/*
echo =================================================
shell: bash
- name: Don't upload vcpkg cache on failure or PRs
if: ${{ failure() || cancelled() || github.ref_name != 'master' }}
run: |
echo "RUNVCPKG_NO_CACHE=1" >> $GITHUB_ENV
shell: bash
@@ -1,78 +0,0 @@
name: Post Spell Check Result
on:
workflow_run:
workflows: ["Text Changes Analyzer"]
types:
- completed
jobs:
post-spell-check-result:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download pr id artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.name }}
run_id: ${{ github.event.workflow_run.id }}
name: pull_request_id
- name: Download spell check retcode artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.name }}
run_id: ${{ github.event.workflow_run.id }}
name: spell_check_retcode
- name: set-spell-check-retcode
id: set-spell-check-retcode
run: echo "spell-check-retcode=$( cat spell_check_retcode )" >> $GITHUB_OUTPUT
- name: Download spell check output artifact
if: steps.set-spell-check-retcode.outputs.spell-check-retcode >= 1
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.name }}
run_id: ${{ github.event.workflow_run.id }}
name: spell_check_output
- name: 'Comment on PR'
if: steps.set-spell-check-retcode.outputs.spell-check-retcode >= 1
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./pull_request_id'));
var body = fs.readFileSync('./spell_check_output', 'utf8');
console.log("Fetching comments of pull request %d of repository %s/%s.", issue_number, context.repo.owner, context.repo.repo);
const comments = await github.paginate(github.rest.issues.listComments,
{
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number
}
);
const prev_spell_checks = comments.slice(0).reverse()
.filter(comment => comment.user.type === 'Bot' && comment.user.login === 'github-actions[bot]')
.filter(comment => comment.body.startsWith("Spell checker"));
if (prev_spell_checks.some(comment => comment.body === body)) {
console.log("The exact same spell checker comment already exists. Exiting.");
return;
}
for (const comment of prev_spell_checks) {
console.log("Deleting previous spell checker comment (comment id: %i)", comment.id);
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
});
}
console.log("Posting comment.");
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: body
});
+1 -1
View File
@@ -12,5 +12,5 @@ jobs:
- name: "Validate SUMMARY"
uses: CleverRaven/pr-validator@master
with:
description-regex: '(\n|^)#### Summary\s+`{0,3}(SUMMARY:\s+)?(None|((Features|Content|Interface|Mods|Balance|Bugfixes|Performance|Infrastructure|Build|I18N) +".+"))`{0,3}\s*(\n|$)'
description-regex: '(\n|^)#### Summary\s+`{0,3}(SUMMARY:\s+)?(None|((Features|Content|Interface|Mods|Balance|Bugfixes|Performance|Infrastructure|Build|I18N) +".*"))`{0,3}\s*(\n|$)'
description-regex-flags: 'i'
-49
View File
@@ -1,49 +0,0 @@
name: "Pull translations from Transifex"
on:
schedule:
- cron: "42 1 * * 6"
jobs:
pull-translations:
if: github.repository == 'CleverRaven/Cataclysm-DDA'
runs-on: ubuntu-22.04
steps:
- name: "Install Transifex CLI"
run: |
curl -sL https://github.com/transifex/cli/releases/download/v1.6.4/tx-linux-amd64.tar.gz | sudo tar zxvf - -C /usr/bin tx
- name: "Delete existing i18n branch"
uses: actions/github-script@v6
with:
github-token: ${{ secrets.TX_PR_CREATOR }}
script: |
try {
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "i18n"
})
} catch (error) {
console.log(error)
}
- name: "Checkout"
uses: actions/checkout@v3
- name: "Get current date"
uses: josStorer/get-current-time@v2.0.2
id: current-date
with:
format: 'DD MMMM YYYY'
- name: "Pull translations"
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: tx pull --force
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: Routine i18n updates on ${{ steps.current-date.outputs.formattedTime }}
token: ${{ secrets.TX_PR_CREATOR }}
branch: i18n
base: master
title: Routine i18n updates on ${{ steps.current-date.outputs.formattedTime }}
body: "#### Summary\nNone\n\n#### Additional context\n`Translation file changes are intended`"
labels: Translation
@@ -1,41 +0,0 @@
name: "Push translation template"
concurrency: push_transifex
on:
workflow_run:
workflows: ["Experimental Release"]
types:
- completed
permissions:
contents: read
jobs:
push-template:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.event == 'push' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.status == 'success' &&
github.repository == 'CleverRaven/Cataclysm-DDA' }}
steps:
- name: "Install gettext tools"
run: sudo apt install gettext
- name: "Install Transifex CLI"
run: |
curl -sL https://github.com/transifex/cli/releases/download/v1.6.4/tx-linux-amd64.tar.gz | sudo tar zxvf - -C /usr/bin tx
- name: "Install Python3"
run: |
sudo apt install python3-pip
sudo pip3 install polib
- name: "Checkout"
uses: actions/checkout@v2
- name: "Generate translation template"
run: |
lang/update_pot.sh
- name: "Push translation template to Transifex server"
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: tx push -s
+51 -148
View File
@@ -4,23 +4,6 @@ on:
push:
branches:
- master
paths:
- '.github/workflows/release.yml'
- 'android/**'
- 'build-data/**'
- 'cataclysm-launcher'
- 'data/**'
- 'doc/**'
- 'gfx/**'
- 'lang/po/*.po'
- 'LICENSE*'
- 'Makefile'
- 'README*'
- 'src/**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release:
name: Create Release
@@ -39,8 +22,8 @@ jobs:
- name: Generate environmental variables
id: generate_env_vars
run: |
echo "tag_name=cdda-experimental-${{ steps.get-timestamp.outputs.time }}" >> $GITHUB_OUTPUT
echo "release_name=Cataclysm-DDA experimental build ${{ steps.get-timestamp.outputs.time }}" >> $GITHUB_OUTPUT
echo "::set-output name=tag_name::cdda-experimental-${{ steps.get-timestamp.outputs.time }}"
echo "::set-output name=release_name::Cataclysm-DDA experimental build ${{ steps.get-timestamp.outputs.time }}"
- name: Check if there is existing git tag
id: tag_check
uses: mukunku/tag-exists-action@v1.0.0
@@ -57,15 +40,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.generate_env_vars.outputs.tag_name }}
tag_prefix: ""
- name: "Generate release notes"
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github.v3+json" \
/repos/CleverRaven/Cataclysm-DDA/releases/generate-notes \
-f tag_name='${{ steps.generate_env_vars.outputs.tag_name }}' \
-f target_commitish='master' \
-q .body > CHANGELOG.md
- name: Create release
id: create_release
uses: actions/create-release@v1
@@ -75,7 +49,8 @@ jobs:
with:
tag_name: ${{ steps.generate_env_vars.outputs.tag_name }}
release_name: ${{ steps.generate_env_vars.outputs.release_name }}
body_path: ./CHANGELOG.md
body: |
These are the outputs for the experimental build of commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
draft: false
prerelease: true
builds:
@@ -85,76 +60,45 @@ jobs:
fail-fast: false
matrix:
include:
- name: Windows Tiles x64 MSVC
artifact: windows-tiles-x64-msvc
arch: x64
os: windows-2019
mxe: none
ext: zip
content: application/zip
sound: 0
- name: Windows Tiles Sounds x64 MSVC
artifact: windows-tiles-sounds-x64-msvc
arch: x64
os: windows-2019
mxe: none
ext: zip
content: application/zip
sound: 1
- name: Windows Tiles x64
mxe: x86_64
artifact: windows-tiles-x64
os: ubuntu-latest
ext: zip
content: application/zip
sound: 0
- name: Windows Tiles Sounds x64
mxe: x86_64
artifact: windows-tiles-sounds-x64
- name: Windows Tiles x32
mxe: i686
artifact: windows-tiles-x32
os: ubuntu-latest
ext: zip
content: application/zip
sound: 1
- name: Linux Tiles x64
os: ubuntu-20.04
os: ubuntu-18.04
mxe: none
android: none
tiles: 1
sound: 0
artifact: linux-tiles-x64
ext: tar.gz
content: application/gzip
- name: Linux Tiles Sounds x64
os: ubuntu-20.04
mxe: none
android: none
tiles: 1
sound: 1
artifact: linux-tiles-sounds-x64
ext: tar.gz
content: application/gzip
- name: Linux Curses x64
os: ubuntu-20.04
- name: linux-curses-x64
os: ubuntu-18.04
mxe: none
android: none
tiles: 0
sound: 0
artifact: linux-curses-x64
ext: tar.gz
content: application/gzip
- name: OSX Curses x64
os: macos-12
- name: osx-curses-x64
os: macos-10.15
mxe: none
tiles: 0
sound: 0
artifact: osx-curses-x64
ext: dmg
content: application/x-apple-diskimage
- name: OSX Tiles x64
os: macos-12
- name: osx-tiles-x64
os: macos-10.15
mxe: none
tiles: 1
sound: 0
artifact: osx-tiles-x64
ext: dmg
content: application/x-apple-diskimage
@@ -181,74 +125,35 @@ jobs:
content: application/aap
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
ZSTD_CLEVEL: 17
steps:
- uses: actions/checkout@v2
- name: Get soundpack
if: matrix.sound == 1
run: |
git clone --depth=1 --shallow-submodules --recurse-submodules https://github.com/Fris0uman/CDDA-Soundpacks '${{ github.workspace }}/CDDA-Soundpacks'
mv '${{ github.workspace }}/CDDA-Soundpacks/sound/CC-Sounds' '${{ github.workspace }}/data/sound'
- name: Install dependencies (windows msvc) (1/3)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2
- name: Install dependencies (windows msvc) (2/3)
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@v10
id: runvcpkg
with:
appendedCacheKey: ${{ hashFiles( 'msvc-full-features/vcpkg.json', '.github/vcpkg_triplets/**', '.github/vckg_ports/**' ) }}
# Rev this value to drop cache without changing vcpkg commit
prependedCacheKey: v1-${{ matrix.arch }}
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
# We have to use at least this version of vcpkg to include fixes for yasm-tool's
# availability only as an x86 host tool. Keep it in sync with the builtin-baseline
# field in vcpkg.json. Caching happens as a post-action which runs at the end of
# the whole workflow, after vcpkg install happens during msbuild run.
vcpkgGitCommitId: 'd08e708c2111893da3cc7e49b597ee4654c8076e'
- name: Install dependencies (windows msvc) (3/3)
if: runner.os == 'Windows'
run: |
vcpkg integrate install --vcpkg-root '${{ runner.workspace }}\b\vcpkg'
- name: Install dependencies (windows mxe)
- name: Install dependencies (windows)
if: matrix.mxe != 'none'
run: |
sudo apt install gettext
sudo apt install astyle autoconf automake autopoint bash bison bzip2 cmake flex gettext git g++ gperf intltool \
libffi-dev libgdk-pixbuf2.0-dev libtool libltdl-dev libssl-dev libxml-parser-perl lzip make mingw-w64 openssl \
p7zip-full patch perl pkg-config python ruby scons sed unzip wget xz-utils g++-multilib libc6-dev-i386 libtool-bin
- name: Install MXE
if: matrix.mxe != 'none'
run: |
curl -L -o mxe-${{ matrix.mxe }}.tar.xz https://github.com/BrettDong/MXE-GCC/releases/download/mxe-sdl-2-0-20/mxe-${{ matrix.mxe }}.tar.xz
curl -L -o mxe-${{ matrix.mxe }}.tar.xz.sha256 https://github.com/BrettDong/MXE-GCC/releases/download/mxe-sdl-2-0-20/mxe-${{ matrix.mxe }}.tar.xz.sha256
shasum -a 256 -c ./mxe-${{ matrix.mxe }}.tar.xz.sha256
sudo tar xJf mxe-${{ matrix.mxe }}.tar.xz -C /opt
curl -L -o SDL2-devel-2.26.2-mingw.tar.gz https://github.com/libsdl-org/SDL/releases/download/release-2.26.2/SDL2-devel-2.26.2-mingw.tar.gz
shasum -a 256 -c ./build-scripts/SDL2-devel-2.26.2-mingw.tar.gz.sha256
sudo tar -xzf SDL2-devel-2.26.2-mingw.tar.gz -C /opt/mxe/usr/${{ matrix.mxe }}-w64-mingw32.static.gcc12 --strip-components=2 SDL2-2.26.2/${{ matrix.mxe }}-w64-mingw32
curl -L -o libbacktrace-${{ matrix.mxe }}-w64-mingw32.tar.gz https://github.com/Qrox/libbacktrace/releases/download/2020-01-03/libbacktrace-${{ matrix.mxe }}-w64-mingw32.tar.gz
shasum -a 256 -c ./build-scripts/libbacktrace-${{ matrix.mxe }}-w64-mingw32-sha256
sudo tar -xzf libbacktrace-${{ matrix.mxe }}-w64-mingw32.tar.gz --exclude=LICENSE -C /opt/mxe/usr/${{ matrix.mxe }}-w64-mingw32.static.gcc12
sudo apt install software-properties-common lsb-release
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9
sudo add-apt-repository "deb [arch=amd64] https://pkg.mxe.cc/repos/apt `lsb_release -sc` main"
sudo apt update
sudo apt install mxe-{i686,x86-64}-w64-mingw32.static-{sdl2,sdl2-ttf,sdl2-image,sdl2-mixer,gettext}
- name: Install dependencies (Linux)
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none'
run: |
sudo apt-get update
sudo apt-get install libncursesw5-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev \
libsdl2-mixer-dev libpulse-dev ccache gettext parallel
- name: Install runtime dependencies (mac)
if: runner.os == 'macOS'
uses: BrettDong/setup-sdl2-frameworks@v1
with:
sdl2: latest
sdl2-ttf: latest
sdl2-image: latest
sdl2-mixer: latest
- name: Install build dependencies (mac)
- name: Install dependencies (mac)
if: runner.os == 'macOS'
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install gettext ccache parallel
pip3 install mac_alias==2.2.0 dmgbuild==1.4.2 biplist
- name: Create VERSION.TXT
shell: bash
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel
pip3 install dmgbuild==1.4.2 biplist
- name: Build CDDA (linux)
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none'
run: |
cat >VERSION.txt <<EOL
build type: ${{ matrix.artifact }}
@@ -256,48 +161,47 @@ jobs:
commit sha: ${{ github.sha }}
commit url: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
EOL
- name: Compile translations (windows)
if: runner.os == 'Windows'
shell: bash
run: |
lang/compile_mo.sh all
- name: Build CDDA (linux)
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none'
run: |
make -j$((`nproc`+0)) TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 bindist
mv cataclysmdda-0.F.tar.gz cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.tar.gz
- name: Build CDDA (windows mxe)
- name: Build CDDA (windows)
if: matrix.mxe != 'none'
env:
PLATFORM: /opt/mxe/usr/bin/${{ matrix.mxe }}-w64-mingw32.static.gcc12-
PLATFORM: /usr/lib/mxe/usr/bin/${{ matrix.mxe }}-w64-mingw32.static-
run: |
make -j$((`nproc`+0)) CROSS="${PLATFORM}" TILES=1 SOUND=1 RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=1 PCH=0 bindist
mv cataclysmdda-0.F.zip cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.zip
- name: Build CDDA (windows msvc)
if: runner.os == 'Windows'
env:
# Enable pretty backtraces
BACKTRACE: 1
CDDA_STRIPPED_PDB: 1
VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}\.github\vcpkg_triplets
run: |
msbuild -m -p:Configuration=Release -p:Platform=${{ matrix.arch }} "-target:Cataclysm-vcpkg-static;JsonFormatter-vcpkg-static" msvc-full-features\Cataclysm-vcpkg-static.sln
.\build-scripts\windist.ps1
cat >VERSION.txt <<EOL
build type: ${{ matrix.artifact }}
build number: ${{ needs.release.outputs.timestamp }}
commit sha: ${{ github.sha }}
commit url: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
EOL
make -j$((`nproc`+0)) CROSS="${PLATFORM}" TILES=1 SOUND=1 RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 bindist
mv cataclysmdda-0.F.zip cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.zip
- name: Build CDDA (osx)
if: runner.os == 'macOS'
run: |
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 OSX_MIN=10.13 FRAMEWORK=1 dmgdist
cat >VERSION.txt <<EOL
build type: ${{ matrix.artifact }}
build number: ${{ needs.release.outputs.timestamp }}
commit sha: ${{ github.sha }}
commit url: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
EOL
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 OSX_MIN=10.12 dmgdist
mv Cataclysm.dmg cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.dmg
- name: Set up JDK 8 (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '8'
distribution: 'adopt'
- name: Setup Build and Dependencies (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
run: |
cat >VERSION.txt <<EOL
build type: ${{ matrix.artifact }}
build number: ${{ needs.release.outputs.timestamp }}
commit sha: ${{ github.sha }}
commit url: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
EOL
sudo apt-get update
sudo apt-get install gettext
- name: Build CDDA (android)
@@ -334,7 +238,6 @@ jobs:
asset_name: cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.${{ matrix.ext }}
asset_content_type: ${{ matrix.content }}
- name: Trigger GitHub pages rebuild
shell: bash
run: |
curl --fail --request POST \
--url https://api.github.com/repos/${{ github.repository }}/pages/builds \
-33
View File
@@ -1,33 +0,0 @@
name: 'Stale issue handler'
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: get-time
run: |
echo "time=$(date +%I)" >> $GITHUB_ENV
- uses: actions/stale@main
id: stale
with:
stale-issue-label: stale
stale-pr-label: stale
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.'
stale-pr-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.'
days-before-stale: 30
days-before-close: 30
start-date: '2020-05-07'
ascending: ${{ contains(fromJson('["01", "03", "05", "07", "09", "11"]'), env.time) }}
operations-per-run: 250
exempt-issue-labels: '<Bug>,<Bugfix>,<Crash / Freeze>,Organization: Bounty,Good First Issue,(P1 - Critical),(P2 - High),(P3 - Medium),(P4 - Low),(P5 - Long-term),(S2 - Confirmed),0.G String Freeze,0.G Feature Freeze,0.G Content Freeze'
exempt-pr-labels: '<Bug>,<Bugfix>,<Crash / Freeze>,Organization: Bounty,Good First Issue,(P1 - Critical),(P2 - High),(P3 - Medium),(P4 - Low),(P5 - Long-term),(S2 - Confirmed),0.G String Freeze,0.G Feature Freeze,0.G Content Freeze'
exempt-all-milestones: true
exempt-all-assignees: true
- name: Print outputs
run: echo ${{ join(steps.stale.outputs.*, ',') }}
-15
View File
@@ -1,15 +0,0 @@
name: Summary Labeler
on:
- pull_request_target
jobs:
uses:
name: labeler
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: fuxingloh/multi-labeler@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
config-path: '.github/summary-labels.yml'
-78
View File
@@ -1,78 +0,0 @@
name: Apply Test Labels
on:
workflow_run:
workflows: ["astyle", "JSON Validation", "General build matrix"]
types: [completed]
jobs:
labeling:
if: github.repository == 'CleverRaven/Cataclysm-DDA'
runs-on: ubuntu-latest
steps:
- name: setLabel
id: setLabel
run: |
if [[ "${{ github.event.workflow_run.name }}" == "astyle" ]]; then
echo "label=astyled" >> $GITHUB_OUTPUT
fi
if [[ "${{ github.event.workflow_run.name }}" == "JSON Validation" ]]; then
echo "label=json-styled" >> $GITHUB_OUTPUT
fi
if [[ "${{ github.event.workflow_run.name }}" == "General build matrix" ]]; then
echo "label=BasicBuildPassed" >> $GITHUB_OUTPUT
fi
- name: Download success artifact from basic build
if: ${{ github.event.workflow_run.name == 'General build matrix' }}
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.name }}
run_id: ${{ github.event.workflow_run.id }}
name: basic-build
- name: set-basic-build-success
id: set-basic-build-success
run: echo "basic-build-success=$( cat basic-build )" >> $GITHUB_OUTPUT
- name: Download pr id artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.name }}
run_id: ${{ github.event.workflow_run.id }}
name: pull_request_id
- name: set-pr-id
id: set-pr-id
run: echo "pr-id=$( cat pull_request_id )" >> $GITHUB_OUTPUT
- name: set-label
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.conclusion != 'skipped' || steps.set-basic-build-success.outputs.basic-build-success == 'true' }}
uses: actions/github-script@v5
with:
script: |
if ('${{ steps.set-pr-id.outputs.pr-id }}'.trim().length == 0) {
console.log("The PR ID artifact does not contain a pull request number.")
} else {
github.rest.issues.addLabels({
issue_number: ${{ steps.set-pr-id.outputs.pr-id }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['${{ steps.setLabel.outputs.label }}']
})
}
- name: remove-label
if: ${{ github.event.workflow_run.conclusion == 'failure' && steps.set-basic-build-success.outputs.basic-build-success != 'true' }}
uses: actions/github-script@v5
with:
script: |
if ('${{ steps.set-pr-id.outputs.pr-id }}'.trim().length == 0) {
console.log("The PR ID artifact does not contain a pull request number.")
} else {
try {
github.rest.issues.removeLabel({
issue_number: ${{ steps.set-pr-id.outputs.pr-id }},
owner: context.repo.owner,
repo: context.repo.repo,
name: '${{ steps.setLabel.outputs.label }}'
})
} catch (e) {
console.log(e)
}
}
@@ -1,83 +0,0 @@
name: Text Changes Analyzer
on:
pull_request:
branches:
- master
paths:
- '.github/workflows/text-changes-analyzer.yml'
- 'tools/pot_diff.py'
- 'lang/extract_json_strings.py'
- 'lang/string_extractor/**'
- 'src/*.h'
- 'src/*.cpp'
- '**.json'
permissions:
contents: read
jobs:
analyze-text-changes:
runs-on: ubuntu-20.04
steps:
- name: "Install dependencies"
run: |
sudo apt-get update
sudo apt-get install python3-pip gettext
sudo pip3 install polib pyspellchecker
- name: "Checkout test merge commit"
uses: actions/checkout@v2
- name: "Compute base commit and test merge commit"
id: get-commit-hash
run: |
echo "test_merge_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "head_commit=$(git log -1 --format='%B' | grep -o -E -e 'Merge\s([0-9a-f]{40})\sinto' | grep -o -E -e '[0-9a-f]{40}')" >> $GITHUB_OUTPUT
echo "base_commit=$(git log -1 --format='%B' | grep -o -E -e 'into\s([0-9a-f]{40})$' | grep -o -E -e '[0-9a-f]{40}')" >> $GITHUB_OUTPUT
- name: "Generate translation template on test merge commit"
run: |
rm -f lang/po/cataclysm-dda.pot
./lang/update_pot.sh
cp lang/po/cataclysm-dda.pot ~/merge.pot
- name: "Checkout base commit"
uses: actions/checkout@v2
with:
ref: ${{ steps.get-commit-hash.outputs.base_commit }}
- name: "Generate translation template on base commit"
run: |
rm -f lang/po/cataclysm-dda.pot
./lang/update_pot.sh
cp lang/po/cataclysm-dda.pot ~/base.pot
- name: "Checkout test merge commit"
uses: actions/checkout@v2
with:
ref: ${{ steps.get-commit-hash.outputs.test_merge_commit }}
- name: "List text changes"
run: |
python3 ./tools/pot_diff.py ~/base.pot ~/merge.pot
- name: "Write text changes"
run: |
python3 ./tools/pot_diff.py ~/base.pot ~/merge.pot -j ~/pot_diff.json
- name: "Spell check on text changes"
run: |
python3 ./tools/spell_check_pr.py -i ~/pot_diff.json > spell_check_output
- name: "Get length of spell check output"
id: get_length
run: |
wc -c spell_check_output | grep -o '[0-9]*' > spell_check_retcode
echo "length=$(cat spell_check_retcode)" >> $GITHUB_OUTPUT
- run: echo ${{ github.event.number }} > pull_request_id
- uses: actions/upload-artifact@v2
with:
name: pull_request_id
path: pull_request_id
- uses: actions/upload-artifact@v2
with:
name: spell_check_retcode
path: spell_check_retcode
- uses: actions/upload-artifact@v2
if: steps.get_length.outputs.length >= 1
with:
name: spell_check_output
path: spell_check_output
-6
View File
@@ -5,9 +5,6 @@ on:
paths:
- 'doc/JSON_INFO.md'
name: TOC Generator
permissions:
contents: read
jobs:
generateTOC:
if: github.repository == 'CleverRaven/Cataclysm-DDA'
@@ -21,11 +18,8 @@ jobs:
with:
commit-message: Update the table of contents
branch: update-toc
token: ${{ secrets.TX_PR_CREATOR }}
title: Update the table of contents in doc/JSON_INFO.md
body: |
```sh
#### Summary
None
npx doctoc doc/JSON_INFO.md --github
```
+40
View File
@@ -0,0 +1,40 @@
name: "Push translation template"
concurrency: push_transifex
on:
push:
branches:
- master
paths:
- '**.json'
- 'src/**.cpp'
- 'src/**.h'
- 'lang/extract_json_strings.py'
- 'lang/strip_line_numbers.py'
- 'lang/update_pot.sh'
- 'lang/unicode_check.py'
jobs:
push-template:
runs-on: ubuntu-20.04
steps:
- name: "Install dependencies"
run: |
sudo apt-get update
sudo apt-get install gettext python3-pip
sudo pip3 install transifex-client
- name: "Checkout"
uses: actions/checkout@v2
- name: "Generate translation template"
run: |
lang/update_pot.sh
- name: "Push translation template"
env:
TOKEN: ${{ secrets.TX_TOKEN }}
run: |
export TX_TOKEN=$TOKEN
tx push --source --no-interactive --resource cataclysm-dda.master-cataclysm-dda
unset TX_TOKEN
unset TOKEN
-48
View File
@@ -1,48 +0,0 @@
# This workflow runs at 23:00 UTC sundays
name: "Pull Tileset Updates"
on:
schedule:
- cron: "0 23 * * sun"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TX_TOKEN: ${{ secrets.TX_TOKEN }}
jobs:
pull-updates:
if: github.repository == 'CleverRaven/Cataclysm-DDA'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Get current date"
uses: 1466587594/get-current-time@v2
id: current-date
with:
format: 'DD MMMM YYYY'
- name: "Update Tilesets"
shell: bash
run: |
gh release download -D gfx/ -p '*.zip' -R I-am-Erk/CDDA-Tilesets
gh release download -D gfx/ -p '*.zip' -R pixel-32/CDDA-tileset
find gfx/ -name "*.zip" | xargs -I{} unzip -o {} -d gfx/
rm -fr gfx/*.zip
# make sure all files are linted just in case
# FIXME: make json test check gfx folder instead of using this
make tools/format/json_formatter.cgi
find gfx/ -name "*.json" -print0 | xargs -0 -L 1 -P $(nproc) tools/format/json_formatter.cgi || exit 0
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: |
Routine tileset updates on ${{ steps.current-date.outputs.formattedTime }}
committer: casswedson <casswedson@users.noreply.github.com>
author: casswedson <casswedson@users.noreply.github.com>
token: ${{ secrets.TX_PR_CREATOR }}
branch: tileset-updates
delete-branch: true
base: master
title: Routine tileset updates on ${{ steps.current-date.outputs.formattedTime }}
body: "#### Summary\nNone\nAutomatic tileset updates from:\n\n**https://github.com/I-am-Erk/CDDA-Tilesets/releases**\nAltica, BrownLikeBears, ChibiUltica, HollowMoon, Larwick_Overmap, MshockXotto+, NeoDaysTileset, RetroDaysTileset, SmashButton_iso, SurveyorsMap\n\n---\n\n**https://github.com/pixel-32/CDDA-tileset/releases**\nCuteclysm"
-50
View File
@@ -1,50 +0,0 @@
name: "Weekly changelog update"
on:
schedule:
- cron: "45 0 * * 1"
push:
branches:
- master
paths:
- '.github/workflows/weekly-changelog.yml'
jobs:
weekly-changelog:
if: github.repository == 'CleverRaven/Cataclysm-DDA'
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: "Get current date"
uses: 1466587594/get-current-time@v2
id: current-date
with:
format: 'YYYYMMDD'
- name: "Get changes since last week"
id: getting-changes
env:
CURR_DATE: ${{ steps.current-date.outputs.formattedTime }}
run: |
LAST_WEEK="$(date -d "@$(( $(date +%s -d $CURR_DATE) - (60*60*24*7) ))" +"%Y-%m-%d")"
tools/generate_changelog.py -f --by-date /tmp/changelog.txt -T "${{ secrets.GITHUB_TOKEN }}" "$LAST_WEEK"
tac /tmp/changelog.txt > /tmp/changelog_rev.txt
tools/merge_summaries.sh /tmp/changelog_rev.txt data/changelog.txt
echo "date=$( date +"%Y-%m-%d" -d $CURR_DATE )" >> $GITHUB_OUTPUT
echo "old_date=$LAST_WEEK" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3.10.0
with:
commit-message: Weekly Changelog ${{ steps.getting-changes.outputs.old_date }} to ${{ steps.getting-changes.outputs.date }}
committer: David Seguin <davidseguin@live.ca>
author: David Seguin <davidseguin@live.ca>
token: ${{ secrets.TX_PR_CREATOR }}
branch: changelog-weekly
delete-branch: true
base: master
title: Weekly Changelog ${{ steps.getting-changes.outputs.old_date }} to ${{ steps.getting-changes.outputs.date }}
body: "#### Summary\nNone\n\n#### Additional context\n`Automatically generated as a draft. Please copy-edit before merging.`"
labels: Organization,<Documentation>
# create as a draft to allow maintainers to cull the changes before merging
draft: true
+8 -36
View File
@@ -7,17 +7,13 @@
*.o
*.tmp
*.zip
*.apk
*.log
/WinDepend/
/bindist/
/build/
/build-start-time
/cache/
/cmake-build-debug/
/config/
/data/*.template
/data/cache/
/data/mods/user-default-mods.json
/dep/
/doxygen_doc/html/*
@@ -30,7 +26,6 @@
/objwin/
/save/
/src/version.h
/src/prefix.h
/sound/
/templates/
/tools/format/json_formatter.cgi
@@ -40,7 +35,7 @@ CataclysmWin.layout
cata_test
cata_test-tiles
cataclysm
*cataclysm-tiles
cataclysm-tiles
cataclysm-vcpkg
cataclysmdda-*
chkjson*
@@ -55,23 +50,17 @@ json_formatter
*.opensdf
*.pdb
*.lib
*.manifest
*.sdf
*.suo
*.user
*.vcxproj.filters
*.lastbuildstate
.vs/
.vscode/
Directory.Build.props
Directory.Build.targets
Debug*/
Release*/
# Visual Studio project files
/msvc-full-features/**/
# Temporary CMakeFiles
CMakeUserPresets.json
out/
# Distribution script results
/msvc-full-features/distribution
# Visual Studio 2015
/msvc-full-features/*db
@@ -82,10 +71,8 @@ Cataclysm.exe.lastcodeanalysissucceeded
#Visual Studio 2017
/msvc-full-features/PredictedInputCache_Debug_x64.dat
# Visual Studio 2019
**/enc_temp_folder/*
#vcpkg
/msvc-full-features/vcpkg_installed
/msvc-object_creator/vcpkg_installed
# PVS Studio
@@ -107,14 +94,12 @@ cscope.*
tags
# Generated translation source
/lang/po/*.pot
/lang/po/cataclysm-dda.pot
/lang/po/en.po
# Compiled binary translations
/lang/mo/
# Stampfile for binary translations
/lang/mo_built.stamp
# Directory for translatable strings
/lang/json/*
!/lang/json/README
@@ -123,7 +108,6 @@ tags
nbproject/
# Python runtime files
__pycache__
*.pyc
# vim files
@@ -220,15 +204,3 @@ Xcode/
/tests/pch/tests-pch.hpp.pch
/tests/catch/catch.hpp.gch
/tests/catch/catch.hpp.pch
weather.output
# bundler local directories and files for jekyll site
/.bundle/
/_site/
/vendor/
.sass-cache
.jekyll-metadata
Gemfile.lock
# VERSION.txt generated by our CMakeLists.txt
VERSION.txt
-9
View File
@@ -1,12 +1,3 @@
extraction:
cpp:
prepare:
packages:
- "libncurses-dev"
index:
build_command: "make RELEASE=1 cataclysm -j2"
# Disable FIXME query, in DDA it is as likely to be a future feature as a bug.
queries:
- exclude: cpp/fixme-comment
- exclude: cpp/non-constant-format
+233
View File
@@ -0,0 +1,233 @@
# this file is HEAVILY influenced by https://github.com/boostorg/hana/blob/master/.travis.yml
dist: xenial
language: c++
cache: ccache
notifications:
email: false
git:
depth: 5
addons:
# these apt sources will be referenced later (by using *name)
apt:
sources: &apt_sources
- ubuntu-toolchain-r-test
config:
retries: true
compiler: gcc
os: linux
# We have branch builds disabled globally to prevent double-builds of PRs.
# This re-enables just the master branch.
branches:
only:
- master
- development
# Overall strategy for what sorts of builds to include:
# We want a build for each compiler and each platform.
# For PRs, we lessen the "each compiler" requirement to just covering the newest
# and oldest relevant version of each compiler.
# We also want to ensure that each of the following tweaks are covered in at
# least one PR build:
# - TILES=1
# - SOUND=1
# - RELEASE=1
# - CMAKE=1
# - LOCALIZE=0
# - Tests with important mods enabled (Magiclysm)
# We try to minimize the number of builds subject to those constraints.
#
# The following used to be here but became too slow to run on Travis and have
# been moved to GitHub Actions:
# - A clang-tidy run
# - SANITIZE=address,undefined
# To see what toolchains are available, consult the following:
# https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json
# https://launchpad.net/%7Eubuntu-toolchain-r/+archive/ubuntu/test/+index
jobs:
include:
# Initial test stage, if this fails everything else is canceled.
- stage: Test
# Clang is consistently the fastest to build, so use it for the initial test.
env: CLANG=clang++-3.8 TEST_STAGE=1 CXXFLAGS="-Wno-error=unused-command-line-argument -D__extern_always_inline='extern __always_inline'"
name: "Clang 3.8 Make build with curses and style check"
compiler: clang
addons: &clang38
apt:
packages: ["clang-3.8"]
sources: [*apt_sources]
# Then build different configurations and targets in parallel.
- stage: "Main Compilers"
env: COMPILER=g++ MODS=--mods=magiclysm LOCALIZE=0
name: "GCC 5.3 Make build with curses, Magiclysm, and no Localization"
compiler: gcc
addons: &gcc53
apt:
packages: ["g++-5=5.3.1-14ubuntu2", "libstdc++-5-dev=5.3.1-14ubuntu2", "gcc-5=5.3.1-14ubuntu2", "gcc-5-base=5.3.1-14ubuntu2", "cpp-5=5.3.1-14ubuntu2", "libgcc-5-dev=5.3.1-14ubuntu2", "libasan2=5.3.1-14ubuntu2", "libmpx0=5.3.1-14ubuntu2"]
sources: [*apt_sources]
- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" TILES=1 SOUND=1
name: "GCC 8 Make build with Tiles, Sound"
dist: bionic
compiler: gcc
addons: &gcc8
apt:
packages: ["g++-8", "g++-8-multilib", "libc6-dbg", "libc6-dbg:i386", "libsdl2-dev", "libsdl2-ttf-dev", "libsdl2-image-dev", "libsdl2-mixer-dev"]
sources: *apt_sources
- env: CLANG=clang++-10
name: "Clang 10 Make build"
compiler: clang
dist: bionic
addons: &clang10
apt:
packages:
- clang-10
sources:
- sourceline: "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- stage: "Platforms and Tidy"
# MXE variant using alternate repository http://mirror.mxe.cc/repos/apt
env: COMPILER=g++ LDFLAGS="-static-libgcc -static-libstdc++" MXE_TARGET="i686-w64-mingw32.static" WINE="wine" TILES=1 SOUND=1
name: "Mingw-w64 Make cross-compile to Windows with Tiles and Sound"
compiler: gcc
addons: &gcc
apt:
packages: ["wine"]
- env: NATIVE=android COMPILER=gcc
name: "Android build"
language: android
android:
components:
- build-tools-28.0.1
cache:
# The ccache feature in Travis doesn't work for language: android, so
# do it ourselves.
directories:
- $HOME/.ccache
- env: CLANG=clang++ OSX_MIN=10.13 TILES=1 SOUND=1
name: "Xcode 10.2 Make build with Tiles and sound (macOS)"
os: osx
osx_image: xcode10.2
compiler: clang
# Finally check the compiler variants
- stage: compilers
# GCC 5.4 is default on Xenial
env: COMPILER=g++
name: "GCC 5.4 Make build with Curses"
if: type != pull_request
- env: COMPILER=g++-6 CODE_COVERAGE=true
name: "GCC 6 Make build with Curses and Code Coverage"
if: type != pull_request
compiler: gcc
addons: &gcc6
apt:
packages: ["g++-6", "g++-6-multilib", "libc6-dbg", "libc6-dbg:i386"]
sources: *apt_sources
- env: COMPILER=g++-7 CXXFLAGS='-Wno-implicit-fallthrough -D_GLIBCXX_DEBUG'
name: "GCC 7 Make build with Curses and GLIBCXX_DEBUG"
if: type != pull_request
compiler: gcc
addons: &gcc7
apt:
packages: ["g++-7", "g++-7-multilib", "libc6-dbg", "libc6-dbg:i386", "lcov"]
sources: *apt_sources
- env: CLANG=clang++-3.9 CXXFLAGS='-Wno-error=unused-command-line-argument -D__extern_always_inline="extern __always_inline"'
name: "Clang 3.9 Make build with Curses"
if: type != pull_request
compiler: clang
addons: &clang39
apt:
packages: ["clang-3.9"]
sources: *apt_sources
- env: CLANG=clang++-4.0 CXXFLAGS=-Wno-error=unused-command-line-argument
name: "Clang 4 Make build with Curses"
if: type != pull_request
compiler: clang
addons: &clang40
apt:
packages: ["clang-4.0"]
# Luckily the Trusty install Just Works on Xenial
sources: [*apt_sources, llvm-toolchain-trusty-4.0]
- env: CLANG=clang++-5.0 CXXFLAGS=-Wno-error=unused-command-line-argument
name: "Clang 5 Make build with Curses"
if: type != pull_request
compiler: clang
addons: &clang50
apt:
packages: ["clang-5.0"]
sources: [*apt_sources, llvm-toolchain-xenial-5.0]
- env: CLANG=clang++-6.0 TILES=1 SOUND=1 CXXFLAGS=-Wno-error=unused-command-line-argument CMAKE=1 RELEASE=1
name: "Clang 6 CMake build with tiles and sound"
if: type != pull_request
compiler: clang
addons: &clang60
apt:
packages: ["clang-6.0", "libsdl2-dev", "libsdl2-ttf-dev", "libsdl2-image-dev", "libsdl2-mixer-dev"]
sources: [*apt_sources, llvm-toolchain-xenial-6.0]
- env: CLANG=clang++-7
name: "Clang 7 Make build with Curses"
if: type != pull_request
compiler: clang
addons: &clang7
apt:
packages: ["clang-7"]
sources: [*apt_sources, llvm-toolchain-xenial-7]
- env: CLANG=clang++-8
name: "Clang 8 Make build with Curses"
if: type != pull_request
compiler: clang
addons: &clang8
apt:
packages: ["clang-8"]
sources: [*apt_sources, llvm-toolchain-xenial-8]
- env: CLANG=clang++-9
name: "Clang 9 Make build with Curses"
if: type != pull_request
compiler: clang
dist: bionic
addons: &clang9
apt:
packages:
- clang-9
sources:
- sourceline: "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
before_install:
- if [ "${NATIVE}" == "android" ]; then yes | sdkmanager "platforms;android-28"; fi
before_script:
- if [ -n "${CLANG}" ]; then COMPILER="$CLANG"; fi
- ${COMPILER} --version
- CXX="$COMPILER"
- source build-scripts/requirements.sh
script:
- build-scripts/build.sh
after_success:
- if [ -n "${CODE_COVERAGE}" ]; then coveralls -b . -i src -e tests --gcov /usr/bin/gcov-6; fi
- if [ -n "${CODE_COVERAGE}" ]; then bash <(curl -s https://codecov.io/bash); fi
+5 -19
View File
@@ -1,24 +1,10 @@
[main]
host = https://www.transifex.com
[o:cataclysm-dda-translators:p:cataclysm-dda:r:master-cataclysm-dda]
file_filter = lang/po/<lang>.po
source_file = lang/po/cataclysm-dda.pot
source_lang = en
type = PO
[cataclysm-dda.master-cataclysm-dda]
file_filter = lang/po/<lang>.po
minimum_perc = 0
[o:cataclysm-dda-translators:p:cataclysm-dda:r:credits-master]
file_filter = data/credits/<lang>.credits
source_file = data/credits/en.credits
source_lang = en
type = TXT
minimum_perc = 20
[o:cataclysm-dda-translators:p:cataclysm-dda:r:motd-master]
file_filter = data/motd/<lang>.motd
source_file = data/motd/en.motd
source_lang = en
type = TXT
minimum_perc = 20
source_file = lang/po/cataclysm-dda.pot
source_lang = en
type = PO
+71 -146
View File
@@ -1,13 +1,10 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.1.4)
project(CataclysmDDA)
list(APPEND CMAKE_MODULE_PATH
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/CMakeModules)
if (NOT VCPKG_MANIFEST_MODE)
list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMakeModules/Find)
endif()
set(CMAKE_TLS_VERIFY ON)
@@ -18,25 +15,19 @@ option(SOUND "Support for in-game sounds & music." "OFF")
option(BACKTRACE "Support for printing stack backtraces on crash" "ON")
option(LIBBACKTRACE "Print backtrace with libbacktrace." "OFF")
option(USE_HOME_DIR "Use user's home directory for save files." "ON")
option(USE_PREFIX_DATA_DIR "Use UNIX system directories for game data in release build." "ON")
option(LOCALIZE "Support for language localizations. Also enable UTF support." "ON")
option(LANGUAGES "Compile localization files for specified languages." "")
option(DYNAMIC_LINKING
"Use dynamic linking. Or use static to remove MinGW dependency instead." "ON")
option(JSON_FORMAT "Build JSON formatter" "OFF")
option(CATA_CCACHE "Try to find and build with ccache" "ON")
option(CATA_CLANG_TIDY_PLUGIN "Build Cata's custom clang-tidy checks as a plugin" "OFF")
option(CATA_CLANG_TIDY_EXECUTABLE "Build Cata's custom clang-tidy checks as an executable" "OFF")
option(TESTS "Compile Cata's tests" "ON")
option(CATA_CLANG_TIDY_PLUGIN "Build Cata's custom clang-tidy plugin" "OFF")
set(CATA_CLANG_TIDY_INCLUDE_DIR "" CACHE STRING
"Path to internal clang-tidy headers required for plugin (e.g. ClangTidy.h)")
set(CATA_CHECK_CLANG_TIDY "" CACHE STRING "Path to check_clang_tidy.py for plugin tests")
set(GIT_BINARY "" CACHE STRING "Git binary name or path.")
set(GETTEXT_MSGFMT_BINARY "" CACHE FILEPATH "msgfmt binary name or path.")
if (TESTS)
include(CTest)
endif()
message(STATUS "${PROJECT} build environment --")
message(STATUS "Build realm is: ${CMAKE_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_PROCESSOR}")
@@ -49,40 +40,27 @@ add_definitions(-DCMAKE)
include(GetGitRevisionDescription)
git_describe(GIT_VERSION --tags --always --match "[0-9A-Z]*.[0-9A-Z]*")
if (NOT "${GIT_VERSION}" MATCHES "GIT-NOTFOUND")
if (NOT ${GIT_VERSION} MATCHES GIT-NOTFOUND)
string(REPLACE "-NOTFOUND" "" GIT_VERSION ${GIT_VERSION})
file(WRITE ${CMAKE_SOURCE_DIR}/src/version.h
"// NOLINT(cata-header-guard)\n\#define VERSION \"${GIT_VERSION}\"\n")
message(STATUS "${PROJECT_NAME} build version is: ${GIT_VERSION}")
add_definitions(-DGIT_VERSION)
# get_git_head_revision() does not work with worktrees in Windows
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE _sha1
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(TIMESTAMP _timestamp %Y-%m-%d-%H%M)
file(WRITE VERSION.txt "\
build type: ${BUILD_PRESET_NAME}\n\
build number: ${_timestamp}\n\
commit sha: ${_sha1}\n\
commit url: https://github.com/CleverRaven/Cataclysm-DDA/commit/${_sha1}"
)
endif ()
#OS Check Placeholders. Will be used for BINDIST
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
set(_OS_LINUX_ 1)
endif ()
if ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
set(_OS_FREEBSD_ 1)
endif ()
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
if (${CMAKE_SYSTEM_NAME} MATCHES Darwin)
set(_OS_DARWIN_ 1)
add_definitions(-DMACOSX)
if (TILES)
if (${TILES})
add_definitions(-DOSX_SDL2_LIBS)
endif ()
endif ()
@@ -97,9 +75,7 @@ include(CheckCXXCompilerFlag)
#SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -m32")
if (NOT DYNAMIC_LINKING)
if(NOT MSVC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.dll.a")
endif()
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.dll.a")
set(BUILD_SHARED_LIBRARIES OFF)
check_cxx_compiler_flag (-static HAVE_STATIC_FLAG)
if (HAVE_STATIC_FLAG)
@@ -113,20 +89,17 @@ if (NOT DYNAMIC_LINKING)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # remove -rdynamic
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
else ()
if (MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if (MINGW AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Avoid depending on MinGW runtime DLLs
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif ()
endif ()
# System specific actions
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Linux|FreeBSD|Darwin)")
if (${CMAKE_SYSTEM_NAME} MATCHES Linux OR ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
if (NOT DATA_PREFIX)
set(DATA_PREFIX ${CMAKE_INSTALL_PREFIX}/share/cataclysm-dda)
endif ()
if (NOT README_DIR)
set(README_DIR ${DATA_PREFIX})
endif ()
if (NOT LOCALE_DIR)
set(LOCALE_DIR ${CMAKE_INSTALL_PREFIX}/share/locale)
endif ()
@@ -147,15 +120,12 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Linux|FreeBSD|Darwin)")
endif ()
endif ()
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Windows|MSYS)")
if (${CMAKE_SYSTEM_NAME} MATCHES Windows)
if (NOT DATA_PREFIX)
set(DATA_PREFIX ${CMAKE_INSTALL_PREFIX}/data)
endif ()
if (NOT README_DIR)
set(README_DIR ${CMAKE_INSTALL_PREFIX})
set(DATA_PREFIX ${CMAKE_INSTALL_PREFIX})
endif ()
if (NOT LOCALE_DIR)
set(LOCALE_DIR ${CMAKE_INSTALL_PREFIX}/lang)
set(LOCALE_DIR ${CMAKE_INSTALL_PREFIX})
endif ()
if (NOT BIN_PREFIX)
set(BIN_PREFIX ${CMAKE_INSTALL_PREFIX})
@@ -166,8 +136,9 @@ message(STATUS "${PROJECT_NAME} build options --")
# Preset variables
if (NOT LANGUAGES)
set(LANGUAGES ar cs da de el es_AR es_ES fil_PH fr ga_IE hu id is it_IT ja ko nb nl pl pt_BR ro
ru sr tr uk_UA zh_CN zh_TW)
# English is included to workaround a libintl bug that affects performance
# on MinGW targets. See lang/CMakeList.txt for more information.
set(LANGUAGES en de es_AR es_ES fr it_IT ja ko pt_BR ru zh_CN zh_TW)
endif ()
if (GIT_BINARY)
@@ -187,7 +158,7 @@ if (TILES)
endif ()
# Set build types and display info
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(RELEASE 0)
message(STATUS "Build ${PROJECT} in development mode --")
message(STATUS "Binaries will be located in: " ${CMAKE_SOURCE_DIR})
@@ -212,12 +183,8 @@ else ()
message(STATUS "MANPAGE_ENTRY_PATH : ${MANPAGE_ENTRY_PATH}")
add_definitions(-DRELEASE)
# Use CMAKE_INSTALL_PREFIX as storage of data,gfx, etc.. Useful only on *nix OS.
if (CMAKE_INSTALL_PREFIX AND NOT WIN32 AND USE_PREFIX_DATA_DIR)
if (CMAKE_INSTALL_PREFIX AND NOT WIN32)
add_definitions(-DPREFIX=${CMAKE_INSTALL_PREFIX})
configure_file(
"${CMAKE_SOURCE_DIR}/src/prefix.h.in"
"${CMAKE_SOURCE_DIR}/src/prefix.h"
@ONLY)
add_definitions(-DDATA_DIR_PREFIX)
endif ()
endif ()
@@ -233,7 +200,13 @@ message(STATUS "USE_HOME_DIR : ${USE_HOME_DIR}")
message(STATUS "LANGUAGES : ${LANGUAGES}")
message(STATUS "See doc/COMPILING/COMPILING-CMAKE.md for details and more info --")
if (NOT MSVC)
if (MSVC)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D_AMD64_)
else ()
add_definitions(-D_X86_)
endif ()
else (MSVC)
set(CATA_WARNINGS
"-Werror -Wall -Wextra \
-Wformat-signedness \
@@ -246,13 +219,9 @@ if (NOT MSVC)
-Wpedantic \
-Wsuggest-override \
-Wunused-macros \
-Wzero-as-null-pointer-constant")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CATA_WARNINGS "${CATA_WARNINGS} -Wno-unknown-warning-option")
else()
set(CATA_WARNINGS "${CATA_WARNINGS} -Wno-unknown-warning")
endif()
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
-Wzero-as-null-pointer-constant \
-Wno-unknown-warning-option")
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(CATA_WARNINGS "${CATA_WARNINGS} -Wredundant-decls")
endif ()
set(CATA_OTHER_FLAGS "${CATA_OTHER_FLAGS} -fsigned-char")
@@ -262,12 +231,10 @@ if (NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
endif ()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
# Force out-of-source build
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"This project requires an out of source build. \
Remove the file 'CMakeCache.txt' found in this directory before continuing; \
@@ -279,14 +246,12 @@ endif ()
set(CMAKE_THREAD_PREFER_PTHREAD True)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
# Check for build types and libraries
if (TILES)
# Find SDL, SDL_ttf & SDL_image for graphical install
message(STATUS "Searching for SDL2 library --")
find_package(SDL2)
if (NOT (SDL2_FOUND OR TARGET SDL2::SDL2))
if (NOT SDL2_FOUND)
message(FATAL_ERROR
"This project requires SDL2 to be installed to compile in graphical mode. \
Please install the SDL2 development libraries, \
@@ -305,12 +270,8 @@ if (TILES)
endif ()
message(STATUS "Searching for SDL2_TTF library --")
if (NOT VCPKG_MANIFEST_MODE)
find_package(SDL2_ttf)
else()
find_package(sdl2-ttf)
endif()
if (NOT (SDL2_TTF_FOUND OR TARGET SDL2::SDL2_ttf OR TARGET SDL2::SDL2_ttf-static))
find_package(SDL2_ttf)
if (NOT SDL2_TTF_FOUND)
message(FATAL_ERROR
"This project requires SDL2_ttf to be installed to compile in graphical mode. \
Please install the SDL2_ttf development libraries, \
@@ -319,12 +280,8 @@ if (TILES)
endif ()
message(STATUS "Searching for SDL2_image library --")
if(VCPKG_MANIFEST_MODE)
find_package(sdl2-image)
else()
find_package(SDL2_image)
endif()
if (NOT (SDL2_IMAGE_FOUND OR TARGET SDL2::SDL2_image))
find_package(SDL2_image)
if (NOT SDL2_IMAGE_FOUND)
message(FATAL_ERROR
"This project requires SDL2_image to be installed to compile in graphical mode. \
Please install the SDL2_image development libraries, \
@@ -347,9 +304,6 @@ if (CURSES)
or try compiling with -DTILES=1 for a graphical compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info")
endif ()
if (NOT DYNAMIC_LINKING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNCURSES_STATIC")
endif ()
endif ()
if (SOUND)
@@ -362,48 +316,41 @@ if (SOUND)
endif ()
# Sound requires SDL_mixer library
if(VCPKG_MANIFEST_MODE)
message(STATUS "Searching for sdl2-mixer library --")
find_package(sdl2-mixer)
if (NOT TARGET SDL2::SDL2_mixer)
message(FATAL_ERROR
"You need the sdl2-mixer development library \
to be able to compile with sound enabled. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif()
else()
message(STATUS "Searching for SDL2_mixer library --")
find_package(SDL2_mixer)
# if (NOT TARGET SDL2_mixer::SDL2_mixer-static) # TODO x64-mingw-static ?
if (NOT SDL2_MIXER_FOUND)
message(FATAL_ERROR
"You need the SDL2_mixer development library \
to be able to compile with sound enabled. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif()
endif()
message(STATUS "Searching for SDL2_mixer library --")
find_package(SDL2_mixer)
if (NOT SDL2_MIXER_FOUND)
message(FATAL_ERROR
"You need the SDL2_mixer development library \
to be able to compile with sound enabled. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
endif ()
if (BACKTRACE)
add_definitions(-DBACKTRACE)
if (LIBBACKTRACE)
add_definitions(-DLIBBACKTRACE)
endif ()
endif ()
if ((LOCALIZE OR BUILD_TESTING) AND "${GETTEXT_MSGFMT_BINARY}" STREQUAL "")
if(MSVC)
list(APPEND Gettext_ROOT C:\\msys64\\usr)
list(APPEND Gettext_ROOT C:\\Program\ Files\\Git\\usr)
endif(MSVC)
find_package(Gettext)
endif ()
if (NOT GETTEXT_MSGFMT_EXECUTABLE )
set(GETTEXT_MSGFMT_EXECUTABLE "${GETTEXT_MSGFMT_BINARY}")
endif()
endif (LIBBACKTRACE)
endif (BACKTRACE)
# Ok. Now create build and install recipes
if (LOCALIZE)
if (NOT _OS_LINUX_) # on Linux with glibc, libintl is not required
find_package(Libintl)
if (NOT LIBINTL_FOUND)
message(FATAL_ERROR
"You need the libintl development library \
to be able to compile with LOCALIZE support. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
endif()
find_package(Iconv)
if (NOT ICONV_FOUND)
message(FATAL_ERROR
"You need the iconv development library \
to be able to compile with LOCALIZE support. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
add_subdirectory(lang)
add_definitions(-DLOCALIZE)
endif ()
@@ -412,47 +359,19 @@ if (USE_HOME_DIR)
add_definitions(-DUSE_HOME_DIR)
endif ()
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND AND CATA_CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ccache)
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
set(CMAKE_C_LINKER_LAUNCHER ccache)
set(CMAKE_CXX_LINKER_LAUNCHER ccache)
endif ()
add_subdirectory(src)
add_subdirectory(data)
if (NOT MSVC)
add_subdirectory(src/chkjson)
endif()
if(TESTS)
add_subdirectory(tests)
endif()
add_subdirectory(tests)
if (JSON_FORMAT)
add_subdirectory(tools/format)
endif()
if (CATA_CLANG_TIDY_PLUGIN OR CATA_CLANG_TIDY_EXECUTABLE)
if (CATA_CLANG_TIDY_PLUGIN)
add_subdirectory(tools/clang-tidy-plugin)
endif()
install(DIRECTORY doc gfx
DESTINATION ${DATA_PREFIX}
)
if (RELEASE)
install(FILES
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/LICENSE.txt
${CMAKE_SOURCE_DIR}/LICENSE-OFL-Terminus-Font.txt
${CMAKE_SOURCE_DIR}/VERSION.txt
DESTINATION ${README_DIR})
if (TILES)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/gfx DESTINATION ${DATA_PREFIX})
endif()
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@@ -462,3 +381,9 @@ add_custom_target(uninstall
"${CMAKE_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND AND CATA_CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif ()
+160
View File
@@ -0,0 +1,160 @@
#.rst:
# CMakeParseArguments
# -------------------
#
#
#
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords>
# <multi_value_keywords> args...)
#
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions
# for parsing the arguments given to that macro or function. It
# processes the arguments and defines a set of variables which hold the
# values of the respective options.
#
# The <options> argument contains all options for the respective macro,
# i.e. keywords which can be used when calling the macro without any
# value following, like e.g. the OPTIONAL keyword of the install()
# command.
#
# The <one_value_keywords> argument contains all keywords for this macro
# which are followed by one value, like e.g. DESTINATION keyword of the
# install() command.
#
# The <multi_value_keywords> argument contains all keywords for this
# macro which can be followed by more than one value, like e.g. the
# TARGETS or FILES keywords of the install() command.
#
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
# keywords listed in <options>, <one_value_keywords> and
# <multi_value_keywords> a variable composed of the given <prefix>
# followed by "_" and the name of the respective keyword. These
# variables will then hold the respective value from the argument list.
# For the <options> keywords this will be TRUE or FALSE.
#
# All remaining arguments are collected in a variable
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see
# whether your macro was called with unrecognized parameters.
#
# As an example here a my_install() macro, which takes similar arguments
# as the real install() command:
#
# ::
#
# function(MY_INSTALL)
# set(options OPTIONAL FAST)
# set(oneValueArgs DESTINATION RENAME)
# set(multiValueArgs TARGETS CONFIGURATIONS)
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
# ...
#
#
#
# Assume my_install() has been called like this:
#
# ::
#
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
#
#
#
# After the cmake_parse_arguments() call the macro will have set the
# following variables:
#
# ::
#
# MY_INSTALL_OPTIONAL = TRUE
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
# MY_INSTALL_DESTINATION = "bin"
# MY_INSTALL_RENAME = "" (was not used)
# MY_INSTALL_TARGETS = "foo;bar"
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
#
#
#
# You can then continue and process these variables.
#
# Keywords terminate lists of values, e.g. if directly after a
# one_value_keyword another recognized keyword follows, this is
# interpreted as the beginning of the new option. E.g.
# my_install(TARGETS foo DESTINATION OPTIONAL) would result in
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION
# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
#=============================================================================
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
return()
endif()
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
# first set all result variables to empty/FALSE
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
set(${prefix}_${arg_name})
endforeach()
foreach(option ${_optionNames})
set(${prefix}_${option} FALSE)
endforeach()
set(${prefix}_UNPARSED_ARGUMENTS)
set(insideValues FALSE)
set(currentArgName)
# now iterate over all arguments and fill the result variables
foreach(currentArg ${ARGN})
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
if(insideValues)
if("${insideValues}" STREQUAL "SINGLE")
set(${prefix}_${currentArgName} ${currentArg})
set(insideValues FALSE)
elseif("${insideValues}" STREQUAL "MULTI")
list(APPEND ${prefix}_${currentArgName} ${currentArg})
endif()
else()
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
endif()
else()
if(NOT ${optionIndex} EQUAL -1)
set(${prefix}_${currentArg} TRUE)
set(insideValues FALSE)
elseif(NOT ${singleArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "SINGLE")
elseif(NOT ${multiArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "MULTI")
endif()
endif()
endforeach()
# propagate the result variables to the caller:
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
endforeach()
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
endfunction()
+78
View File
@@ -0,0 +1,78 @@
#.rst:
# CheckLibraryExists
# ------------------
#
# Check if the function exists.
#
# CHECK_LIBRARY_EXISTS (LIBRARY FUNCTION LOCATION VARIABLE)
#
# ::
#
# LIBRARY - the name of the library you are looking for
# FUNCTION - the name of the function
# LOCATION - location where the library should be found
# VARIABLE - variable to store the result
#
#
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
#
# ::
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
if(${VARIABLE} MATCHES "^${VARIABLE}$")
set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_LIBRARY_EXISTS_LIBRARIES
${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES})
endif()
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckFunctionExists.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
-DLINK_DIRECTORIES:STRING=${LOCATION}
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
"passed with the following output:\n"
"${OUTPUT}\n\n")
else()
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
"failed with the following output:\n"
"${OUTPUT}\n\n")
endif()
endif()
endmacro()
+198
View File
@@ -0,0 +1,198 @@
#.rst:
# FindCurses
# ----------
#
# Find the curses include file and library
#
#
#
# ::
#
# CURSES_FOUND - system has Curses
# CURSES_INCLUDE_DIR - the Curses include directory
# CURSES_LIBRARIES - The libraries needed to use Curses
# CURSES_HAVE_CURSES_H - true if curses.h is available
# CURSES_HAVE_NCURSES_H - true if ncurses.h is available
# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available
# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available
# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake
#
#
#
# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if
# NCurses functionality is required.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_library(CURSES_CURSES_LIBRARY NAMES curses )
find_library(CURSES_NCURSES_LIBRARY NAMES ncurses )
set(CURSES_USE_NCURSES FALSE)
if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
set(CURSES_USE_NCURSES TRUE)
endif()
# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
# cygwin ncurses stopped providing curses.h symlinks see above
# message. Cygwin is an ncurses package, so force ncurses on
# cygwin if the curses.h is missing
if(CYGWIN)
if(NOT EXISTS /usr/include/curses.h)
set(CURSES_USE_NCURSES TRUE)
endif()
endif()
# Not sure the logic is correct here.
# If NCurses is required, use the function wsyncup() to check if the library
# has NCurses functionality (at least this is where it breaks on NetBSD).
# If wsyncup is in curses, use this one.
# If not, try to find ncurses and check if this has the symbol.
# Once the ncurses library is found, search the ncurses.h header first, but
# some web pages also say that even with ncurses there is not always a ncurses.h:
# http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html
# So at first try ncurses.h, if not found, try to find curses.h under the same
# prefix as the library was found, if still not found, try curses.h with the
# default search paths.
if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
if( CURSES_NCURSES_HAS_WSYNCUP)
set(CURSES_USE_NCURSES TRUE)
endif()
endif()
endif()
if(NOT CURSES_USE_NCURSES)
find_file(CURSES_HAVE_CURSES_H curses.h )
find_path(CURSES_CURSES_H_PATH curses.h )
get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
# for compatibility with older FindCurses.cmake this has to be in the cache
# FORCE must not be used since this would break builds which preload a cache with these variables set
set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}"
CACHE FILEPATH "The curses include path")
set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}"
CACHE FILEPATH "The curses library")
else()
# we need to find ncurses
get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
find_file(CURSES_HAVE_NCURSES_H ncurses.h)
find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h)
find_file(CURSES_HAVE_CURSES_H curses.h
HINTS "${_cursesParentDir}/include")
find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h
ncurses/curses.h)
find_path(CURSES_NCURSES_INCLUDE_PATH curses.h
HINTS "${_cursesParentDir}/include")
# for compatibility with older FindCurses.cmake this has to be in the cache
# FORCE must not be used since this would break builds which preload
# however if the value of the variable has NOTFOUND in it, then
# it is OK to force, and we need to force in order to have it work.
# a cache with these variables set
# only put ncurses include and library into
# variables if they are found
if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H)
get_filename_component(CURSES_NCURSES_INCLUDE_PATH
"${CURSES_HAVE_NCURSES_NCURSES_H}" PATH)
endif()
if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
set( FORCE_IT )
if(CURSES_INCLUDE_PATH MATCHES NOTFOUND)
set(FORCE_IT FORCE)
endif()
set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}"
CACHE FILEPATH "The curses include path" ${FORCE_IT})
set( FORCE_IT)
if(CURSES_LIBRARY MATCHES NOTFOUND)
set(FORCE_IT FORCE)
endif()
set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}"
CACHE FILEPATH "The curses library" ${FORCE_IT})
endif()
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
cbreak "" CURSES_NCURSES_HAS_CBREAK)
if(NOT CURSES_NCURSES_HAS_CBREAK)
find_library(CURSES_EXTRA_LIBRARY tinfo HINTS "${_cursesLibDir}")
find_library(CURSES_EXTRA_LIBRARY tinfo )
CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}"
cbreak "" CURSES_TINFO_HAS_CBREAK)
endif()
endif()
if (NOT CURSES_TINFO_HAS_CBREAK)
find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}")
find_library(CURSES_EXTRA_LIBRARY cur_colr )
endif()
find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
find_library(CURSES_FORM_LIBRARY form )
# for compatibility with older FindCurses.cmake this has to be in the cache
# FORCE must not be used since this would break builds which preload a cache
# with these variables set
set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}"
CACHE FILEPATH "The curses form library")
# Need to provide the *_LIBRARIES
set(CURSES_LIBRARIES ${CURSES_LIBRARY})
if(CURSES_EXTRA_LIBRARY)
set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY})
endif()
if(CURSES_FORM_LIBRARY)
set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
endif()
# Proper name is *_INCLUDE_DIR
set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
CURSES_LIBRARY CURSES_INCLUDE_PATH)
mark_as_advanced(
CURSES_INCLUDE_PATH
CURSES_LIBRARY
CURSES_CURSES_INCLUDE_PATH
CURSES_CURSES_LIBRARY
CURSES_NCURSES_INCLUDE_PATH
CURSES_NCURSES_LIBRARY
CURSES_EXTRA_LIBRARY
FORM_LIBRARY
CURSES_LIBRARIES
CURSES_INCLUDE_DIR
CURSES_CURSES_HAS_WSYNCUP
CURSES_NCURSES_HAS_WSYNCUP
CURSES_NCURSES_HAS_CBREAK
CURSES_TINFO_HAS_CBREAK
)
@@ -0,0 +1,351 @@
#.rst:
# FindPackageHandleStandardArgs
# -----------------------------
#
#
#
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... )
#
# This function is intended to be used in FindXXX.cmake modules files.
# It handles the REQUIRED, QUIET and version-related arguments to
# find_package(). It also sets the <packagename>_FOUND variable. The
# package is considered found if all variables <var1>... listed contain
# valid results, e.g. valid filepaths.
#
# There are two modes of this function. The first argument in both
# modes is the name of the Find-module where it is called (in original
# casing).
#
# The first simple mode looks like this:
#
# ::
#
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
#
# If the variables <var1> to <varN> are all valid, then
# <UPPERCASED_NAME>_FOUND will be set to TRUE. If DEFAULT_MSG is given
# as second argument, then the function will generate itself useful
# success and error messages. You can also supply a custom error
# message for the failure case. This is not recommended.
#
# The second mode is more powerful and also supports version checking:
#
# ::
#
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [FOUND_VAR <resultVar>]
# [REQUIRED_VARS <var1>...<varN>]
# [VERSION_VAR <versionvar>]
# [HANDLE_COMPONENTS]
# [CONFIG_MODE]
# [FAIL_MESSAGE "Custom failure message"] )
#
#
#
# In this mode, the name of the result-variable can be set either to
# either <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the
# FOUND_VAR option. Other names for the result-variable are not
# allowed. So for a Find-module named FindFooBar.cmake, the two
# possible names are FooBar_FOUND and FOOBAR_FOUND. It is recommended
# to use the original case version. If the FOUND_VAR option is not
# used, the default is <UPPERCASED_NAME>_FOUND.
#
# As in the simple mode, if <var1> through <varN> are all valid,
# <packagename>_FOUND will be set to TRUE. After REQUIRED_VARS the
# variables which are required for this package are listed. Following
# VERSION_VAR the name of the variable can be specified which holds the
# version of the package which has been found. If this is done, this
# version will be checked against the (potentially) specified required
# version used in the find_package() call. The EXACT keyword is also
# handled. The default messages include information about the required
# version and the version which has been actually found, both if the
# version is ok or not. If the package supports components, use the
# HANDLE_COMPONENTS option to enable handling them. In this case,
# find_package_handle_standard_args() will report which components have
# been found and which are missing, and the <packagename>_FOUND variable
# will be set to FALSE if any of the required components (i.e. not the
# ones listed after OPTIONAL_COMPONENTS) are missing. Use the option
# CONFIG_MODE if your FindXXX.cmake module is a wrapper for a
# find_package(... NO_MODULE) call. In this case VERSION_VAR will be
# set to <NAME>_VERSION and the macro will automatically check whether
# the Config module was found. Via FAIL_MESSAGE a custom failure
# message can be specified, if this is not used, the default message
# will be displayed.
#
# Example for mode 1:
#
# ::
#
# find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
#
#
#
# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to
# TRUE. If it is not found and REQUIRED was used, it fails with
# FATAL_ERROR, independent whether QUIET was used or not. If it is
# found, success will be reported, including the content of <var1>. On
# repeated Cmake runs, the same message won't be printed again.
#
# Example for mode 2:
#
# ::
#
# find_package_handle_standard_args(LibXslt FOUND_VAR LibXslt_FOUND
# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS
# VERSION_VAR LibXslt_VERSION_STRING)
#
# In this case, LibXslt is considered to be found if the variable(s)
# listed after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and
# LibXslt_INCLUDE_DIRS in this case. The result will then be stored in
# LibXslt_FOUND . Also the version of LibXslt will be checked by using
# the version contained in LibXslt_VERSION_STRING. Since no
# FAIL_MESSAGE is given, the default messages will be printed.
#
# Another example for mode 2:
#
# ::
#
# find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
# find_package_handle_standard_args(Automoc4 CONFIG_MODE)
#
# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4
# NO_MODULE) and adds an additional search directory for automoc4. Here
# the result will be stored in AUTOMOC4_FOUND. The following
# FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
# success/error message.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
# internal helper macro
macro(_FPHSA_FAILURE_MESSAGE _msg)
if (${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${_msg}")
else ()
if (NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "${_msg}")
endif ()
endif ()
endmacro()
# internal helper macro to generate the failure message when used in CONFIG_MODE:
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
# <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
if(${_NAME}_CONFIG)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
else()
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
# List them all in the error message:
if(${_NAME}_CONSIDERED_CONFIGS)
set(configsText "")
list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
math(EXPR configsCount "${configsCount} - 1")
foreach(currentConfigIndex RANGE ${configsCount})
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
set(configsText "${configsText} ${filename} (version ${version})\n")
endforeach()
if (${_NAME}_NOT_FOUND_MESSAGE)
set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
else()
# Simple case: No Config-file was found at all:
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
endif()
endif()
endmacro()
function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
# new extended or in the "old" mode:
set(options CONFIG_MODE HANDLE_COMPONENTS)
set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR)
set(multiValueArgs REQUIRED_VARS)
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
if(${INDEX} EQUAL -1)
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
set(FPHSA_REQUIRED_VARS ${ARGN})
set(FPHSA_VERSION_VAR)
else()
CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
if(FPHSA_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
endif()
if(NOT FPHSA_FAIL_MESSAGE)
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
endif()
endif()
# now that we collected all arguments, process them
if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
endif()
# In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
# when it successfully found the config-file, including version checking:
if(FPHSA_CONFIG_MODE)
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
endif()
if(NOT FPHSA_REQUIRED_VARS)
message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
endif()
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
string(TOUPPER ${_NAME} _NAME_UPPER)
string(TOLOWER ${_NAME} _NAME_LOWER)
if(FPHSA_FOUND_VAR)
if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
else()
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
endif()
else()
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
endif()
# collect all variables which were not found, so they can be printed, so the
# user knows better what went wrong (#6375)
set(MISSING_VARS "")
set(DETAILS "")
# check if all passed variables are valid
unset(${_FOUND_VAR})
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR})
set(${_FOUND_VAR} FALSE)
set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
else()
set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
endif()
endforeach()
if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE")
set(${_FOUND_VAR} TRUE)
endif()
# component handling
unset(FOUND_COMPONENTS_MSG)
unset(MISSING_COMPONENTS_MSG)
if(FPHSA_HANDLE_COMPONENTS)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(${_NAME}_${comp}_FOUND)
if(NOT DEFINED FOUND_COMPONENTS_MSG)
set(FOUND_COMPONENTS_MSG "found components: ")
endif()
set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}")
else()
if(NOT DEFINED MISSING_COMPONENTS_MSG)
set(MISSING_COMPONENTS_MSG "missing components: ")
endif()
set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_FOUND_VAR} FALSE)
set(MISSING_VARS "${MISSING_VARS} ${comp}")
endif()
endif()
endforeach()
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]")
endif()
# version handling:
set(VERSION_MSG "")
set(VERSION_OK TRUE)
set(VERSION ${${FPHSA_VERSION_VAR}} )
if (${_NAME}_FIND_VERSION)
if(VERSION)
if(${_NAME}_FIND_VERSION_EXACT) # exact version required
if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
endif ()
else() # minimum version specified:
if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")")
endif ()
endif()
else()
# if the package was not found, but a version was given, add that to the output:
if(${_NAME}_FIND_VERSION_EXACT)
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
else()
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
endif()
endif()
else ()
if(VERSION)
set(VERSION_MSG "(found version \"${VERSION}\")")
endif()
endif ()
if(VERSION_OK)
set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
else()
set(${_FOUND_VAR} FALSE)
endif()
# print the result:
if (${_FOUND_VAR})
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
else ()
if(FPHSA_CONFIG_MODE)
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
else()
if(NOT VERSION_OK)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
else()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
endif()
endif()
endif ()
set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE)
endfunction()
+57
View File
@@ -0,0 +1,57 @@
#.rst:
# FindPackageMessage
# ------------------
#
#
#
# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
#
# This macro is intended to be used in FindXXX.cmake modules files. It
# will print a message once for each unique find result. This is useful
# for telling the user where a package was found. The first argument
# specifies the name (XXX) of the package. The second argument
# specifies the message to display. The third argument lists details
# about the find result so that if they change the message will be
# displayed again. The macro also obeys the QUIET argument to the
# find_package command.
#
# Example:
#
# ::
#
# if(X11_FOUND)
# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
# else()
# ...
# endif()
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
function(FIND_PACKAGE_MESSAGE pkg msg details)
# Avoid printing a message repeatedly for the same find result.
if(NOT ${pkg}_FIND_QUIETLY)
string(REGEX REPLACE "[\n]" "" details "${details}")
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed.
message(STATUS "${msg}")
# Save the find details in the cache to avoid printing the same
# message again.
set("${DETAILS_VAR}" "${details}"
CACHE INTERNAL "Details about finding ${pkg}")
endif()
endif()
endfunction()
-71
View File
@@ -1,71 +0,0 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"description": "Base Build Configuration",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"hidden": true
},
{
"name": "windows",
"description": "Windows Build Configuration",
"condition": {
"type": "allOf",
"conditions": [
{
"type": "equals",
"lhs": "$env{MSYSTEM}",
"rhs": ""
},
{
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
]
},
"cacheVariables": {
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/build-scripts"
},
"hidden": true
},
{
"name": "MSVC",
"inherits": [ "windows" ],
"description": "Visual C++ Configuration",
"toolchainFile": "${sourceDir}/build-scripts/MSVC.cmake",
"cacheVariables": {
"VCPKG_ROOT": "C:/vcpkg"
},
"hidden": true
},
{
"name": "x64-windows-static",
"inherits": [ "base", "MSVC" ],
"description": "Link Statically",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
"DYNAMIC_LINKING": "False"
},
"hidden": true
},
{
"name": "windows-tiles-sounds-x64-msvc",
"inherits": [ "x64-windows-static" ],
"displayName": "Windows Tiles Sounds x64 MSVC",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (RelWithDebInfo)",
"cacheVariables": {
"CMAKE_PROJECT_INCLUDE_BEFORE": "${sourceDir}/build-scripts/windows-tiles-sounds-x64-msvc.cmake",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"RELEASE": "True",
"CURSES": "False",
"LOCALIZE": "True",
"TILES": "True",
"SOUND": "True",
"TESTS": "False"
}
}
]
}
+304
View File
@@ -0,0 +1,304 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Cataclysm" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-O2" />
<Add option="-DRELEASE=1" />
</Compiler>
</Target>
<Target title="Release (Localized)">
<Option output="CataclysmWin" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/ReleaseLocalized/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-O2" />
<Add option="-DLOCALIZE=1" />
<Add option="-DRELEASE=1" />
<Add directory="WinDepend/include" />
</Compiler>
<Linker>
<Add library="libintl.dll.a" />
<Add library="libiconv.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Release (SDL)">
<Option output="Cataclysm-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/ReleaseSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-O2" />
<Add option="-DTILES=1" />
<Add option="-DRELEASE=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Release (SDL, Sound)">
<Option output="Cataclysm-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/ReleaseSoundSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-O2" />
<Add option="-DTILES=1" />
<Add option="-DSDL_SOUND=1" />
<Add option="-DRELEASE=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add library="libSDL2_mixer.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Release (SDL, Localized)">
<Option output="Cataclysm-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/ReleaseLocalizedSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-O2" />
<Add option="-DLOCALIZE=1" />
<Add option="-DTILES=1" />
<Add option="-DRELEASE=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add library="libintl.dll.a" />
<Add library="libiconv.dll.a" />
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Release (SDL, Loc, Sound)">
<Option output="Cataclysm-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/ReleaseLocalizedSoundSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-O2" />
<Add option="-DLOCALIZE=1" />
<Add option="-DTILES=1" />
<Add option="-DSDL_SOUND=1" />
<Add option="-DRELEASE=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add library="libintl.dll.a" />
<Add library="libiconv.dll.a" />
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add library="libSDL2_mixer.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Debug">
<Option output="CataclysmWin" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-pg -g" />
</Compiler>
<Linker>
<Add option="-pg -lgmon" />
</Linker>
</Target>
<Target title="Debug (Localized)">
<Option output="CataclysmWin" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/DebugLocalized/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-pg" />
<Add option="-g" />
<Add option="-DLOCALIZE=1" />
<Add directory="WinDepend/include" />
</Compiler>
<Linker>
<Add option="-pg" />
<Add option="-lgmon" />
<Add library="libintl.dll.a" />
<Add library="libiconv.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Debug (SDL)">
<Option output="CataclysmWin-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/DebugSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-pg" />
<Add option="-g" />
<Add option="-DTILES=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add option="-pg" />
<Add option="-lgmon" />
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Debug (SDL, Sound)">
<Option output="Cataclysm-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/DebugSoundSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-pg" />
<Add option="-g" />
<Add option="-DTILES=1" />
<Add option="-DSDL_SOUND=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add option="-pg" />
<Add option="-lgmon" />
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add library="libSDL2_mixer.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Debug (SDL, Localized)">
<Option output="CataclysmWin-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/DebugLocalizedSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-pg" />
<Add option="-g" />
<Add option="-DLOCALIZE=1" />
<Add option="-DTILES=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add option="-pg" />
<Add option="-lgmon" />
<Add library="libintl.dll.a" />
<Add library="libiconv.dll.a" />
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
<Target title="Debug (SDL, Loc, Sound)">
<Option output="Cataclysm-Tiles" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/DebugLocalizedSoundSDL/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-pg" />
<Add option="-g" />
<Add option="-DLOCALIZE=1" />
<Add option="-DTILES=1" />
<Add option="-DSDL_SOUND=1" />
<Add directory="WinDepend/include" />
<Add directory="WinDepend/include/SDL2" />
</Compiler>
<Linker>
<Add option="-pg" />
<Add option="-lgmon" />
<Add library="libintl.dll.a" />
<Add library="libiconv.dll.a" />
<Add library="libSDL2.dll.a" />
<Add library="libSDL2main.a" />
<Add library="libSDL2_ttf.dll.a" />
<Add library="libSDL2_image.dll.a" />
<Add library="libSDL2_mixer.dll.a" />
<Add directory="WinDepend/lib" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wextra" />
<Add option="-Wall" />
<Add option="-std=c++14" />
<Add option="-DCB_BUILD" />
<Add option="-D_WINDOWS" />
<Add option="-D_MINGW" />
<Add option="-D_WIN32" />
<Add option="-D__MINGW__" />
</Compiler>
<Linker>
<Add option="-Wl,-stack,12000000,-subsystem,windows" />
<Add option="-static" />
<Add library="gdi32" />
<Add library="winmm" />
</Linker>
<ExtraCommands>
<Add before="cmd /c git --version || echo &apos;git&apos; command not found!" />
<Add before="cmd /c git describe --tags --always --dirty &gt; version.tmp || echo no-git&gt; version.tmp" />
<Add before='cmd /c for /F &quot;tokens=*&quot; %%i in (version.tmp) do echo #define VERSION &quot;%%i&quot; &gt; src/version.h' />
<Add before="cmd /c del version.tmp" />
<Mode after="always" />
</ExtraCommands>
<UnitsGlob directory="src" recursive="0" />
<Unit filename="src/resource.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Extensions>
<code_completion />
<debugger />
<envvars />
<DoxyBlocks>
<comment_style block="0" line="0" />
<doxyfile_project />
<doxyfile_build />
<doxyfile_warnings />
<doxyfile_output />
<doxyfile_dot />
<general />
</DoxyBlocks>
</Extensions>
</Project>
</CodeBlocks_project_file>
-3
View File
@@ -1,9 +1,6 @@
Copyright (c) 2019 Dimitar Toshkov Zhekov,
with Reserved Font Name "Terminus Font".
Copyright (c) 2017 tisimst
with Reserved Font Name "Vecterminus"
Copyright (c) 2011 Tilman Blumenbach,
with Reserved Font Name "Terminus (TTF)".
+1 -3
View File
@@ -4,15 +4,13 @@ GNU Unifont (data/font/unifont.ttf) is licensed under GNU General Public License
Terminus Font (data/font/terminus.ttf) is licensed under the SIL Open Font License (see LICENSE-OFL-Terminus-Font.txt).
Vecterminus Font (data/font/VecTerminus12Medium.otf) is licensed under the SIL Open Font License (see LICENSE-OFL-Terminus-Font.txt).
CATCH unit-test framework (tests/catch/catch.hpp) is licensed under the Boost Software License. Visit https://github.com/philsquared/Catch/blob/master/LICENSE.txt to read the license.
PLF List and PLF Colony (src/list.h, src/colony.h) are licensed under the zLib license (https://www.zlib.net/zlib_license.html).
getpost (tools/json_tools/format/getpost.h) is licensed under the MIT license, see file for text of license.
gulrak filesystem (src/third-party/ghc/*) is licensed under the MIT license, see file for text of license.
libintl-lite is licensed under Boost Software License 1.0. Visit https://www.boost.org/users/license.html to read the license.
libbacktrace is licensed under a BSD license (https://github.com/ianlancetaylor/libbacktrace/blob/master/LICENSE). The full license text is as follows:
+139 -186
View File
@@ -21,8 +21,9 @@
# Win32 (non-Cygwin)
# Run: make NATIVE=win32
# OS X
# Run: make NATIVE=osx OSX_MIN=10.13
# The minimum OSX_MIN version supported is 10.13
# Run: make NATIVE=osx OSX_MIN=10.12
# It is highly recommended to supply OSX_MIN > 10.11
# otherwise optimizations are automatically disabled with -O0
# Build types:
# Debug (no optimizations)
@@ -39,15 +40,21 @@
# make LOCALIZE=0
# Disable backtrace support, not available on all platforms
# make BACKTRACE=0
# Use libbacktrace. Only has effect if BACKTRACE=1. (currently only for MinGW and Linux builds)
# Use libbacktrace. Only has effect if BACKTRACE=1. (currently only for MinGW builds)
# make LIBBACKTRACE=1
# Compile localization files for specified languages
# make localization LANGUAGES="<lang_id_1>[ lang_id_2][ ...]"
# (for example: make LANGUAGES="zh_CN zh_TW" for Chinese)
# make localization LANGUAGES=all
# (for every .po file in lang/po)
# Special note for MinGW: due to a libintl bug (https://savannah.gnu.org/bugs/index.php?58006),
# using English without a `.mo` file would cause significant slow down on MinGW
# targets. In such case you can compile a `.mo` file for English using `make LANGUAGES="en"`.
# `make LANGUAGE="all"` also compiles a `.mo` file for English in addition to other languages.
# Enable sanitizer (address, undefined, etc.)
# make SANITIZE=address
# Change mapsize (reality bubble size)
# make MAPSIZE=<size>
# Enable the string id debugging helper
# make STRING_ID_DEBUG=1
# Adjust names of build artifacts (for example to allow easily toggling between build types).
@@ -67,28 +74,22 @@
# make DYNAMIC_LINKING=1
# Use MSYS2 as the build environment on Windows
# make MSYS2=1
# Turn off all optimizations, even debug-friendly optimizations. Overridden by RELEASE=1
# Turn off all optimizations, even debug-friendly optimizations
# make NOOPT=1
# Astyle all source files.
# make astyle
# Astyle all source files as fast as possible.
# make astyle-fast
# Check if source files are styled properly.
# make astyle-check
# Style the whitelisted json files (maintain the current level of styling).
# make style-json
# Style all json files using the current rules (don't PR this, it's too many changes at once).
# make style-all-json
# Style all json files in parallel using all available CPU cores (don't make -jX on this, just make)
# make style-all-json-parallel
# Disable astyle of source files.
# make ASTYLE=0
# make ASTYLE=0
# Disable format check of whitelisted json files.
# make LINTJSON=0
# make LINTJSON=0
# Disable building and running tests.
# make RUNTESTS=0
# Build source files in order of how often the matching header is included
# make HEADERPOPULARITY=1
# make RUNTESTS=0
# comment these to toggle them as one sees fit.
# DEBUG is best turned on if you plan to debug in gdb -- please do!
@@ -182,14 +183,6 @@ ifndef PCH
PCH = 1
endif
ifndef GOLD
ifeq ($(LTO), 1)
GOLD = 1
else
GOLD = 0
endif
endif
# Auto-detect MSYS2
ifdef MSYSTEM
MSYS2 = 1
@@ -199,13 +192,6 @@ ifneq (,$(findstring clang,$(COMPILER)))
CLANG = $(COMPILER)
endif
# Windows sets the OS environment variable so we can cheaply test for it.
ifneq (,$(findstring Windows_NT,$(OS)))
IS_WINDOWS_HOST = 1
else
IS_WINDOWS_HOST = 0
endif
OS = $(shell uname -s)
ifneq ($(findstring Darwin,$(OS)),)
@@ -262,7 +248,7 @@ W32ODIR = $(BUILD_PREFIX)objwin
W32ODIRTILES = $(W32ODIR)/tiles
ifdef AUTO_BUILD_PREFIX
BUILD_PREFIX = $(if $(RELEASE),release-)$(if $(DEBUG_SYMBOLS),symbol-)$(if $(TILES),tiles-)$(if $(SOUND),sound-)$(if $(LOCALIZE),local-)$(if $(BACKTRACE),back-$(if $(LIBBACKTRACE),libbacktrace-))$(if $(SANITIZE),sanitize-)$(if $(USE_XDG_DIR),xdg-)$(if $(USE_HOME_DIR),home-)$(if $(DYNAMIC_LINKING),dynamic-)$(if $(MSYS2),msys2-)
BUILD_PREFIX = $(if $(RELEASE),release-)$(if $(DEBUG_SYMBOLS),symbol-)$(if $(TILES),tiles-)$(if $(SOUND),sound-)$(if $(LOCALIZE),local-)$(if $(BACKTRACE),back-$(if $(LIBBACKTRACE),libbacktrace-))$(if $(SANITIZE),sanitize-)$(if $(MAPSIZE),map-$(MAPSIZE)-)$(if $(USE_XDG_DIR),xdg-)$(if $(USE_HOME_DIR),home-)$(if $(DYNAMIC_LINKING),dynamic-)$(if $(MSYS2),msys2-)
export BUILD_PREFIX
endif
@@ -272,7 +258,7 @@ ifneq ($(findstring BSD,$(OS)),)
endif
ifeq ($(PCH), 1)
CCACHEBIN = CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_ctime,include_file_mtime ccache
CCACHEBIN = CCACHE_SLOPPINESS=pch_defines,time_macros ccache
else
CCACHEBIN = ccache
endif
@@ -299,7 +285,11 @@ ifneq ($(CLANG), 0)
endif
ifdef USE_LIBCXX
OTHERS += -stdlib=libc++
LDFLAGS += -stdlib=libc++ -Wno-unused-command-line-argument
LDFLAGS += -stdlib=libc++
else
# clang with glibc 2.31+ will cause linking error on math functions
# this is a workaround (see https://github.com/google/filament/issues/2146)
CXXFLAGS += -fno-builtin
endif
ifeq ($(CCACHE), 1)
CXX = CCACHE_CPP2=1 $(CCACHEBIN) $(CROSS)$(CLANGCMD)
@@ -337,6 +327,8 @@ STRIP = $(CROSS)strip
RC = $(CROSS)windres
AR = $(CROSS)ar
# We don't need scientific precision for our math functions, this lets them run much faster.
CXXFLAGS += -ffast-math
LDFLAGS += $(PROFILE)
ifneq ($(SANITIZE),)
@@ -378,9 +370,7 @@ ifeq ($(RELEASE), 1)
LTOFLAGS += -flto=full
endif
else
ifeq ($(GOLD), 1)
LDFLAGS += -fuse-ld=gold # This breaks in OS X because gold can only produce ELF binaries, not Mach
endif
LDFLAGS += -fuse-ld=gold # This breaks in OS X because gold can only produce ELF binaries, not Mach
endif
ifneq ($(CLANG), 0)
@@ -399,11 +389,7 @@ ifeq ($(RELEASE), 1)
OTHERS += $(RELEASE_FLAGS)
DEBUG =
ifndef DEBUG_SYMBOLS
ifeq ($(LIBBACKTRACE), 1)
DEBUGSYMS = -g1
else
DEBUGSYMS =
endif
DEBUGSYMS =
endif
DEFINES += -DRELEASE
# Check for astyle or JSON regressions on release builds.
@@ -431,9 +417,9 @@ else
endif
ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Cygwin)
OTHERS += -std=gnu++17
OTHERS += -std=gnu++14
else
OTHERS += -std=c++17
OTHERS += -std=c++14
endif
ifeq ($(CYGWIN),1)
@@ -441,11 +427,11 @@ WARNINGS += -Wimplicit-fallthrough=0
endif
ifeq ($(PCH), 1)
PCHFLAGS = -Winvalid-pch
PCHFLAGS = -Ipch -Winvalid-pch
PCH_H = pch/main-pch.hpp
ifeq ($(CLANG), 0)
PCHFLAGS += -include pch/main-pch.hpp
PCHFLAGS += -fpch-preprocess -include main-pch.hpp
PCH_P = $(PCH_H).gch
else
PCH_P = $(PCH_H).pch
@@ -469,8 +455,7 @@ ifeq ($(PCH), 1)
endif
endif
CPPFLAGS += -Isrc -isystem ${SRC_DIR}/third-party
CXXFLAGS += $(WARNINGS) $(DEBUG) $(DEBUGSYMS) $(PROFILE) $(OTHERS)
CXXFLAGS += $(WARNINGS) $(DEBUG) $(DEBUGSYMS) $(PROFILE) $(OTHERS) -MMD -MP
TOOL_CXXFLAGS = -DCATA_IN_TOOL
BINDIST_EXTRAS += README.md data doc LICENSE.txt LICENSE-OFL-Terminus-Font.txt VERSION.txt $(JSON_FORMATTER_BIN)
@@ -497,28 +482,20 @@ ifeq ($(NATIVE), linux64)
CXXFLAGS += -m64
LDFLAGS += -m64
TARGETSYSTEM=LINUX
ifeq ($(GOLD), 1)
ifdef GOLD
CXXFLAGS += -fuse-ld=gold
LDFLAGS += -fuse-ld=gold -Wl,--detect-odr-violations
endif
ifeq ($(MOLD), 1)
CXXFLAGS += -fuse-ld=mold
LDFLAGS += -fuse-ld=mold
endif
else
# Linux 32-bit
ifeq ($(NATIVE), linux32)
CXXFLAGS += -m32
LDFLAGS += -m32
TARGETSYSTEM=LINUX
ifeq ($(GOLD), 1)
ifdef GOLD
CXXFLAGS += -fuse-ld=gold
LDFLAGS += -fuse-ld=gold -Wl,--detect-odr-violations
endif
ifeq ($(MOLD), 1)
CXXFLAGS += -fuse-ld=mold
LDFLAGS += -fuse-ld=mold
endif
endif
endif
@@ -543,11 +520,7 @@ ifeq ($(NATIVE), osx)
endif
DEFINES += -DMACOSX
CXXFLAGS += -mmacosx-version-min=$(OSX_MIN)
LDFLAGS += -mmacosx-version-min=$(OSX_MIN) -framework CoreFoundation -Wl,-headerpad_max_install_names
ifeq ($(ARCH),arm64)
CXXFLAGS += -arch arm64
LDFLAGS += -arch arm64
endif
LDFLAGS += -mmacosx-version-min=$(OSX_MIN) -framework CoreFoundation
ifdef FRAMEWORK
ifeq ($(FRAMEWORKSDIR),)
FRAMEWORKSDIR := $(strip $(if $(shell [ -d $(HOME)/Library/Frameworks ] && echo 1), \
@@ -563,6 +536,22 @@ ifeq ($(NATIVE), osx)
endif
endif
ifeq ($(LOCALIZE), 1)
LDFLAGS += -lintl
ifdef OSXCROSS
LDFLAGS += -L$(LIBSDIR)/gettext/lib
CXXFLAGS += -I$(LIBSDIR)/gettext/include
endif
# link to gettext from Homebrew if it exists
# Homebrew may be installed in /usr/local or /opt/homebrew
ifneq ("$(wildcard /usr/local/opt/gettext)", "")
LDFLAGS += -L/usr/local/opt/gettext/lib
CXXFLAGS += -I/usr/local/opt/gettext/include
else
ifneq ("$(wildcard /opt/homebrew/opt/gettext)", "")
LDFLAGS += -L/opt/homebrew/opt/gettext/lib
CXXFLAGS += -I/opt/homebrew/opt/gettext/include
endif
endif
ifeq ($(MACPORTS), 1)
ifneq ($(TILES), 1)
CXXFLAGS += -I$(shell ncursesw6-config --includedir)
@@ -611,7 +600,6 @@ endif
# Global settings for Windows targets
ifeq ($(TARGETSYSTEM),WINDOWS)
DEFINES += -DWIN32_LEAN_AND_MEAN
CHKJSON_BIN = chkjson.exe
TARGET = $(W32TARGET)
BINDIST = $(W32BINDIST)
@@ -623,6 +611,9 @@ ifeq ($(TARGETSYSTEM),WINDOWS)
else
LDFLAGS += -static
endif
ifeq ($(LOCALIZE), 1)
LDFLAGS += -lintl -liconv
endif
W32FLAGS += -Wl,-stack,12000000,-subsystem,windows
RFLAGS = -J rc -O coff
ifeq ($(NATIVE), win64)
@@ -630,6 +621,10 @@ ifeq ($(TARGETSYSTEM),WINDOWS)
endif
endif
ifdef MAPSIZE
CXXFLAGS += -DMAPSIZE=$(MAPSIZE)
endif
ifeq ($(shell git rev-parse --is-inside-work-tree),true)
# We have a git repository, use git version
DEFINES += -DGIT_VERSION
@@ -642,7 +637,11 @@ ifeq ($(SOUND), 1)
$(error "SOUND=1 only works with TILES=1")
endif
ifeq ($(NATIVE),osx)
ifndef FRAMEWORK # libsdl build
ifdef FRAMEWORK
CXXFLAGS += -I$(FRAMEWORKSDIR)/SDL2_mixer.framework/Headers
LDFLAGS += -F$(FRAMEWORKSDIR)/SDL2_mixer.framework/Frameworks \
-framework SDL2_mixer -framework Vorbis -framework Ogg
else # libsdl build
ifeq ($(MACPORTS), 1)
LDFLAGS += -lSDL2_mixer -lvorbisfile -lvorbis -logg
else # homebrew
@@ -677,12 +676,12 @@ ifeq ($(TILES), 1)
-I$(FRAMEWORKSDIR)/SDL2.framework/Headers \
-I$(FRAMEWORKSDIR)/SDL2_image.framework/Headers \
-I$(FRAMEWORKSDIR)/SDL2_ttf.framework/Headers
ifeq ($(SOUND), 1)
ifdef SOUND
OSX_INC += -I$(FRAMEWORKSDIR)/SDL2_mixer.framework/Headers
endif
LDFLAGS += -F$(FRAMEWORKSDIR) \
-framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework Cocoa
ifeq ($(SOUND), 1)
ifdef SOUND
LDFLAGS += -framework SDL2_mixer
endif
CXXFLAGS += $(OSX_INC)
@@ -693,7 +692,7 @@ ifeq ($(TILES), 1)
-I$(shell dirname $(shell sdl2-config --cflags | sed 's/-I\(.[^ ]*\) .*/\1/'))
LDFLAGS += -framework Cocoa $(shell sdl2-config --libs) -lSDL2_ttf
LDFLAGS += -lSDL2_image
ifeq ($(SOUND), 1)
ifdef SOUND
LDFLAGS += -lSDL2_mixer
endif
endif
@@ -723,7 +722,7 @@ ifeq ($(TILES), 1)
LDFLAGS += $(shell $(PKG_CONFIG) --libs SDL2_image SDL2_ttf)
else
ifeq ($(MSYS2),1)
LDFLAGS += -Wl,--start-group -lharfbuzz -lfreetype -Wl,--end-group -lgraphite2 -lpng -lz -ltiff -lbz2 -lglib-2.0 -llzma -lws2_32 -lwebp -ljpeg -luuid
LDFLAGS += -Wl,--start-group -lharfbuzz -lfreetype -Wl,--end-group -lgraphite2 -lpng -lz -ltiff -lbz2 -lglib-2.0 -llzma -lws2_32 -lintl -liconv -lwebp -ljpeg -luuid
else
LDFLAGS += -lfreetype -lpng -lz -ljpeg -lbz2
endif
@@ -740,7 +739,14 @@ ifeq ($(TILES), 1)
ODIR = $(ODIRTILES)
endif
else
NCURSES_PREFIX = ncursesw
ifeq ($(LOCALIZE),1)
NCURSES_PREFIX = ncursesw
else
NCURSES_PREFIX = ncurses
endif
ifdef OSXCROSS
NCURSES_PREFIX = ncurses
endif
# ONLY when not cross-compiling, check for pkg-config or ncurses5-config
# When doing a cross-compile, we can't rely on the host machine's -configs
ifeq ($(CROSS),)
@@ -775,6 +781,13 @@ else
endif # HAVE_PKGCONFIG
endif # TILES
ifeq ($(TARGETSYSTEM),CYGWIN)
ifeq ($(LOCALIZE),1)
# Work around Cygwin not including gettext support in glibc
LDFLAGS += -lintl -liconv
endif
endif
ifeq ($(BSD), 1)
# BSDs have backtrace() and friends in a separate library
ifeq ($(BACKTRACE), 1)
@@ -783,7 +796,12 @@ ifeq ($(BSD), 1)
CXXFLAGS += -fno-omit-frame-pointer
endif
# libexecinfo may be located in /usr/local on BSD
# And similarly, their libcs don't have gettext built in
ifeq ($(LOCALIZE),1)
LDFLAGS += -lintl -liconv
endif
# libexecinfo, libintl and libiconv may be located in /usr/local on BSD
CXXFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
endif
@@ -793,6 +811,9 @@ ifeq ($(TARGETSYSTEM),WINDOWS)
LDFLAGS += -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lversion
ifeq ($(BACKTRACE),1)
LDFLAGS += -ldbghelp
ifeq ($(LIBBACKTRACE),1)
LDFLAGS += -lbacktrace
endif
endif
endif
@@ -800,13 +821,11 @@ ifeq ($(BACKTRACE),1)
DEFINES += -DBACKTRACE
ifeq ($(LIBBACKTRACE),1)
DEFINES += -DLIBBACKTRACE
LDFLAGS += -lbacktrace
endif
endif
ifeq ($(LOCALIZE),1)
DEFINES += -DLOCALIZE
LOCALIZE_TEST_DEPS = localization $(TEST_MO)
endif
ifeq ($(TARGETSYSTEM),LINUX)
@@ -828,23 +847,15 @@ ifeq ($(MSYS2),1)
endif
# Enumerations of all the source files and headers.
ifeq ($(HEADERPOPULARITY), 1)
# Alternate source file enumeration sorted in order of how many times the matching header file is included in source files
SOURCES := $(shell echo "$$(echo $$(grep -oh "^#include \"[^\"]*.h\"" $(SRC_DIR)/*.cpp | sort | uniq -c | sort -rn | cut -d \" -f 2 | sed -e 's/\.h$$/.cpp/' | sed -e 's/^/$(SRC_DIR)\//') | xargs -n 1 ls 2> /dev/null; ls -1 $(SRC_DIR)/*.cpp)" | awk '!x[$$0]++')
else
SOURCES := $(wildcard $(SRC_DIR)/*.cpp)
endif
THIRD_PARTY_SOURCES := $(wildcard $(SRC_DIR)/third-party/flatbuffers/*.cpp)
SOURCES := $(wildcard $(SRC_DIR)/*.cpp)
HEADERS := $(wildcard $(SRC_DIR)/*.h)
TESTSRC := $(wildcard tests/*.cpp)
TESTHDR := $(wildcard tests/*.h)
JSON_FORMATTER_SOURCES := $(wildcard tools/format/*.cpp) src/json.cpp
JSON_FORMATTER_HEADERS := $(wildcard tools/format/*.h)
CHKJSON_SOURCES := $(wildcard src/chkjson/*.cpp) src/json.cpp
JSON_FORMATTER_SOURCES := tools/format/format.cpp tools/format/format_main.cpp src/json.cpp
CHKJSON_SOURCES := src/chkjson/chkjson.cpp src/json.cpp
CLANG_TIDY_PLUGIN_SOURCES := \
$(wildcard tools/clang-tidy-plugin/*.cpp tools/clang-tidy-plugin/*/*.cpp)
CLANG_TIDY_PLUGIN_HEADERS := \
$(wildcard tools/clang-tidy-plugin/*.h tools/clang-tidy-plugin/*/*.h)
TOOLHDR := $(wildcard tools/*/*.h)
# Using sort here because it has the side-effect of deduplicating the list
ASTYLE_SOURCES := $(sort \
$(SOURCES) \
@@ -852,27 +863,18 @@ ASTYLE_SOURCES := $(sort \
$(TESTSRC) \
$(TESTHDR) \
$(JSON_FORMATTER_SOURCES) \
$(JSON_FORMATTER_HEADERS) \
$(CHKJSON_SOURCES) \
$(CLANG_TIDY_PLUGIN_SOURCES) \
$(CLANG_TIDY_PLUGIN_HEADERS))
# Third party sources should not be astyle'd
SOURCES += $(THIRD_PARTY_SOURCES)
$(TOOLHDR))
_OBJS = $(SOURCES:$(SRC_DIR)/%.cpp=%.o)
ifeq ($(TARGETSYSTEM),WINDOWS)
RSRC = $(wildcard $(SRC_DIR)/*.rc)
_OBJS += $(RSRC:$(SRC_DIR)/%.rc=%.o)
endif
ifeq ($(HEADERPOPULARITY), 1)
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
else
OBJS = $(sort $(patsubst %,$(ODIR)/%,$(_OBJS)))
endif
OBJS = $(sort $(patsubst %,$(ODIR)/%,$(_OBJS)))
ifdef LANGUAGES
export LOCALE_DIR
L10N = localization
endif
@@ -926,9 +928,7 @@ ifeq ($(LTO), 1)
endif
endif
LDFLAGS += -lz
all: version prefix $(CHECKS) $(TARGET) $(L10N) $(TESTS)
all: version $(CHECKS) $(TARGET) $(L10N) $(TESTS)
@
$(TARGET): $(OBJS)
@@ -942,12 +942,12 @@ ifeq ($(RELEASE), 1)
endif
$(PCH_P): $(PCH_H)
-$(CXX) $(CPPFLAGS) $(DEFINES) $(CXXFLAGS) -MMD -MP -Wno-error -c $(PCH_H) -o $(PCH_P)
-$(CXX) $(CPPFLAGS) $(DEFINES) $(subst -Werror,,$(CXXFLAGS)) -c $(PCH_H) -o $(PCH_P)
$(BUILD_PREFIX)$(TARGET_NAME).a: $(OBJS)
$(AR) rcs $(BUILD_PREFIX)$(TARGET_NAME).a $(filter-out $(ODIR)/main.o $(ODIR)/messages.o,$(OBJS))
.PHONY: version prefix
.PHONY: version
version:
@( VERSION_STRING=$(VERSION) ; \
[ -e ".git" ] && GITVERSION=$$( git describe --tags --always --match "[0-9A-Z]*.[0-9A-Z]*" ) && DIRTYFLAG=$$( [ -z "$$(git diff --numstat | grep -v lang/po/)" ] || echo "-dirty") && VERSION_STRING=$$GITVERSION$$DIRTYFLAG ; \
@@ -955,53 +955,24 @@ version:
if [ "x$$VERSION_STRING" != "x$$OLDVERSION" ]; then printf '// NOLINT(cata-header-guard)\n#define VERSION "%s"\n' "$$VERSION_STRING" | tee $(SRC_DIR)/version.h ; fi \
)
prefix:
@( PREFIX_STRING=$(PREFIX) ; \
[ -e "$(SRC_DIR)/prefix.h" ] && OLDPREFIX=$$(grep PREFIX $(SRC_DIR)/PREFIX.h|cut -d '"' -f2) ; \
if [ "x$$PREFIX_STRING" != "x$$OLDPREFIX" ]; then printf '// NOLINT(cata-header-guard)\n#define PREFIX "%s"\n' "$$PREFIX_STRING" | tee $(SRC_DIR)/prefix.h ; fi \
)
# Unconditionally create the object dirs on every invocation.
DIRS = $(sort $(dir $(OBJS)))
$(shell mkdir -p $(DIRS))
$(ODIR)/%.inc: $(SRC_DIR)/%.cpp
$(CXX) $(CPPFLAGS) $(DEFINES) $(CXXFLAGS) -H -E $< -o /dev/null 2> $@
.PHONY: includes
includes: $(OBJS:.o=.inc)
+make -C tests includes
# Unconditionally create the object dir on every invocation.
$(shell mkdir -p $(ODIR))
$(ODIR)/%.o: $(SRC_DIR)/%.cpp $(PCH_P)
$(CXX) $(CPPFLAGS) $(DEFINES) $(CXXFLAGS) -MMD -MP $(PCHFLAGS) -c $< -o $@
$(CXX) $(CPPFLAGS) $(DEFINES) $(CXXFLAGS) $(PCHFLAGS) -c $< -o $@
$(ODIR)/%.o: $(SRC_DIR)/%.rc
$(RC) $(RFLAGS) $< -o $@
$(ODIR)/resource.o: data/cataicon.ico data/application_manifest.xml
src/version.h: version
src/version.cpp: src/version.h
TEST_MO := data/mods/TEST_DATA/lang/mo/ru/LC_MESSAGES/TEST_DATA.mo
$(TEST_MO): data/mods/TEST_DATA/lang/po/ru.po
mkdir -p $(dir $@)
msgfmt -f -o $@ $<
MO_DEPS := \
$(wildcard lang/*.sh lang/*.py src/*.cpp src/*.h) \
$(shell find data/raw data/json data/mods data/core data/help -type f -name '*.json')
lang/mo_built.stamp: $(MO_DEPS)
$(MAKE) -C lang
touch $@
localization: lang/mo_built.stamp
localization:
lang/compile_mo.sh $(LANGUAGES)
$(CHKJSON_BIN): $(CHKJSON_SOURCES)
$(CXX) $(CXXFLAGS) $(TOOL_CXXFLAGS) -Isrc/chkjson -Isrc -isystem src/third-party $(CHKJSON_SOURCES) -o $(CHKJSON_BIN)
$(CXX) $(CXXFLAGS) $(TOOL_CXXFLAGS) -Isrc/chkjson -Isrc $(CHKJSON_SOURCES) -o $(CHKJSON_BIN)
json-check: $(CHKJSON_BIN)
./$(CHKJSON_BIN)
@@ -1013,12 +984,11 @@ clean: clean-tests clean-object_creator clean-pch
rm -rf *$(BINDIST_DIR) *cataclysmdda-*.tar.gz *cataclysmdda-*.zip
rm -f $(SRC_DIR)/version.h
rm -f $(CHKJSON_BIN)
rm -f $(TEST_MO)
distclean:
rm -rf *$(BINDIST_DIR)
rm -rf save
rm -rf lang/mo lang/mo_built.stamp
rm -rf lang/mo
rm -f data/options.txt
rm -f data/keymap.txt
rm -f data/auto_pickup.txt
@@ -1056,8 +1026,9 @@ ifeq ($(SOUND), 1)
endif
install --mode=644 data/changelog.txt data/cataicon.ico data/fontdata.json \
LICENSE.txt LICENSE-OFL-Terminus-Font.txt -t $(DATA_PREFIX)
mkdir -p $(LOCALE_DIR)
ifdef LANGUAGES
$(MAKE) -C lang install
LOCALE_DIR=$(LOCALE_DIR) lang/compile_mo.sh $(LANGUAGES)
endif
endif
@@ -1091,8 +1062,9 @@ ifeq ($(SOUND), 1)
endif
install --mode=644 data/changelog.txt data/cataicon.ico data/fontdata.json \
LICENSE.txt LICENSE-OFL-Terminus-Font.txt -t $(DATA_PREFIX)
mkdir -p $(LOCALE_DIR)
ifdef LANGUAGES
$(MAKE) -C lang install
LOCALE_DIR=$(LOCALE_DIR) lang/compile_mo.sh $(LANGUAGES)
endif
endif
@@ -1140,14 +1112,18 @@ endif
cp -R data/title $(APPDATADIR)
cp -R data/help $(APPDATADIR)
ifdef LANGUAGES
$(MAKE) -C lang
lang/compile_mo.sh $(LANGUAGES)
mkdir -p $(APPRESOURCESDIR)/lang/mo/
cp -pR lang/mo/* $(APPRESOURCESDIR)/lang/mo/
endif
ifeq ($(LOCALIZE), 1)
LIBINTL=$$($(CROSS)otool -L $(APPTARGET) | grep libintl | sed -n 's/\(.*\.dylib\).*/\1/p') && if [ -f $$LIBINTL ]; then cp $$LIBINTL $(APPRESOURCESDIR)/; fi; \
if [ ! -z "$$OSXCROSS" ]; then LIBINTL=$$(basename $$LIBINTL) && if [ ! -z "$$LIBINTL" ]; then cp $(LIBSDIR)/gettext/lib/$$LIBINTL $(APPRESOURCESDIR)/; fi; fi
endif
ifeq ($(TILES), 1)
ifeq ($(SOUND), 1)
cp -R data/sound $(APPDATADIR)
endif # ifeq ($(SOUND), 1)
endif # ifdef SOUND
cp -R gfx $(APPRESOURCESDIR)/
ifdef FRAMEWORK
cp -R $(FRAMEWORKSDIR)/SDL2.framework $(APPRESOURCESDIR)/
@@ -1155,15 +1131,21 @@ ifdef FRAMEWORK
cp -R $(FRAMEWORKSDIR)/SDL2_ttf.framework $(APPRESOURCESDIR)/
ifeq ($(SOUND), 1)
cp -R $(FRAMEWORKSDIR)/SDL2_mixer.framework $(APPRESOURCESDIR)/
endif # ifeq ($(SOUND), 1)
cd $(APPRESOURCESDIR)/ && ln -s SDL2_mixer.framework/Frameworks/Vorbis.framework Vorbis.framework
cd $(APPRESOURCESDIR)/ && ln -s SDL2_mixer.framework/Frameworks/Ogg.framework Ogg.framework
cd $(APPRESOURCESDIR)/SDL2_mixer.framework/Frameworks && find . -maxdepth 1 -type d -not -name '*Vorbis.framework' -not -name '*Ogg.framework' -not -name '.' | xargs rm -rf
endif # ifdef SOUND
else # libsdl build
cp $(SDLLIBSDIR)/libSDL2.dylib $(APPRESOURCESDIR)/
cp $(SDLLIBSDIR)/libSDL2_image.dylib $(APPRESOURCESDIR)/
cp $(SDLLIBSDIR)/libSDL2_ttf.dylib $(APPRESOURCESDIR)/
ifeq ($(SOUND), 1)
cp $(SDLLIBSDIR)/libSDL2_mixer.dylib $(APPRESOURCESDIR)/
endif # ifdef SOUND
endif # ifdef FRAMEWORK
endif # ifdef TILES
ifndef FRAMEWORK
python3 ./tools/copy_mac_libs.py $(APPRESOURCESDIR)/$(APPTARGET)
endif # ifndef FRAMEWORK
dmgdistclean:
rm -rf Cataclysm
rm -f Cataclysm.dmg
@@ -1204,54 +1186,27 @@ etags: $(ASTYLE_SOURCES)
etags $^
./tools/json_tools/cddatags.py
ifneq ($(IS_WINDOWS_HOST),1)
# Parallel astyle for posix hosts where fork and filesystem are cheap.
ASTYLE_CHECK_STAMPS = $(sort $(patsubst %,$(ODIR)/%.astyle-check-stamp,$(ASTYLE_SOURCES)))
astyle: $(ASTYLE_CHECK_STAMPS)
$(ASTYLE_CHECK_STAMPS): $(ODIR)/%.astyle-check-stamp : %
$(ASTYLE_BINARY) --options=.astylerc -n $< && mkdir -p $(@D) && touch $@
else
# Serial astyle for Windows hosts which processes all files in one invocation.
astyle: $(ODIR)/.astyle-check-stamp
$(ODIR)/.astyle-check-stamp: $(ASTYLE_SOURCES)
$(ASTYLE_BINARY) --options=.astylerc -n $?
mkdir -p $(@D) && touch $@
endif
astyle-fast: $(ASTYLE_SOURCES)
echo $(ASTYLE_SOURCES) | xargs -P 0 -L 1 $(ASTYLE_BINARY) --quiet --options=.astylerc -n
astyle-diff: $(ASTYLE_SOURCES)
$(ASTYLE_BINARY) --options=.astylerc -n $$(git diff --name-only src/*.h src/*.cpp tests/*.h tests/*.cpp)
astyle-all: $(ASTYLE_SOURCES)
astyle: $(ASTYLE_SOURCES)
$(ASTYLE_BINARY) --options=.astylerc -n $(ASTYLE_SOURCES)
mkdir -p $(ODIR) && touch $(ODIR)/.astyle-check-stamp
# Test whether the system has a version of astyle that supports --dry-run
ifeq ($(shell $(ASTYLE_BINARY) -Q -X --dry-run src/game.h >/dev/null 2>/dev/null && echo foo),foo)
ASTYLE_CHECK=$(shell $(ASTYLE_BINARY) --options=.astylerc --dry-run -X -Q --ascii $(ASTYLE_SOURCES) | sed -E "s/Formatted[[:space:]]+(.*)/Needs formatting: \1\\\n/" | tr -d '\n')
ifeq ($(shell if $(ASTYLE_BINARY) -Q -X --dry-run src/game.h > /dev/null; then echo foo; fi),foo)
ASTYLE_CHECK=$(shell $(ASTYLE_BINARY) --options=.astylerc --dry-run -X -Q --ascii $(ASTYLE_SOURCES))
endif
astyle-check:
ifdef ASTYLE_CHECK
$(info $(ASTYLE_BINARY) -V: $(shell $(ASTYLE_BINARY) -V))
@if [ "$(findstring Needs formatting:,$(ASTYLE_CHECK))" = "" ]; then echo "no astyle regressions";\
else printf "astyle regressions found.\n$(ASTYLE_CHECK)" && false; fi
@if [ "$(findstring Formatted,$(ASTYLE_CHECK))" = "" ]; then echo "no astyle regressions";\
else printf "astyle regressions found.\n$(ASTYLE_CHECK)\n" && false; fi
else
@echo Cannot run an astyle check, your system either does not have astyle, or it is too old.
endif
JSON_SOURCES := $(shell find data -name '* *' -prune -o -name "*.json" -print)
JSON_CHECK_STAMPS = $(sort $(patsubst %,$(ODIR)/%,$(JSON_SOURCES:.json=.jstyle-check-stamp)))
style-json : $(JSON_CHECK_STAMPS) $(JSON_FORMATTER_BIN)
$(JSON_CHECK_STAMPS) : $(ODIR)/%.jstyle-check-stamp : %.json $(JSON_FORMATTER_BIN)
style-json: json_blacklist $(JSON_FORMATTER_BIN)
ifndef CROSS
$(JSON_FORMATTER_BIN) $< && mkdir -p $(@D) && touch $@
find data gfx -name "*.json" -print0 | grep -v -z -F -f json_blacklist | \
xargs -0 -L 1 $(JSON_FORMATTER_BIN)
else
@echo Cannot run json formatter in cross compiles.
endif
@@ -1259,20 +1214,17 @@ endif
style-all-json: $(JSON_FORMATTER_BIN)
find data -name "*.json" -print0 | xargs -0 -L 1 $(JSON_FORMATTER_BIN)
style-all-json-parallel: $(JSON_FORMATTER_BIN)
find data -name "*.json" -print0 | xargs -0 -L 1 -P $$(nproc) $(JSON_FORMATTER_BIN)
$(JSON_FORMATTER_BIN): $(JSON_FORMATTER_SOURCES)
$(CXX) $(CXXFLAGS) -MMD -MP $(TOOL_CXXFLAGS) -Itools/format -Isrc -isystem src/third-party \
$(CXX) $(CXXFLAGS) $(TOOL_CXXFLAGS) -Itools/format -Isrc \
$(JSON_FORMATTER_SOURCES) -o $(JSON_FORMATTER_BIN)
python-check:
flake8
tests: version $(BUILD_PREFIX)cataclysm.a $(LOCALIZE_TEST_DEPS)
tests: version $(BUILD_PREFIX)cataclysm.a
$(MAKE) -C tests
check: version $(BUILD_PREFIX)cataclysm.a $(LOCALIZE_TEST_DEPS)
check: version $(BUILD_PREFIX)cataclysm.a
$(MAKE) -C tests check
clean-tests:
@@ -1291,4 +1243,5 @@ clean-pch:
.PHONY: tests check ctags etags clean-tests clean-object_creator clean-pch install lint
-include $(SOURCES:$(SRC_DIR)/%.cpp=$(DEPDIR)/%.P)
-include ${OBJS:.o=.d}
+19 -25
View File
@@ -2,9 +2,16 @@
Cataclysm: Dark Days Ahead is a turn-based survival game set in a post-apocalyptic world. While some have described it as a "zombie game", there is far more to Cataclysm than that. Struggle to survive in a harsh, persistent, procedurally generated world. Scavenge the remnants of a dead civilization for food, equipment, or, if you are lucky, a vehicle with a full tank of gas to get you the hell out of Dodge. Fight to defeat or escape from a wide variety of powerful monstrosities, from zombies to giant insects to killer robots and things far stranger and deadlier, and against the others like yourself, who want what you have...
<p align="center">
<img src="./data/screenshots/ultica-showcase-sep-2021.png" alt="Tileset: Ultica">
</p>
<a href="https://repology.org/project/cataclysm-dda/versions">
<img src="https://repology.org/badge/vertical-allrepos/cataclysm-dda.svg" alt="Packaging Status" align="right">
</a>
[![Build Status](https://travis-ci.org/CleverRaven/Cataclysm-DDA.svg?branch=master)](https://travis-ci.org/CleverRaven/Cataclysm-DDA)
[![Coverage Status](https://coveralls.io/repos/github/CleverRaven/Cataclysm-DDA/badge.svg?branch=master)](https://coveralls.io/github/CleverRaven/Cataclysm-DDA?branch=master)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/CleverRaven/Cataclysm-DDA.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/CleverRaven/Cataclysm-DDA/context:cpp)
[![Open Source Helpers](https://www.codetriage.com/cleverraven/cataclysm-dda/badges/users.svg)](https://www.codetriage.com/cleverraven/cataclysm-dda)
[![Commit Activity](https://img.shields.io/github/commit-activity/m/CleverRaven/Cataclysm-DDA)](https://github.com/CleverRaven/Cataclysm-DDA/graphs/contributors)
[![Lines of Code](https://tokei.rs/b1/github/CleverRaven/Cataclysm-DDA?category=code)](https://github.com/XAMPPRocky/tokei)
## Downloads
@@ -12,17 +19,6 @@ Cataclysm: Dark Days Ahead is a turn-based survival game set in a post-apocalypt
**Source** - The source can be downloaded as a [.zip archive](https://github.com/CleverRaven/Cataclysm-DDA/archive/master.zip), or cloned from our [GitHub repo](https://github.com/CleverRaven/Cataclysm-DDA/).
<a href="https://repology.org/project/cataclysm-dda/versions">
<img src="https://repology.org/badge/vertical-allrepos/cataclysm-dda.svg" alt="Packaging Status" align="right">
</a>
[![General build matrix](https://github.com/CleverRaven/Cataclysm-DDA/actions/workflows/matrix.yml/badge.svg)](https://github.com/CleverRaven/Cataclysm-DDA/actions/workflows/matrix.yml)
[![Coverage Status](https://coveralls.io/repos/github/CleverRaven/Cataclysm-DDA/badge.svg?branch=master)](https://coveralls.io/github/CleverRaven/Cataclysm-DDA?branch=master)
[![Open Source Helpers](https://www.codetriage.com/cleverraven/cataclysm-dda/badges/users.svg)](https://www.codetriage.com/cleverraven/cataclysm-dda)
[![Commit Activity](https://img.shields.io/github/commit-activity/m/CleverRaven/Cataclysm-DDA)](https://github.com/CleverRaven/Cataclysm-DDA/graphs/contributors)
[![Lines of Code](https://tokei.rs/b1/github/CleverRaven/Cataclysm-DDA?category=code)](https://github.com/XAMPPRocky/tokei)
[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/CleverRaven/Cataclysm-DDA)](https://www.tickgit.com/browse?repo=github.com/CleverRaven/Cataclysm-DDA)
### Packaging status
#### Arch Linux
@@ -54,19 +50,12 @@ We also have the following build guides:
## Contribute
Cataclysm: Dark Days Ahead is the result of contributions from over 1000 volunteers under the Creative Commons Attribution ShareAlike 3.0 license. The code and content of the game is free to use, modify, and redistribute for any purpose whatsoever. See https://creativecommons.org/licenses/by-sa/3.0/ for details.
Cataclysm: Dark Days Ahead is the result of contributions from over 1000 volunteers under the Creative Commons Attribution ShareAlike 3.0 license. The code and content of the game is free to use, modify, and redistribute for any purpose whatsoever. See http://creativecommons.org/licenses/by-sa/3.0/ for details.
Some code distributed with the project is not part of the project and is released under different software licenses; the files covered by different software licenses have their own license notices.
[<img src="https://www.bountysource.com/badge/tracker?tracker_id=146201" alt="Bountysource" align="right">](https://www.bountysource.com/trackers/146201-clever-raven-cataclysm-dda?utm_source=146201&utm_medium=shield&utm_campaign=TRACKER_BADGE)
Please see [CONTRIBUTING.md](doc/CONTRIBUTING.md) for details.
Special thanks to the contributors, including but not limited to, people below:
<a href="https://github.com/cleverraven/cataclysm-dda/graphs/contributors">
<img src="https://contrib.rocks/image?repo=cleverraven/cataclysm-dda" />
</a>
Made with [contrib.rocks](https://contrib.rocks).
Please see [CONTRIBUTING.md](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/.github/CONTRIBUTING.md) for details.
## Community
@@ -74,13 +63,14 @@ Forums:
https://discourse.cataclysmdda.org
Wiki:
https://cddawiki.chezzo.com/cdda_wiki/index.php
http://cddawiki.chezzo.com/cdda_wiki/index.php
GitHub repo:
https://github.com/CleverRaven/Cataclysm-DDA
IRC:
`#CataclysmDDA` on [Libera Chat](https://libera.chat), https://web.libera.chat/#CataclysmDDA
`irc.libera.chat` ; `#CataclysmDDA`
https://kiwiirc.com/nextclient/irc.libera.chat#CataclysmDDA
Official Discord:
https://discord.gg/jFEc7Yp
@@ -106,3 +96,7 @@ Please submit an issue on [our GitHub page](https://github.com/CleverRaven/Catac
#### I would like to make a suggestion. What should I do?
Please submit an issue on [our GitHub page](https://github.com/CleverRaven/Cataclysm-DDA/issues/) using [feature request template](https://github.com/CleverRaven/Cataclysm-DDA/issues/new?template=feature_request.md).
You can also submit your suggestions or vote for existing suggestions on [our FeatHub page](https://feathub.com/CleverRaven/Cataclysm-DDA). Most voted suggestions are:
[![Feature Requests](https://feathub.com/CleverRaven/Cataclysm-DDA?format=svg)](https://feathub.com/CleverRaven/Cataclysm-DDA)
-1
View File
@@ -63,4 +63,3 @@ Paul Bransford (draeath) <draeath@gmail.com>
Mark Langsdorf (mlangsdorf) <mark.langsdorf@gmail.com> / <mlangsdo@redhat.com>
Ratul Saha (sahaRatul) <ratul.saha@arrakis.in> / <50.ratulsaha@gmail.com>
Davis Bray (Kaltag1925) <pdavisbray@gmail.com>
Nicolas Appriou <nicolas.appriou@gmail.com>
-8
View File
@@ -99,11 +99,6 @@ if (localProperties.getProperty('override_ndkBuildAppPlatform') != null) {
override_ndkBuildAppPlatform = localProperties.getProperty("override_ndkBuildAppPlatform")
}
def override_ndkVersion = getProperty("override_ndkVersion")
if (localProperties.getProperty('override_ndkVersion') != null) {
override_ndkVersion = localProperties.getProperty('override_ndkVersion')
}
println("Using [ njobs]: $njobs")
println("Using [ localize]: $localize")
println("Using [ deps]: $deps")
@@ -113,7 +108,6 @@ println("Using [ compileSdkVersion]: $override_compileSdkVersion")
println("Using [ minSdkVersion]: $override_minSdkVersion")
println("Using [ targetSdkVersion]: $override_targetSdkVersion")
println("Using [ndkBuildAppPlatform]: $override_ndkBuildAppPlatform")
println("Using [ ndkVersion]: $override_ndkVersion")
println("Using [ abi_arm_32]: $abi_arm_32")
println("Using [ abi_arm_64]: $abi_arm_64")
println("Using [ abi_x86_32]: $abi_x86_32")
@@ -238,9 +232,7 @@ preBuild.dependsOn createWindowsJunctionLinks
createWindowsJunctionLinks.dependsOn makeLocalization
android {
namespace "com.cleverraven.cataclysmdda"
compileSdkVersion override_compileSdkVersion
ndkVersion override_ndkVersion
defaultConfig {
minSdkVersion override_minSdkVersion
+2 -2
View File
@@ -2,9 +2,9 @@
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
APP_STL := c++_shared
APP_CPPFLAGS += -std=c++17
APP_CPPFLAGS += -std=c++14
ifneq ($(OS),Windows_NT)
APP_LDFLAGS += -fuse-ld=lld
APP_LDFLAGS += -fuse-ld=gold
endif
# Do not specify APP_OPTIM here, it is done through ndk-build NDK_DEBUG=0/1 setting instead
+23
View File
@@ -0,0 +1,23 @@
LOCAL_PATH := $(call my-dir)
###########################
#
# libintl-lite shared library
#
###########################
include $(CLEAR_VARS)
LOCAL_MODULE := libintl-lite
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_SRC_FILES := libintl.cpp
LOCAL_CPP_FEATURES := exceptions rtti
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
+23
View File
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,98 @@
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBINTL_INTERNAL_MESSAGECATALOG_HPP_
#define LIBINTL_INTERNAL_MESSAGECATALOG_HPP_
#include <algorithm>
#include <string>
namespace libintllite
{
namespace internal
{
class MessageCatalog
{
private:
MessageCatalog( const MessageCatalog & );
MessageCatalog &operator=( const MessageCatalog & );
uint32_t numberOfStrings;
const std::string *sortedOrigStringsArray;
const std::string *translatedStringsArray;
public:
// The ownership of these arrays is transfered to the created message
// catalog object!
// Does not throw exceptions!
MessageCatalog( uint32_t numberOfStrings,
const std::string *sortedOrigStringsArray,
const std::string *translatedStringsArray ) :
numberOfStrings( numberOfStrings ),
sortedOrigStringsArray( sortedOrigStringsArray ),
translatedStringsArray( translatedStringsArray ) {
}
~MessageCatalog() {
delete[] this->sortedOrigStringsArray;
delete[] this->translatedStringsArray;
}
// Returns NULL, if the original string was not found.
// Does not throw exceptions!
const std::string *getTranslatedStrPtr( const std::string &orig ) const {
const std::string *lastSortedOrigStringEndIter
= this->sortedOrigStringsArray + this->numberOfStrings;
const std::string *origStrPtr = std::lower_bound( this->sortedOrigStringsArray,
lastSortedOrigStringEndIter,
orig );
#ifdef __ANDROID__
// Bugfix from j-jorge's branch of libintl-lite: https://github.com/j-jorge/libintl-lite/commit/40e5a41e9b19e3252d348e0548f85e66fa44a79e
// However, libintl-lite does not seem to support plural form strings + translations properly, so I've had to modify the fix further.
// Plural strings are stored as "<singular>NUL<plural>NUL<plural>..." for as many plurals are in the language, eg. Russian has 4, French has 2, Japanese has 1.
// So we only compare the first singular string as per gettext MO files spec here: https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html
// We do this via c_str() which clamps at the first NUL character.
// Later on once we have a match, we will dig out the proper plural translation from this megastring.
if( !origStrPtr || ( origStrPtr == lastSortedOrigStringEndIter ) ||
( std::string( ( *origStrPtr ).c_str() ) != std::string( orig.c_str() ) ) )
#else
if( !origStrPtr || ( origStrPtr == lastSortedOrigStringEndIter ) )
#endif
{
return NULL;
} else {
return &this->translatedStringsArray[origStrPtr - this->sortedOrigStringsArray];
}
}
};
} // namespace internal
} // namespace libintllite
#endif // LIBINTL_INTERNAL_MESSAGECATALOG_HPP_
+222
View File
@@ -0,0 +1,222 @@
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBINTL_INTERNAL_UTIL_HPP_
#define LIBINTL_INTERNAL_UTIL_HPP_
#if defined(WIN32) || defined(WINCE)
typedef unsigned int uint32_t;
#else
#include <stdint.h>
#endif
namespace libintllite
{
namespace internal
{
// Helper functions for handling numbers and char array conversions:
static inline bool isBigEndian()
{
uint32_t checkNumber = 0x1100;
return ( *reinterpret_cast<const char *>( &checkNumber ) != 0 );
}
static inline uint32_t swapUInt32Bytes( uint32_t number )
{
const char *numberAsCharArray = reinterpret_cast<const char *>( &number );
uint32_t swappedNumber;
char *swappedNumberAsCharArray = reinterpret_cast<char *>( &swappedNumber );
swappedNumberAsCharArray[0] = numberAsCharArray[3];
swappedNumberAsCharArray[1] = numberAsCharArray[2];
swappedNumberAsCharArray[2] = numberAsCharArray[1];
swappedNumberAsCharArray[3] = numberAsCharArray[0];
return swappedNumber;
}
static inline uint32_t charArrayToUInt32( const char uint32CharArray[4] )
{
return *reinterpret_cast<const uint32_t *>( uint32CharArray );
}
static inline bool readUIn32FromFile( FILE *fileHandle, bool needsBeToLeConversion,
uint32_t &outReadUInt32 )
{
char uint32CharArray[4];
if( ( fread( uint32CharArray, 1, 4, fileHandle ) ) != 4 ) {
return false;
}
if( needsBeToLeConversion ) {
outReadUInt32 = swapUInt32Bytes( charArrayToUInt32( uint32CharArray ) );
return true;
} else {
outReadUInt32 = charArrayToUInt32( uint32CharArray );
return true;
}
}
// RAII classes:
template <class T>
class ArrayGurard
{
private:
ArrayGurard( const ArrayGurard & );
ArrayGurard &operator=( const ArrayGurard & );
T *&arrayRef;
bool released;
public:
explicit ArrayGurard( T *&arrayRef ) :
arrayRef( arrayRef ),
released( false ) {
}
~ArrayGurard() {
if( !this->released ) {
delete[] this->arrayRef;
}
}
const T *release() {
this->released = true;
return this->arrayRef;
}
};
class CloseFileHandleGuard
{
private:
CloseFileHandleGuard( const CloseFileHandleGuard & );
CloseFileHandleGuard &operator=( const CloseFileHandleGuard & );
FILE *&fileHandleRef;
public:
explicit CloseFileHandleGuard( FILE *&fileHandleRef ) :
fileHandleRef( fileHandleRef ) {
}
~CloseFileHandleGuard() {
if( this->fileHandleRef ) {
fclose( this->fileHandleRef );
}
}
};
// Helper function to load strings from a .mo file and stores them in a given array
static bool loadMoFileStringsToArray( FILE *moFile,
uint32_t numberOfStrings,
uint32_t stringsTableOffsetFromFileBegin,
bool needsBeToLeConversion,
std::string *outStringsFromMoFileArray )
{
if( fseek( moFile, stringsTableOffsetFromFileBegin, SEEK_SET ) != 0 ) {
return false;
}
uint32_t *stringsLengthsArray = NULL;
ArrayGurard<uint32_t> stringsLengthsArrayGuard( stringsLengthsArray );
stringsLengthsArray = new uint32_t[numberOfStrings];
if( !stringsLengthsArray ) {
return false;
}
uint32_t firstStringOffset;
uint32_t lastStringOffset;
{
uint32_t currentStringLength;
uint32_t currentStringOffset;
for( uint32_t i = 0; i < numberOfStrings; i++ ) {
if( !readUIn32FromFile( moFile, needsBeToLeConversion, currentStringLength ) ) {
return false;
}
if( !readUIn32FromFile( moFile, needsBeToLeConversion, currentStringOffset ) ) {
return false;
}
stringsLengthsArray[i] = currentStringLength;
if( i == 0 ) {
firstStringOffset = currentStringOffset;
}
if( i == ( numberOfStrings - 1 ) ) {
lastStringOffset = currentStringOffset;
}
}
}
{
char *stringCharsArray = NULL;
ArrayGurard<char> stringCharsArrayGuard( stringCharsArray );
uint32_t stringCharsArraySize = lastStringOffset + stringsLengthsArray[numberOfStrings - 1] + 1 -
firstStringOffset;
if( stringCharsArraySize == 0 ) {
return false;
}
if( fseek( moFile, firstStringOffset, SEEK_SET ) != 0 ) {
return false;
}
stringCharsArray = new char[stringCharsArraySize];
if( !stringCharsArray ) {
return false;
}
if( fread( stringCharsArray, 1, stringCharsArraySize, moFile ) != stringCharsArraySize ) {
return false;
}
const char *stringsCharsArrayIter = stringCharsArray;
for( uint32_t i = 0; i < numberOfStrings; i++ ) {
#ifdef __ANDROID__
// Bugfix from j-jorge's branch of libintl-lite: https://github.com/j-jorge/libintl-lite/commit/240f38c005ba9afce9c3c3629d624d904cb09403
const char *currentStrEndIter = stringsCharsArrayIter + stringsLengthsArray[i];
outStringsFromMoFileArray[i] = std::string( stringsCharsArrayIter, currentStrEndIter );
stringsCharsArrayIter = currentStrEndIter + 1 /* skip the NULL char at the end of the string */ ;
#else
const char *currentStrEndIter = stringsCharsArrayIter + stringsLengthsArray[i] + 1;
outStringsFromMoFileArray[i] = std::string( stringsCharsArrayIter, currentStrEndIter );
stringsCharsArrayIter = currentStrEndIter;
#endif
}
}
return true;
}
} // namespace internal
} // namespace libintllite
#endif // LIBINTL_INTERNAL_UTIL_HPP_
+360
View File
@@ -0,0 +1,360 @@
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "libintl.h"
#include <map>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(WIN32) || defined(WINCE)
typedef unsigned int uint32_t;
#else
#include <stdint.h>
#endif
#ifdef __ANDROID__
#include <iostream>
#endif
#include "MessageCatalog.hpp"
#include "Util.hpp"
using namespace std;
using namespace libintllite;
using namespace libintllite::internal;
static char *currentDefaultDomain = NULL;
static map<char *, MessageCatalog *> loadedMessageCatalogPtrsByDomain;
libintl_lite_bool_t loadMessageCatalog( const char *domain, const char *moFilePath )
{
try {
if( sizeof( uint32_t ) != 4 ) {
return LIBINTL_LITE_BOOL_FALSE;
}
if( !moFilePath || !domain ) {
return LIBINTL_LITE_BOOL_FALSE;
}
FILE *moFile = NULL;
CloseFileHandleGuard closeFileHandleGuard( moFile );
moFile = fopen( moFilePath, "rb" );
if( !moFile ) {
return LIBINTL_LITE_BOOL_FALSE;
}
uint32_t magicNumber;
if( !readUIn32FromFile( moFile, false, magicNumber ) ) {
return LIBINTL_LITE_BOOL_FALSE;
}
if( ( magicNumber != 0x950412de ) && ( magicNumber != 0xde120495 ) ) {
return LIBINTL_LITE_BOOL_FALSE;
}
uint32_t fileFormatRevision;
if( !readUIn32FromFile( moFile, false, fileFormatRevision ) ) {
return LIBINTL_LITE_BOOL_FALSE;
}
if( fileFormatRevision != 0 ) {
return LIBINTL_LITE_BOOL_FALSE;
}
bool needsBeToLeConversion = isBigEndian();
uint32_t numberOfStrings;
if( !readUIn32FromFile( moFile, needsBeToLeConversion, numberOfStrings ) ) {
return false;
}
if( numberOfStrings == 0 ) {
return LIBINTL_LITE_BOOL_TRUE;
}
uint32_t offsetOrigTable;
if( !readUIn32FromFile( moFile, needsBeToLeConversion, offsetOrigTable ) ) {
return LIBINTL_LITE_BOOL_FALSE;
}
uint32_t offsetTransTable;
if( !readUIn32FromFile( moFile, needsBeToLeConversion, offsetTransTable ) ) {
return LIBINTL_LITE_BOOL_FALSE;
}
string *sortedOrigStringsArray = NULL;
ArrayGurard<string> sortedOrigStringsArrayGuard( sortedOrigStringsArray );
sortedOrigStringsArray = new string[numberOfStrings];
if( !sortedOrigStringsArray ) {
return LIBINTL_LITE_BOOL_FALSE;
}
if( !loadMoFileStringsToArray( moFile,
numberOfStrings,
offsetOrigTable,
needsBeToLeConversion,
sortedOrigStringsArray ) ) {
return LIBINTL_LITE_BOOL_FALSE;
}
string *translatedStringsArray = NULL;
ArrayGurard<string> translatedStringsArrayGuard( translatedStringsArray );
translatedStringsArray = new string[numberOfStrings];
if( !translatedStringsArray ) {
return LIBINTL_LITE_BOOL_FALSE;
}
if( !loadMoFileStringsToArray( moFile,
numberOfStrings,
offsetTransTable,
needsBeToLeConversion,
translatedStringsArray ) ) {
return LIBINTL_LITE_BOOL_FALSE;
}
MessageCatalog *newMessageCatalogPtr = new MessageCatalog( numberOfStrings,
sortedOrigStringsArray,
translatedStringsArray );
if( !newMessageCatalogPtr ) {
return LIBINTL_LITE_BOOL_FALSE;
}
sortedOrigStringsArrayGuard.release();
translatedStringsArrayGuard.release();
char *domainDup = strdup( domain );
if( !domainDup ) {
return LIBINTL_LITE_BOOL_FALSE;
}
closeLoadedMessageCatalog( domain );
loadedMessageCatalogPtrsByDomain[domainDup] = newMessageCatalogPtr;
return LIBINTL_LITE_BOOL_TRUE;
} catch( ... ) {
return LIBINTL_LITE_BOOL_FALSE;
}
}
void closeLoadedMessageCatalog( const char *domain )
{
if( domain ) {
for( map<char *, MessageCatalog *>::iterator i = loadedMessageCatalogPtrsByDomain.begin();
i != loadedMessageCatalogPtrsByDomain.end();
i++ ) {
if( strcmp( i->first, domain ) == 0 ) {
free( i->first );
delete i->second;
loadedMessageCatalogPtrsByDomain.erase( i );
return;
}
}
}
}
void closeAllLoadedMessageCatalogs()
{
for( map<char *, MessageCatalog *>::iterator i = loadedMessageCatalogPtrsByDomain.begin();
i != loadedMessageCatalogPtrsByDomain.end();
i++ ) {
free( i->first );
delete i->second;
}
loadedMessageCatalogPtrsByDomain.clear();
free( currentDefaultDomain );
currentDefaultDomain = NULL;
}
const char *textdomain( const char *domain )
{
if( domain ) {
char *newDefaultDomain = strdup( domain );
if( !newDefaultDomain ) {
return NULL;
}
free( currentDefaultDomain );
currentDefaultDomain = newDefaultDomain;
return newDefaultDomain;
} else {
return NULL;
}
}
const char *gettext( const char *origStr )
{
return dgettext( NULL, origStr );
}
const char *dgettext( const char *domain, const char *origStr )
{
if( !origStr ) {
return NULL;
}
if( !domain ) {
if( currentDefaultDomain ) {
domain = currentDefaultDomain;
} else {
return origStr;
}
}
const MessageCatalog *msgCat = NULL;
for( map<char *, MessageCatalog *>::iterator i = loadedMessageCatalogPtrsByDomain.begin();
!msgCat && ( i != loadedMessageCatalogPtrsByDomain.end() );
i++ ) {
if( strcmp( i->first, domain ) == 0 ) {
msgCat = i->second;
}
}
if( !msgCat ) {
return origStr;
}
const string *translatedStrPtr = msgCat->getTranslatedStrPtr( origStr );
if( translatedStrPtr ) {
return translatedStrPtr->c_str();
} else {
return origStr;
}
}
const char *ngettext( const char *origStr, const char *origStrPlural, unsigned long n )
{
#ifdef __ANDROID__
try {
// First let's get the translated megastring that contains all the plural translations separated by NUL chars
const char *translatedStr = gettext( origStr );
// Now determine correct plural form to use. This data is described in .PO files "Plural-Forms" metadata.
const char *language = getenv( "LANGUAGE" );
// Bail out if we don't have data, or the result of gettext is the exact same pointer to the source string (so we don't have a translated megastring to look at)
if( !translatedStr || !language || translatedStr == origStr ) {
if( n == 1 ) {
return origStr;
} else {
return origStrPlural;
}
}
int nplurals = 2;
int plural = n != 1;
if( strcmp( language, "en" ) == 0 ) {
nplurals = 2;
plural = ( n != 1 );
} else if( strcmp( language, "fr" ) == 0 ) {
nplurals = 2;
plural = ( n > 1 );
} else if( strcmp( language, "de" ) == 0 ) {
nplurals = 2;
plural = ( n != 1 );
} else if( strcmp( language, "it_IT" ) == 0 ) {
nplurals = 2;
plural = ( n != 1 );
} else if( strcmp( language, "es_AR" ) == 0 ) {
nplurals = 2;
plural = ( n != 1 );
} else if( strcmp( language, "es_ES" ) == 0 ) {
nplurals = 2;
plural = ( n != 1 );
} else if( strcmp( language, "ja" ) == 0 ) {
nplurals = 1;
plural = 0;
} else if( strcmp( language, "ko" ) == 0 ) {
nplurals = 1;
plural = 0;
} else if( strcmp( language, "pt_BR" ) == 0 ) {
nplurals = 2;
plural = ( n > 1 );
} else if( strcmp( language, "pt_PT" ) == 0 ) {
nplurals = 2;
plural = n != 1;
} else if( strcmp( language, "ru" ) == 0 ) {
nplurals = 4;
plural = ( n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && ( n % 100 < 12 ||
n % 100 > 14 ) ? 1 : n % 10 == 0 || ( n % 10 >= 5 && n % 10 <= 9 ) || ( n % 100 >= 11 &&
n % 100 <= 14 ) ? 2 : 3 );
} else if( strcmp( language, "zh_CN" ) == 0 ) {
nplurals = 1;
plural = 0;
} else if( strcmp( language, "zh_TW" ) == 0 ) {
nplurals = 1;
plural = 0;
}
// Now we know which plural form to use, move the string pointer past the appropriate # of NUL characters.
// This is a bit scary because it relies on the .MO file always storing the correct number of plurals,
// otherwise we could overrun the string buffer. Seems to work fine though... (nervous laughter)
for( int i = 0; i < plural; ++i ) {
translatedStr += strlen( translatedStr ) + 1; // advance to the start of the next string
}
return translatedStr;
} catch( const std::exception &err ) {
std::cerr << "Error in libintl-lite ngettext(): " << err.what() << std::endl;
if( n == 1 ) {
return origStr;
} else {
return origStrPlural;
}
}
#else
if( n == 1 ) {
return gettext( origStr );
} else {
return gettext( origStrPlural );
}
#endif
}
const char *dngettext( const char *domain, const char *origStr, const char *origStrPlural,
unsigned long n )
{
#ifdef __ANDROID__
// not implemented yet
return NULL;
#else
if( n == 1 ) {
return dgettext( domain, origStr );
} else {
return dgettext( domain, origStrPlural );
}
#endif
}
#ifdef __ANDROID__
libintl_lite_bool_t bindtextdomain( const char *domain, const char *moFilePath )
{
return loadMessageCatalog( domain, moFilePath );
}
libintl_lite_bool_t bind_textdomain_codeset( const char *domain, const char *oFilePath )
{
return LIBINTL_LITE_BOOL_FALSE;
}
#endif
+127
View File
@@ -0,0 +1,127 @@
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBINTL_HPP_
#define LIBINTL_HPP_
#define LIBINTL_LITE_API
#if (defined(WIN32) || defined(WINCE)) && defined(LIBINTL_LITE_WIN32_SHARED)
#undef LIBINTL_LITE_API
#ifdef LIBINTL_LITE_EXPORTS
#define LIBINTL_LITE_API __declspec(dllexport)
#else
#define LIBINTL_LITE_API __declspec(dllimport)
#endif
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef int libintl_lite_bool_t;
#define LIBINTL_LITE_BOOL_TRUE 1
#define LIBINTL_LITE_BOOL_FALSE 0
/**
* Loads a message catalog from a given (GNU-compatible) .mo file.
* Returns true, if the message catalog was loaded successfully and
* false otherwise.
* This function is specific to libintl-lite and serves as a simple
* replacement for bindtextdomain() function of GNU gettext.
* The parameter "domain" must not be NULL!
* This function is NOT thread safe!
* Pay attention to the thread safety remarks of the gettext() function!
*/
LIBINTL_LITE_API libintl_lite_bool_t loadMessageCatalog( const char *domain,
const char *moFilePath );
/**
* Closes a message catalog for the specified domain and releases its obtained resources.
* This function is NOT thread safe!
* Pay attention to the thread safety remarks of the gettext() function!
*/
LIBINTL_LITE_API void closeLoadedMessageCatalog( const char *domain );
/**
* Closes all loaded message catalogs releases their obtained resources.
* This function is NOT thread safe!
* Pay attention to the thread safety remarks of the gettext() function!
*/
LIBINTL_LITE_API void closeAllLoadedMessageCatalogs();
/**
* Sets the default text domain for gettext() / ngettext() calls.
* This function is NOT thread safe!
*/
LIBINTL_LITE_API const char *textdomain( const char *domain );
/**
* Returns a pointer to the NULL-terminated string in the loaded for the default
* message catalog, or origString if origStr is NULL, textdomain() was not called,
* no message catalog for the specified domain is loaded or no translated message
* could be found.
* This function is thread-safe, but loadMessageCatalog(), textdomain(),
* closeLoadedMessageCatalog() or closeAllLoadedMessageCatalogs()
* must not be called at the same time! A returned string in the current
* loaded message catalog will be deleted, if loadMessageCatalog() or
* closeLoadedMessageCatalog() is called for the used domain afterwards!
* Does not perform any character set conversion!
*/
LIBINTL_LITE_API const char *gettext( const char *origStr );
/**
* Works like the gettext() function, but uses the message catalog for a specified domain.
*/
LIBINTL_LITE_API const char *dgettext( const char *domain, const char *origStr );
/**
* Works like the gettext() function, but distinguishes between singular
* and plural form of a message.
* Always returns the suitable singular string, if n == 1, and the plural string
* otherwise, regardless of the language.
*/
LIBINTL_LITE_API const char *ngettext( const char *origStr, const char *origStrPlural,
unsigned long n );
/**
* Works like the ngettext() function, but uses the message catalog for a specified domain.
*/
LIBINTL_LITE_API const char *dngettext( const char *domain, const char *origStr,
const char *origStrPlural, unsigned long n );
#ifdef __ANDROID__
// Two extra signatures required as per: http://blog.stuff-o-matic.com/post/2013/09/07/Porting-a-C-game-to-Android,-the-case-of-Andy-s-Super-Great-Park
LIBINTL_LITE_API libintl_lite_bool_t bindtextdomain( const char *domain, const char *moFilePath );
LIBINTL_LITE_API libintl_lite_bool_t bind_textdomain_codeset( const char *domain,
const char *moFilePath );
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif // LIBINTL_HPP_
+5 -9
View File
@@ -7,16 +7,14 @@ LOCAL_MODULE := main
LOCAL_CPP_FEATURES := exceptions rtti
# Add your application source files here...
CATA_SRCS := $(sort $(wildcard $(LOCAL_PATH)/*.cpp))
LOCAL_SRC_FILES := $(sort $(CATA_SRCS:$(LOCAL_PATH)/%=%))
FILE_LIST := $(sort $(wildcard $(LOCAL_PATH)/*.cpp))
LOCAL_SRC_FILES := $(sort $(FILE_LIST:$(LOCAL_PATH)/%=%))
LOCAL_STATIC_LIBRARIES := third-party
LOCAL_SHARED_LIBRARIES := libhidapi SDL2 SDL2_mixer SDL2_image SDL2_ttf libintl-lite mpg123
LOCAL_SHARED_LIBRARIES := libhidapi SDL2 SDL2_mixer SDL2_image SDL2_ttf mpg123
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog -lz
LOCAL_CFLAGS += -DTILES=1 -DSDL_SOUND=1 -DBACKTRACE=1 -DLOCALIZE=1 -Wextra -Wall -fsigned-char
LOCAL_CFLAGS += -DTILES=1 -DSDL_SOUND=1 -DBACKTRACE=1 -DLOCALIZE=1 -Wextra -Wall -fsigned-char -ffast-math
LOCAL_LDFLAGS += $(LOCAL_CFLAGS)
@@ -26,5 +24,3 @@ ifeq ($(OS),Windows_NT)
endif
include $(BUILD_SHARED_LIBRARY)
include $(LOCAL_PATH)/../android/app/jni/src/third-party/Android.mk
-24
View File
@@ -1,24 +0,0 @@
LOCAL_PATH := $(call my-dir)/../../../../../src/third-party
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/..
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_MODULE := third-party
LOCAL_CPP_FEATURES := exceptions rtti
# Add your application source files here...
FLATBUFFERS_SRCS := $(sort $(wildcard $(LOCAL_PATH)/flatbuffers/*.cpp))
LOCAL_SRC_FILES := $(sort $(FLATBUFFERS_SRCS:$(LOCAL_PATH)/%=%))
LOCAL_CFLAGS += -DBACKTRACE=1 -DLOCALIZE=1 -Wextra -Wall -fsigned-char
ifeq ($(OS),Windows_NT)
# needed to bypass 8191 character limit on Windows command line
LOCAL_SHORT_COMMANDS := true
endif
include $(BUILD_STATIC_LIBRARY)
+1 -1
View File
@@ -3,6 +3,7 @@
com.gamemaker.game
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cleverraven.cataclysmdda"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
@@ -43,7 +44,6 @@
android:keepScreenOn="true"
android:screenOrientation="userLandscape"
android:configChanges="keyboardHidden|keyboard|orientation|screenSize|navigation"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -13,8 +13,6 @@ import android.content.res.Configuration;
public class CataclysmDDA extends SDLActivity {
private static final String TAG = "CDDA";
private NativeUI nativeUI = new NativeUI(CataclysmDDA.this);
public void vibrate(int duration) {
try {
Vibrator v = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
@@ -63,8 +61,4 @@ public class CataclysmDDA extends SDLActivity {
public String getSystemLang() {
return getResources().getConfiguration().locale.toLanguageTag().replace('-', '_');
}
public NativeUI getNativeUI() {
return nativeUI;
}
}
@@ -1,29 +0,0 @@
package com.cleverraven.cataclysmdda;
import java.util.List;
import android.content.Context;
import android.view.accessibility.AccessibilityManager;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.pm.ServiceInfo;
import android.widget.Toast;
public class CataclysmDDA_Helpers {
public static List<AccessibilityServiceInfo> getEnabledAccessibilityServiceInfo(Context context) {
AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
List<AccessibilityServiceInfo> enabledServicesInfo = am.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
return enabledServicesInfo;
}
public static String getEnabledAccessibilityServiceNames(Context context) {
List<AccessibilityServiceInfo> enabledServicesInfo = getEnabledAccessibilityServiceInfo( context );
String service_names = "";
for (AccessibilityServiceInfo enabledService : enabledServicesInfo) {
ServiceInfo enabledServiceInfo = enabledService.getResolveInfo().serviceInfo;
String service_name = enabledServiceInfo.name;
service_names = service_names + "\n" + service_name;
}
return service_names;
}
}
@@ -1,162 +0,0 @@
package com.cleverraven.cataclysmdda;
import java.util.concurrent.Semaphore;
import android.app.AlertDialog;
import android.content.DialogInterface;
public class NativeUI {
enum YesNoDialogResponse {
YES,
NO
}
private CataclysmDDA activity;
NativeUI(CataclysmDDA activity) {
this.activity = activity;
}
private class Popup {
private Semaphore semaphore = new Semaphore(0, true);
public void popup(final String message) {
activity.runOnUiThread(new Runnable() {
public void run() {
AlertDialog dialog = new AlertDialog.Builder(activity, R.style.AlertDialogTheme)
.setTitle("")
.setCancelable(false)
.setMessage(message)
.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
semaphore.release();
}
}).create();
dialog.show();
}
});
try {
semaphore.acquire();
} catch (InterruptedException ex) {
// No-op
}
}
}
private class QueryYN {
private Semaphore semaphore = new Semaphore(0, true);
private YesNoDialogResponse response;
public boolean queryYN(final String message) {
activity.runOnUiThread(new Runnable() {
public void run() {
AlertDialog dialog = new AlertDialog.Builder(activity, R.style.AlertDialogTheme)
.setTitle("")
.setCancelable(false)
.setMessage(message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
response = YesNoDialogResponse.YES;
semaphore.release();
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
response = YesNoDialogResponse.NO;
semaphore.release();
}
}).create();
dialog.show();
}
});
try {
semaphore.acquire();
} catch (InterruptedException ex) {
// No-op
}
return response == YesNoDialogResponse.YES;
}
}
private class SingleChoiceList {
private Semaphore semaphore = new Semaphore(0, true);
private int singleChoiceResponse;
private final int cancel = -1;
private final int init = -2;
private String[] mixOptionsText(final String[] options, final boolean[] enabled) {
String[] result = new String[options.length];
for (int i = 0; i < options.length; i++) {
if (enabled[i]) {
result[i] = options[i];
} else {
result[i] = String.format("%s [%s]", options[i], activity.getString(R.string.unavailable));
}
}
return result;
}
public int singleChoiceList(final String text, final String[] options, final boolean[] enabled) {
singleChoiceResponse = init;
final String[] choices = mixOptionsText(options, enabled);
while (singleChoiceResponse == init
|| (singleChoiceResponse != cancel && enabled[singleChoiceResponse] == false)) {
activity.runOnUiThread(new Runnable() {
public void run() {
AlertDialog dialog = new AlertDialog.Builder(activity, R.style.AlertDialogTheme)
.setTitle(text)
.setItems(choices, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
singleChoiceResponse = which;
semaphore.release();
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
singleChoiceResponse = cancel;
semaphore.release();
}
})
.create();
dialog.show();
}
});
try {
semaphore.acquire();
} catch (InterruptedException ex) {
// No-op
}
if (singleChoiceResponse != cancel && enabled[singleChoiceResponse] == false) {
new Popup().popup(activity.getString(R.string.unavailableOption));
}
}
return singleChoiceResponse;
}
}
public void popup(final String message) {
final Popup popup = new Popup();
popup.popup(message);
}
public boolean queryYN(final String message) {
final QueryYN queryYN = new QueryYN();
return queryYN.queryYN(message);
}
public int singleChoiceList(final String text, final String[] options, final boolean[] enabled) {
final SingleChoiceList singleChoiceList = new SingleChoiceList();
return singleChoiceList.singleChoiceList(text, options, enabled);
}
}
@@ -20,7 +20,6 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.DialogInterface;
import android.content.DialogInterface.OnShowListener;
import android.content.pm.PackageInfo;
import android.content.res.AssetManager;
import android.net.Uri;
@@ -28,17 +27,13 @@ import android.os.*;
import android.preference.PreferenceManager;
import android.util.Log;
import com.cleverraven.cataclysmdda.CataclysmDDA_Helpers;
public class SplashScreen extends Activity {
private static final String TAG = "Splash";
private static final int INSTALL_DIALOG_ID = 0;
private ProgressDialog installDialog;
private AlertDialog accessibilityServicesAlert;
public CharSequence[] mSettingsNames;
public boolean[] mSettingsValues = { false, false, true, true };
public boolean[] mSettingsValues = { false, false, true };
private String getVersionName() {
try {
@@ -95,36 +90,10 @@ public class SplashScreen extends Activity {
}
@Override
protected void onStart() {
Log.e(TAG, "onStart()");
super.onStart();
}
@Override
protected void onPause() {
Log.e(TAG, "onPause()");
super.onPause();
accessibilityServicesAlert.dismiss();
}
@Override
protected void onResume() {
Log.e(TAG, "onResume()");
super.onResume();
Context context = getApplicationContext();
String service_names = CataclysmDDA_Helpers.getEnabledAccessibilityServiceNames(context);
accessibilityServicesAlert.setMessage( String.format( getString(R.string.accessibilityServicesMessage), service_names ) );
if (!service_names.isEmpty()) {
accessibilityServicesAlert.show();
} else {
SplashScreen.this.installOrRun();
}
}
protected void installOrRun() {
protected void onCreate(Bundle savedInstanceState) {
Log.e(TAG, "onCreate()");
accessibilityServicesAlert.dismiss();
super.onCreate(savedInstanceState);
// Start the game if already installed, otherwise start installing...
if (getVersionName().equals(PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("installed", ""))) {
// Show an alert box if the game crashed last time
@@ -139,30 +108,6 @@ public class SplashScreen extends Activity {
else {
new InstallProgramTask().execute();
}
return;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.e(TAG, "onCreate()");
super.onCreate(savedInstanceState);
accessibilityServicesAlert = new AlertDialog.Builder(SplashScreen.this)
.setTitle(getString(R.string.accessibilityServicesTitle))
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SplashScreen.this.installOrRun();
return;
}
})
.setNeutralButton(getString(R.string.showAccessibilitySettings), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivityForResult(new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS), 0);
dialog.dismiss();
return;
}
}).create();
}
@Override
@@ -257,8 +202,7 @@ public class SplashScreen extends Activity {
mSettingsNames = new CharSequence[] {
getString(R.string.softwareRendering),
getString(R.string.forceFullscreen),
getString(R.string.trapBackButton),
getString(R.string.nativeAndroidUI)
getString(R.string.trapBackButton)
};
settingsAlert = new AlertDialog.Builder(SplashScreen.this)
@@ -274,7 +218,6 @@ public class SplashScreen extends Activity {
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Software rendering", SplashScreen.this.mSettingsValues[0]).commit();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Force fullscreen", SplashScreen.this.mSettingsValues[1]).commit();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Trap Back button", SplashScreen.this.mSettingsValues[2]).commit();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Native Android UI", SplashScreen.this.mSettingsValues[3]).commit();
SplashScreen.this.startGameActivity(false);
return;
}
@@ -146,6 +146,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
"SDL2_mixer",
// "SDL2_net",
"SDL2_ttf",
"intl-lite",
"main"
};
}
@@ -12,7 +12,4 @@
<string name="showHelp">Zeige Hilfe</string>
<string name="crashAlert">Das Spiel wurde beim letzten Mal nicht richtig beendet</string>
<string name="crashMessage">Der Crash Report der sich in ./config/crash.log befindet könnten den Entwicklern helfen Programmfehler zu beheben.</string>
<string name="yes">Ja</string>
<string name="no">Nein</string>
<string name="cancel">Abbrechen</string>
</resources>
</resources>
@@ -12,7 +12,4 @@
<string name="showHelp">Mostrar ayuda</string>
<string name="crashAlert">El juego no fue cerrado correctamente la última vez</string>
<string name="crashMessage">El registro del error localizado en ./config/crash.log puede ayudar a los desarrolladores a solucionar errores.</string>
<string name="yes">Sí</string>
<string name="no">No</string>
<string name="cancel">Cancelar</string>
</resources>
</resources>
@@ -12,7 +12,4 @@
<string name="showHelp">Mostrar ayuda</string>
<string name="crashAlert">El juego no finalizó correctamente la última vez</string>
<string name="crashMessage">El informe de fallos que se encuentra en ./config/crash.log puede ayudar a los desarrolladores a solucionar los errores del programa. </string>
<string name="yes">Sí</string>
<string name="no">No</string>
<string name="cancel">Cancelar</string>
</resources>
</resources>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="installTitle">Installation des données de jeu ...</string>
<string name="softwareRendering">Rendu logiciel</string>
<string name="forceFullscreen">Forcer plein écran</string>
<string name="settings">Réglages</string>
<string name="startGame">Démarrer le jeu</string>
<string name="yes">Oui</string>
<string name="no">Non</string>
<string name="cancel">Annuler</string>
</resources>
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="installTitle">memasang data game</string>
<string name="upgradeTitle">mengupgrade data game</string>
<string name="helpTitle">Bantuan &amp; Kontrol</string>
<string name="helpMessage">\"Geser\" untuk pergerakan arah (tahan untuk joystik virtual). \"Tekan\" untuk konfirmasi pilihan di menu atau Jeda satu giliran dalam game (tahan untuk Jeda beberapa giliran dalam game). \"Dua Kali Tap\" untuk batal atau ke menu (seperti tombol Escape). \"Cubit\" untuk perbesar/perkecil tampilan (dalam game). Tombol \"Kembali\" di hp untuk menampilkan keyboard virtual (tahan untuk menampilkan jalan pintas keyboard\").</string>
<string name="softwareRendering">Render Perangkat Lunak</string>
<string name="forceFullscreen">Paksa Layar Penuh</string>
<string name="settings">Pengaturan</string>
<string name="startGame">Mulai game</string>
<string name="showHelp">Tampilkan Bantuan</string>
<string name="crashAlert">Game tidak keluar dengan benar</string>
<string name="crashMessage">Laporan Crash berada di ./config/crash.log mungkin dapat membantu pengembang memecahkan masalah pada program.</string>
</resources>
@@ -12,7 +12,4 @@
<string name="showHelp">Mostra aiuto</string>
<string name="crashAlert">Il gioco non è stato chiuso correttamente l\'ultima volta</string>
<string name="crashMessage">Il crash report localizzato in ./config/crash.log può aiutare gli sviluppatori a comprendere gli errori di programmazione.</string>
<string name="yes">Sì</string>
<string name="no">No</string>
<string name="cancel">Annulla</string>
</resources>
</resources>
@@ -2,7 +2,7 @@
<resources>
<string name="installTitle">ゲームデータをインストール中...</string>
<string name="upgradeTitle">ゲームデータをアップグレード中...</string>
<string name="helpTitle">ヘルプ&amp;操作</string>
<string name="helpTitle">ヘルプ &amp; 操作</string>
<string name="helpMessage">特定方向にスワイプ(仮想ジョイスティックの場合は長押し)で移動。タップで選択項目の決定と1ターンその場で静止(長押しで数ターン静止)。ダブルタップでキャンセルとメニューに戻る(Escキー機能)。ピンチでズームイン/アウト(ゲーム内画面)。戻るボタンで仮想キーボード切替(長押しでキーボードショートカット切替)。</string>
<string name="softwareRendering">ソフトウェアレンダリング</string>
<string name="forceFullscreen">強制フルスクリーン</string>
@@ -12,7 +12,4 @@
<string name="showHelp">ヘルプ表示</string>
<string name="crashAlert">前回のプレイ時にゲームが正常に終了しませんでした</string>
<string name="crashMessage">configフォルダ内のcrash.logに記録されるクラッシュレポートは、開発者がプログラムエラーを解決する役に立つ場合があります。</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="cancel">取消</string>
</resources>
</resources>
@@ -3,20 +3,13 @@
<string name="installTitle">Instalowanie danych gry...</string>
<string name="upgradeTitle">Aktualizowanie danych gry...</string>
<string name="helpTitle">Pomoc &amp; sterowanie</string>
<string name="helpMessage">Przesuń, by sterować w boku (przytrzymaj do wirtualnego joysticka). Stuknij, by potwierdzić wybór w menu albo spauzować jedną turę w grze (trzymaj, by spauzować kilka tur w grze). Stuknij dwa razy, by anulować albo wrócić do menu (działa jak klawisz Escape). Szczypnij, by zbliżyć/oddalić (w grze). Użyj fizycznego przycisku wstecz, by włączyć wirtualną klawiaturę (przytrzymaj, by przełączyć skróty klawiszowe).</string>
<string name="helpMessage">"Przesuń" by sterować w boku (przytrzymaj do wirtualnego joysticka). "Stuknij" by potwierdzić wybór w menu albo spauzować jedną turę w grze (trzymaj by spauzować kilka tur w grze). "Stuknij dwa razy" by anulować albo wrócić do menu (działa jak przycisk Escape). "Szczypnij" by zbliżyć/oddalić (w grze). Użyj fizycznego przycisku "wstecz" by włączyć wirtualną klawiaturę (przytrzymaj by przełączyć skróty klawiszowe).</string>
<string name="softwareRendering">Renderowanie programowe</string>
<string name="forceFullscreen">Wymuś pełny ekran</string>
<string name="trapBackButton">Zablokuj przycisk wstecz</string>
<string name="nativeAndroidUI">Natywne menu interfejsu Androida</string>
<string name="settings">Ustawienia</string>
<string name="startGame">Zacznij grę</string>
<string name="showHelp">Pokaż pomoc</string>
<string name="crashAlert">Gra nie zamknęła się poprawnie ostatnim razem</string>
<string name="crashMessage">Raport awarii zlokalizowany w ./config/crash.log może pomóc twórcom naprawić błędy programu.</string>
<string name="yes">Tak</string>
<string name="no">Nie</string>
<string name="ok">OK</string>
<string name="cancel">Anuluj</string>
<string name="unavailable">Niedostępne</string>
<string name="unavailableOption">Wybrana opcja nie jest dostępna.</string>
<string name="crashMessage">Raport crashu zlokalizowany w ./config/crash.log może pomóc twórcom naprawić błędy programu.</string>
</resources>
@@ -12,7 +12,4 @@
<string name="showHelp">Mostrar ajuda</string>
<string name="crashAlert">O jogo não foi encerrado corretamente na última vez</string>
<string name="crashMessage">O relatório de erro localizado em ./config/crash.log pode ajudar desenvolvedores a solucionarem erros no programa.</string>
<string name="yes">Sim</string>
<string name="no">Não</string>
<string name="cancel">Cancelar</string>
</resources>
</resources>

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