From 0efd60d41d67a0c5fc1227098e874c990b3883e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fa=20Oru=C3=A7?= Date: Fri, 27 Sep 2024 21:59:43 +0300 Subject: [PATCH] Adjust vcpkg scripts --- FetchDependencies.sh | 2 - README.md | 79 ++++++++---------- scripts/vcpkg.ps1 | 119 +++++++++++++++++++++++++++ scripts/vcpkg.sh | 190 ++++++++++++++++++++++++++----------------- 4 files changed, 270 insertions(+), 120 deletions(-) delete mode 100644 FetchDependencies.sh create mode 100644 scripts/vcpkg.ps1 diff --git a/FetchDependencies.sh b/FetchDependencies.sh deleted file mode 100644 index 14fc08ae..00000000 --- a/FetchDependencies.sh +++ /dev/null @@ -1,2 +0,0 @@ -./scripts/vcpkg.sh $1 $2 $3 -read -rsp $'Press any key to continue...\n' -n1 key \ No newline at end of file diff --git a/README.md b/README.md index b7abd64d..36c3a289 100644 --- a/README.md +++ b/README.md @@ -12,27 +12,29 @@ **NeoDoa** is still under development and is not ready for producing games, but it will be 😎 Below are the finished and upcoming features. * **Graphics** - * OpenGL 4.5 Core Profile based renderer - * Agressive Instancing and Batched Rendering!! - * WIP: Point and spot and custom lights - * WIP: High Quality Text Rendering using [Signed Distance Fields](https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf) - * WIP: Shadows - * WIP: Waters - * WIP: Skybox - * WIP: Deferred Shading - * WIP: Skeletal Animations + * **Hot-swappable graphics backends** + * OpenGL 4.6 Core Profile + * WIP: OpenGL 3.3 Core Profile + * WIP: Direct3D12 + * WIP: Direct3D11 + * WIP: Vulkan * **Collision & Physics** * WIP: With PhysX * **Audio** * WIP: With OpenAL * **Asset Loading** + * **Don't bother** - automatic importing and categorizing of assets + * **Have control** - import/load/unload assets at will + * **Don't pollute** - use ubiquitous file formats, without needing special formats only NeoDoa can interpret + * **Never crash** - get nice error lists on why loads have failed and placeholders for unloaded assets * 3D models loading via [Assimp](https://www.assimp.org/) * Texture loading via [stb_image](https://github.com/nothings/stb) * **Scripting system** - * Scripting via [AngelScript](https://www.angelcode.com/angelscript/) - * With true ECS! + * Pure ECS + * Define components and implement systems in C++ * **Input** - * Mouse, Keyboard. + * Mouse + * Keyboard * WIP: Controller * WIP: Joystick * **Editor** @@ -79,6 +81,7 @@ After this, `git pull` should print `Already up to date.` Proceed to the next st **If you are using Windows, please skip this step.** **NeoDoa** requires various installations from `apt-get` to compile. These are listed below: +> libc++-dev libc++abi-dev > build-essential > curl zip unzip tar > pkg-config @@ -87,7 +90,7 @@ After this, `git pull` should print `Already up to date.` Proceed to the next st > xorg xorg-dev > libglu1-mesa libglu1-mesa-dev > autoconf autoconf-archive -> +> automake libtool libltdl-dev These can either be install manually or by launching the helper script by executing: ```sh @@ -98,34 +101,28 @@ sh ./scripts/fetch_apt_get.sh #### 3. Fetching Dependencies **NeoDoa** uses `vcpkg` to manage packages and depends on packages listed below: -> angelscript[addons] -> argparse -> assimp -> imgui[core,docking-experimental,glfw-binding,opengl3-binding] -> imguizmo -> entt -> eventpp -> glew -> glfw3 -> glm -> icu -> lunasvg -> stb +> angelscript[addons], +> argparse, +> assimp, +> cppzmq, +> entt, +> eventpp, +> glew, +> glfw3, +> glm, +> icu, +> imgui[core,docking-experimental,glfw-binding,sdl2-binding,opengl3-binding,vulkan-binding], +> imguizmo, +> lunasvg, +> stb, > tinyxml2 -The packages above must be installed by launching the helper script [`FetchDependencies.sh`](https://github.com/aeris170/NeoDoa/blob/master/FetchDependencies.sh). This script takes two arguments -`platform` and `clonemode`. `platform` defaults to `x64-windows` and can be overriden to `x64-linux` or your OS of choosing -by passing it as the first argument. `clonemode` governs how the script should try to clone `vcpkg` repository. Passing nothing -defaults to `https`, only `https` and `ssh` are accepted. +The packages above must be installed by launching the helper script [`vcpkg.sh`](https://github.com/aeris170/NeoDoa/blob/master/scripts/vcpkg.sh) or +[`vcpkg.ps1`](https://github.com/aeris170/NeoDoa/blob/master/scripts/vcpkg.ps1). The script takes two arguments `clonemode` and `vcpkg-dir`. -Examples: -```sh -chmod +x ./FetchDependencies.sh -sh FetchDependencies.sh # Fetch packages for x64-windows using https -sh FetchDependencies.sh x64-windows ssh # Fetch packages for x64-windows using ssh (must have an ssh key set-up) -sh FetchDependencies.sh x64-linux # Fetch packages for x64-linux using https (doesn't work on our test systems) -sh FetchDependencies.sh x64-linux ssh # Fetch packages for x64-linux using ssh (must have an ssh key set-up) -``` +* `clonemode` controls how to clone the `vcpkg` repository. Passing nothing defaults to `ssh`, only `https` and `ssh` are accepted. + +* `vcpkg-dir` controls where to clone the `vcpkg` repository. Passing nothing defaults to `./vcpkg`. You should see no errors when this scripts completes. If you do, please create an issue [here](https://github.com/aeris170/NeoDoa/issues). @@ -190,8 +187,4 @@ Please follow these steps to report a bug 2. **Create a testcase** - please create the smallest isolated testcase that you can that reproduces your bug -3. **Share as much information as possible** - everything little helps, OS, IDE, GPU, all that stuff. - -## NeoDoa Platform - -**NeoDoa** is an open source cross-platform game engine which you can use to develop games on Windows, Linux and MacOS (although untested on). +3. **Share as much information as possible** - everything little helps, OS, IDE, GPU, all that stuff. \ No newline at end of file diff --git a/scripts/vcpkg.ps1 b/scripts/vcpkg.ps1 new file mode 100644 index 00000000..526da1ca --- /dev/null +++ b/scripts/vcpkg.ps1 @@ -0,0 +1,119 @@ +# Enable detailed error output and logging +$VerbosePreference = "Continue" +$DebugPreference = "Continue" +$ErrorActionPreference = "Stop" # Keep stop behavior to catch errors + +# Check if clonemode argument is provided +if (-not $args[0]) { + Write-Host "No clonemode supplied, defaulting to ssh" -ForegroundColor yellow -BackgroundColor black + $clonemode = "ssh" +} else { + $clonemode = $args[0] +} + +# Check if vcpkg path argument is provided +if (-not $args[1]) { + Write-Host "No vcpkg path supplied, defaulting to ./vcpkg" -ForegroundColor yellow -BackgroundColor black + $path = "./vcpkg" +} else { + $path = $args[1] +} + +Write-Host "Clonemode: $clonemode" -ForegroundColor white -BackgroundColor black +Write-Host "vcpkg path: $path" -ForegroundColor white -BackgroundColor black + +# Create the directory if it doesn't exist +if (-not (Test-Path -Path $path)) { + Write-Host "Creating directory: $path" -ForegroundColor white -BackgroundColor black + New-Item -Path $path -ItemType Directory | Out-Null +} else { + Write-Host "Directory already exists: $path" -ForegroundColor yellow -BackgroundColor black +} + +# Change directory to the vcpkg path +Write-Host "Changing to directory: $path" -ForegroundColor white -BackgroundColor black +Set-Location -Path $path + +# Clone vcpkg using the provided clonemode +Write-Host "Cloning vcpkg..." -ForegroundColor white -BackgroundColor black +if ($clonemode -eq "ssh") { + Start-Process -FilePath "git" -ArgumentList "clone git@github.com:microsoft/vcpkg.git ." ` + -NoNewWindow -Wait -PassThru | Tee-Object -Variable cloneOutput +} elseif ($clonemode -eq "https") { + Start-Process -FilePath "git" -ArgumentList "clone https://github.com/Microsoft/vcpkg.git ." ` + -NoNewWindow -Wait -PassThru | Tee-Object -Variable cloneOutput +} else { + Write-Host "Incorrect clonemode! Expected https or ssh, got something else" -ForegroundColor red -BackgroundColor black + Set-Location -Path .. + exit 1 +} + +# Check if clone was successful +if ($cloneOutput.ExitCode -ne 0) { + Write-Host "Error during git clone: $($cloneOutput.StandardError)" -ForegroundColor red -BackgroundColor black + Set-Location -Path .. + exit 1 +} + +# Pull the latest changes +Write-Host "Pulling latest vcpkg changes..." -ForegroundColor white -BackgroundColor black +$pullOutput = Start-Process -FilePath "git" -ArgumentList "pull" -NoNewWindow -Wait -PassThru +if ($pullOutput.ExitCode -ne 0) { + Write-Host "Error during git pull: $($pullOutput.StandardError)" -ForegroundColor red -BackgroundColor black + Set-Location -Path .. + exit 1 +} + +# Run the bootstrap script +if (Test-Path -Path "./bootstrap-vcpkg.bat") { + Write-Host "Running bootstrap-vcpkg.bat..." -ForegroundColor white -BackgroundColor black + $bootstrapOutput = Start-Process -FilePath "./bootstrap-vcpkg.bat" -NoNewWindow -Wait -PassThru + if ($bootstrapOutput.ExitCode -ne 0) { + Write-Host "Error during bootstrap: $($bootstrapOutput.StandardError)" -ForegroundColor red -BackgroundColor black + Set-Location -Path .. + exit 1 + } +} else { + Write-Host "Bootstrap script not found!" -ForegroundColor red -BackgroundColor black + Set-Location -Path .. + exit 1 +} + +# Install required packages +Write-Host "Installing required vcpkg packages..." -ForegroundColor white -BackgroundColor black +$installOutput = Start-Process -FilePath "./vcpkg.exe" -ArgumentList @( + 'install', + 'angelscript[addons]', + 'argparse', + 'assimp', + 'cppzmq', + 'entt', + 'eventpp', + 'glew', + 'glfw3', + 'glm', + 'icu', + 'imgui[core,docking-experimental,glfw-binding,sdl2-binding,opengl3-binding,vulkan-binding]', + 'imguizmo', + 'lunasvg', + 'stb', + 'tinyxml2', + '--recurse' +) -NoNewWindow -Wait -PassThru +if ($installOutput.ExitCode -ne 0) { + Write-Host "Error during vcpkg install: $($installOutput.StandardError)" -ForegroundColor red -BackgroundColor black + Set-Location -Path .. + exit 1 +} + +# Integrate vcpkg +Write-Host "Integrating vcpkg..." -ForegroundColor white -BackgroundColor black +$integrateOutput = Start-Process -FilePath "./vcpkg.exe" -ArgumentList 'integrate', 'install' -NoNewWindow -Wait -PassThru +if ($integrateOutput.ExitCode -ne 0) { + Write-Host "Error during vcpkg integrate: $($integrateOutput.StandardError)" -ForegroundColor red -BackgroundColor black + Set-Location -Path .. + exit 1 +} + +# Notify completion +Write-Host "vcpkg setup complete!" -ForegroundColor green -BackgroundColor black diff --git a/scripts/vcpkg.sh b/scripts/vcpkg.sh index 79385218..3741ae04 100644 --- a/scripts/vcpkg.sh +++ b/scripts/vcpkg.sh @@ -1,92 +1,132 @@ -if [ -z "$1" ]; then - echo "No triplet supplied, defaulting to x64-windows" - platform="x64-windows" -else - platform=$1 -fi +WHITE="\033[1;37m" +YELLOW="\033[1;33m" +GREEN="\033[1;32m" +RED="\033[1;31m" +RESET="\033[0m" -if [ -z "$2" ]; then - echo "No clonemode supplied, defaulting to https" +# Check if clonemode argument is provided +if [ -z "$1" ]; then + echo -e "${YELLOW}No clonemode supplied, defaulting to https${RESET}" clonemode="https" else - clonemode=$2 + clonemode=$1 fi -if [ -z "$3" ]; then - echo "No vcpkg path supplied, defaulting to ./vcpkg" +# Check if vcpkg path argument is provided +if [ -z "$2" ]; then + echo -e "${YELLOW}No vcpkg path supplied, defaulting to ./vcpkg${RESET}" path="./vcpkg" else - path=$3 + path=$2 fi -mkdir -p $path -cd $path -if [ "$clonemode" = "https" ]; then - git clone https://github.com/Microsoft/vcpkg.git . -elif [ "$clonemode" = "ssh" ]; then - git clone git@github.com:microsoft/vcpkg.git . +echo -e "${WHITE}Clonemode: $clonemode${RESET}" +echo -e "${WHITE}vcpkg path: $path${RESET}" + +# Check if the directory exists, if not, create it +if [ ! -d "$path" ]; then + echo -e "${WHITE}Creating directory: $path${RESET}" + mkdir -p "$path" else - echo '\033[0;31mIncorrect clonemode! Expected https or ssh got something else!' - exit + echo -e "${YELLOW}Directory already exists: $path${RESET}" fi -git pull -chmod +x bootstrap-vcpkg.sh -./bootstrap-vcpkg.sh -./vcpkg integrate install +# Change directory to the vcpkg path +echo -e "${WHITE}Changing to directory: $path${RESET}" +cd "$path" -echo "Installing AngelScript" -./vcpkg install angelscript[addons] --triplet $platform --recurse - -echo "Installing argparse" -./vcpkg install argparse --triplet $platform - -echo "Installing Assimp" -./vcpkg install assimp --triplet $platform - -echo "Installing ImGui" -# Base ImGui package list -imgui_packages="core,docking-experimental,glfw-binding,sdl2-binding,opengl3-binding,vulkan-binding" - -# Add DirectX bindings if the triplet is x64-windows -if [ "$platform" = "x64-windows" ]; then - imgui_packages="$imgui_packages,dx11-binding,dx12-binding" +# Clone vcpkg using the provided clonemode +echo -e "${WHITE}Cloning vcpkg...${RESET}" +if [ "$clonemode" = "ssh" ]; then + git clone git@github.com:microsoft/vcpkg.git . 2>&1 | tee cloneOutput.log +elif [ "$clonemode" = "https" ]; then + git clone https://github.com/Microsoft/vcpkg.git . 2>&1 | tee cloneOutput.log +else + echo -e "${RED}Incorrect clonemode! Expected https or ssh, got something else${RESET}" + cd .. + exit 1 fi -# Install the ImGui packages -./vcpkg install imgui[$imgui_packages] --triplet $platform --recurse -./vcpkg install imguizmo --triplet $platform - -echo "Installing EnTT" -./vcpkg install entt --triplet $platform - -echo "Istalling Eventpp" -./vcpkg install eventpp --triplet $platform - -echo "Installing GLEW" -./vcpkg install glew --triplet $platform - -echo "Installing GLFW" -./vcpkg install glfw3 --triplet $platform - -echo "Installing GLM" -./vcpkg install glm --triplet $platform - -echo "Installing ICU" -./vcpkg install icu --triplet $platform - -echo "Installing LunaSVG" -./vcpkg install lunasvg --triplet $platform - -echo "Installing STB" -./vcpkg install stb --triplet $platform - -echo "Installing TinyXML2" -./vcpkg install tinyxml2 --triplet $platform - -echo "Installing ZeroMQ (cppzmp)" -./vcpkg install cppzmq --triplet $platform +# Check if clone was successful +if [ $? -ne 0 ]; then + echo -e "${RED}Error during git clone.${RESET}" + cat cloneOutput.log + rm cloneOutput.log + cd .. + exit 1 +fi +rm cloneOutput.log + +# Pull the latest changes +echo -e "${WHITE}Pulling latest vcpkg changes...${RESET}" +git pull 2>&1 | tee pullOutput.log +if [ $? -ne 0 ]; then + echo -e "${RED}Error during git pull.${RESET}" + cat pullOutput.log + rm pullOutput.log + cd .. + exit 1 +fi +rm pullOutput.log + +# Run the bootstrap script +if [ -f "./bootstrap-vcpkg.sh" ]; then + echo -e "${WHITE}Running bootstrap-vcpkg.sh...${RESET}" + ./bootstrap-vcpkg.sh 2>&1 | tee bootstrapOutput.log + if [ $? -ne 0 ]; then + echo -e "${RED}Error during bootstrap.${RESET}" + cat bootstrapOutput.log + rm bootstrapOutput.log + cd .. + exit 1 + fi + rm bootstrapOutput.log +else + echo -e "${RED}Bootstrap script not found!${RESET}" + cd .. + exit 1 +fi -./vcpkg upgrade +# Install required packages +echo -e "${WHITE}Installing required vcpkg packages...${RESET}" +./vcpkg install \ + 'angelscript[addons]' \ + 'argparse' \ + 'assimp' \ + 'cppzmq' \ + 'entt' \ + 'eventpp' \ + 'glew' \ + 'glfw3' \ + 'glm' \ + 'icu' \ + 'imgui[core,docking-experimental,glfw-binding,sdl2-binding,opengl3-binding,vulkan-binding]' \ + 'imguizmo' \ + 'lunasvg' \ + 'stb' \ + 'tinyxml2' \ + --recurse 2>&1 | tee installOutput.log + +if [ $? -ne 0 ]; then + echo -e "${RED}Error during vcpkg install.${RESET}" + cat installOutput.log + rm installOutput.log + cd .. + exit 1 +fi +rm installOutput.log + +# Integrate vcpkg +echo -e "${WHITE}Integrating vcpkg...${RESET}" +./vcpkg integrate install 2>&1 | tee integrateOutput.log +if [ $? -ne 0 ]; then + echo -e "${RED}Error during vcpkg integrate.${RESET}" + cat integrateOutput.log + rm integrateOutput.log + cd .. + exit 1 +fi +rm integrateOutput.log -./vcpkg integrate install \ No newline at end of file +# Notify completion +echo -e "${GREEN}vcpkg setup complete!${RESET}"