MCPcopy Create free account
hub / github.com/cactus-compute/cactus / cmd_build

Function cmd_build

python/src/cli.py:722–894  ·  view source on GitHub ↗

Build the Cactus library and chat binary.

(args)

Source from the content-addressed store, hash-verified

720
721
722def cmd_build(args):
723 """Build the Cactus library and chat binary."""
724 if getattr(args, 'apple', False):
725 return cmd_build_apple(args)
726 if getattr(args, 'android', False):
727 return cmd_build_android(args)
728 if getattr(args, 'flutter', False):
729 return cmd_build_flutter(args)
730 if getattr(args, 'python', False):
731 return cmd_build_python(args)
732
733 print_color(BLUE, "Building Cactus chat...")
734 print("=" * 23)
735
736 if not check_command('cmake'):
737 print_color(RED, "Error: CMake is not installed")
738 print(" macOS: brew install cmake")
739 print(" Ubuntu: sudo apt-get install cmake build-essential")
740 return 1
741
742 if not check_libcurl():
743 print_color(RED, "Error: libcurl development libraries not found")
744 print(" macOS: brew install curl")
745 print(" Ubuntu: sudo apt-get install libcurl4-openssl-dev")
746 return 1
747
748 cactus_dir = PROJECT_ROOT / "cactus"
749 lib_path = cactus_dir / "build" / "libcactus.a"
750 vendored_curl = PROJECT_ROOT / "libs" / "curl" / "macos" / "libcurl.a"
751
752 print_color(YELLOW, "Building Cactus library...")
753 build_script = cactus_dir / "build.sh"
754 if not build_script.exists():
755 print_color(RED, f"Error: build.sh not found at {build_script}")
756 return 1
757 result = run_command(str(build_script), cwd=cactus_dir, check=False)
758 if result.returncode != 0:
759 print_color(RED, "Failed to build cactus library")
760 return 1
761
762 tests_dir = PROJECT_ROOT / "tests"
763 build_dir = tests_dir / "build"
764 build_dir.mkdir(parents=True, exist_ok=True)
765
766 print("Compiling chat.cpp...")
767
768 chat_cpp = tests_dir / "chat.cpp"
769 if not chat_cpp.exists():
770 print_color(RED, f"Error: chat.cpp not found at {chat_cpp}")
771 return 1
772
773 is_darwin = platform.system() == "Darwin"
774
775 sdl2_available = False
776 sdl2_flags = []
777 sdl2_link = []
778 if is_darwin:
779 sdl2_check = subprocess.run(["brew", "list", "sdl2"], capture_output=True)

Callers 2

_ensure_chat_binaryFunction · 0.85
mainFunction · 0.85

Calls 8

cmd_build_appleFunction · 0.85
cmd_build_androidFunction · 0.85
cmd_build_flutterFunction · 0.85
cmd_build_pythonFunction · 0.85
print_colorFunction · 0.85
check_commandFunction · 0.85
check_libcurlFunction · 0.85
run_commandFunction · 0.85

Tested by

no test coverage detected