diff --git a/README.md b/README.md index 91f6fc8..7e607cd 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,13 @@ Run the appropriate script for your platform: ``` ./configure.bat ``` +Run +``` +python tools/dev_tools.py configure configure +``` +Select your build system (e.g. Visual Studio, XCode, Ninja, Make,...) and press return. + +This will create the CMakeUserPresets.json 3. Build the project with CMake: Create a build directory, configure the project, and build it: diff --git a/tools/src/package_managers_initializers/package_manager.py b/tools/src/package_managers_initializers/package_manager.py index 54a4f52..d7f7d8c 100644 --- a/tools/src/package_managers_initializers/package_manager.py +++ b/tools/src/package_managers_initializers/package_manager.py @@ -160,7 +160,7 @@ def generate_cmake_user_presets(inherit_from="",toolchain_file=None): "jobs": cpus, }) - cmake_user_presets_path = os.path.join(__file__,"..","..","..","..", "CMakeUserPresets.json") + cmake_user_presets_path = os.path.abspath(os.path.join(__file__,"..","..","..","..", "CMakeUserPresets.json")) import json with open(cmake_user_presets_path, 'w') as f: json.dump(cmake_presets_json, f, indent=2) diff --git a/tools/src/project_management/configure_project.py b/tools/src/project_management/configure_project.py index 421e12d..5e3cb55 100644 --- a/tools/src/project_management/configure_project.py +++ b/tools/src/project_management/configure_project.py @@ -64,4 +64,4 @@ def list_generators(): for gen in generator_list: console.print(f" - {gen}") if __name__ == "__main__": - cli() + cli() \ No newline at end of file diff --git a/tools/src/project_management/project_configuration.py b/tools/src/project_management/project_configuration.py index 4888005..e172ec6 100644 --- a/tools/src/project_management/project_configuration.py +++ b/tools/src/project_management/project_configuration.py @@ -33,10 +33,10 @@ class ProjectConfig: @classmethod def load(cls, file_path: str) -> 'ProjectConfig': """Load configuration from a JSON file.""" - if not os.path.exists(file_path): + if not os.path.exists(os.path.abspath(file_path)): raise FileNotFoundError(f"Configuration file not found: {file_path}") - with open(file_path, 'r') as f: + with open(os.path.abspath(file_path), 'r') as f: data = json.load(f) return cls( diff --git a/tools/src/wizard/wizard.py b/tools/src/wizard/wizard.py deleted file mode 100644 index 9b8a21a..0000000 --- a/tools/src/wizard/wizard.py +++ /dev/null @@ -1,95 +0,0 @@ -import click -from typing import List, Dict, Any, Callable -from dataclasses import dataclass -from abc import ABC, abstractmethod - - -@dataclass -class WizardStep: - """Represents a single step in the wizard""" - name: str - prompt: str - type: type - validator: Callable[[Any], bool] = lambda x: True - choices: List[str] = None - default: Any = None - help_text: str = "" - - -class BaseWizard(ABC): - """Base class for creating wizards""" - - def __init__(self, title: str): - self.title = title - self.steps: List[WizardStep] = [] - self.results: Dict[str, Any] = {} - self.setup_steps() - - @abstractmethod - def setup_steps(self) -> None: - """Define the wizard steps - must be implemented by subclasses""" - pass - - @abstractmethod - def process_results(self) -> None: - """Process the collected results - must be implemented by subclasses""" - pass - - def add_step(self, step: WizardStep) -> None: - """Add a step to the wizard""" - self.steps.append(step) - - def run(self) -> Dict[str, Any]: - """Run the wizard and collect inputs""" - click.echo(f"\n=== {self.title} ===\n") - - for step in self.steps: - while True: - try: - if step.help_text: - click.echo(f"Help: {step.help_text}") - if step.choices: - click.echo(f"Choices: {', '.join(step.choices)}") - value = click.prompt( - step.prompt, - type=click.Choice(step.choices), - default=step.default - ) - else: - value = click.prompt( - step.prompt, - type=step.type, - default=step.default - ) - - if step.validator(value): - self.results[step.name] = value - break - else: - click.echo("Invalid input. Please try again.") - except click.Abort: - if click.confirm("Do you want to exit the wizard?"): - raise click.Abort() - except Exception as e: - click.echo(f"Error: {str(e)}") - if not click.confirm("Do you want to try again?"): - raise click.Abort() - - self.process_results() - return self.results - - -def wizard_command(wizard_class): - """Decorator to create a click command from a wizard class""" - - @click.command() - def wrapper(): - try: - wizard = wizard_class() - wizard.run() - except click.Abort: - click.echo("\nWizard cancelled.") - return - - return wrapper -