From 1213223dfb2fbc54c4494492fd45fdc480e51aa4 Mon Sep 17 00:00:00 2001 From: Eggbertx Date: Mon, 26 Feb 2024 13:45:54 -0800 Subject: [PATCH] Cleanup make.py, set DOWNLOAD_EXTRACT_TIMESTAMP in CMakeLists.txt --- CMakeLists.txt | 1 + make.py | 52 ++++++++++++++++---------------------------------- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 061a84f..0de15f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip + DOWNLOAD_EXTRACT_TIMESTAMP true ) set(CMAKE_CXX_STANDARD 11) diff --git a/make.py b/make.py index 20f2c3a..52f2235 100755 --- a/make.py +++ b/make.py @@ -258,53 +258,33 @@ def clean(): fs_action("delete", del_file) if __name__ == "__main__": - action = "build" - try: - action = sys.argv.pop(1) - except Exception: # no argument was passed - pass - if(action.startswith("-") == False): - sys.argv.insert(1, action) - + actions = ("sdl", "curses", "gb", "c64", "test", "clean", "help") + action = "sdl" if len(sys.argv) == 1 else sys.argv.pop(1) + platform = "native" parser = argparse.ArgumentParser(description = "OmniChip-8 build script") - parser.add_argument("action", - nargs = 1, - default = "build", - choices = ("build", "clean", "test")) - - if action == "--help" or action == "-h": - parser.print_help() - exit(2) - elif action == "build": - parser.add_argument("--platform", - help="the platform to build for", - choices=("c64", "gb", "native", "sim6502"), - default="native") - parser.add_argument("--library", - help="the library to use when platform = native.", - choices=("sdl", "curses"), - default="sdl") + if action == "sdl" or action == "curses": parser.add_argument("--debug", - help="build OmniChip-8 with debugging symbols", + help="Build OmniChip-8 with debugging symbols", default=False, action="store_true") - parser.add_argument("--embed", - help="embed a ROM file in OmniChip-8 for platforms that don't have file access (GameBoy, Commodore 64, etc)", - default="games/omnichip8") - args = parser.parse_args() - build(args.platform, args.library, args.debug, args.embed) elif action == "test": - parser.add_argument("--print-opcodes", - help="print opcodes when testing the CHIP-8 ROM execution", + parser.add_argument("--quiet", + help="Don't print opcodes, just the test results", default=False, action="store_true") args = parser.parse_args() - run_tests(args.print_opcodes) + run_tests(not args.quiet) + exit(0) elif action == "clean": clean() exit(0) else: - parser.print_help() - exit(0) + parser.add_argument("--embed", + help="embed a ROM file in OmniChip-8 for platforms that don't have file access (GameBoy, Commodore 64, etc)", + default="games/omnichip8") args = parser.parse_args() + build(platform, + args.__dict__.get("library", "sdl"), + args.__dict__.get("debug", False), + args.__dict__.get("embed", "games/omnichip8"))