From 902c25af57c208adad641a69b523743dfcab04a8 Mon Sep 17 00:00:00 2001 From: ThatCodingFrog Date: Thu, 8 Oct 2026 19:04:32 -0600 Subject: [PATCH] Add building docs v1.0; cleanup old build code No more local vcpkg bloat! --- .gitmodules | 3 -- CMake/setup_vcpkg.cmake | 42 --------------------- buildLinux-debug.sh | 37 ------------------- buildLinux-release.sh | 37 ------------------- buildWindows-debug.bat | 25 ------------- buildWindows-release.bat | 25 ------------- docs/BUILDING.md | 80 ++++++++++++++++++++++++++++++++++------ 7 files changed, 68 insertions(+), 181 deletions(-) delete mode 100644 .gitmodules delete mode 100644 CMake/setup_vcpkg.cmake delete mode 100644 buildLinux-debug.sh delete mode 100644 buildLinux-release.sh delete mode 100644 buildWindows-debug.bat delete mode 100644 buildWindows-release.bat diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 400c836..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "external/11Zip/extlibs/minizip"] - path = external/11Zip/extlibs/minizip - url = https://github.com/zlib-ng/minizip-ng.git diff --git a/CMake/setup_vcpkg.cmake b/CMake/setup_vcpkg.cmake deleted file mode 100644 index 9a5c64a..0000000 --- a/CMake/setup_vcpkg.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# --- CMake/setup_vcpkg.cmake --- -cmake_minimum_required(VERSION 3.16) - -# Directory where vcpkg should live -set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/external/vcpkg") - -# If vcpkg folder doesn't exist, clone and bootstrap it -if(NOT EXISTS "${VCPKG_ROOT}/.vcpkg-root") - message(STATUS "vcpkg not found. cloning into external/vcpkg...") - - # Clone vcpkg - execute_process( - COMMAND git clone https://github.com/microsoft/vcpkg.git "${VCPKG_ROOT}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.." - RESULT_VARIABLE GIT_CLONE_RESULT - ) - - if(NOT GIT_CLONE_RESULT EQUAL 0) - message(FATAL_ERROR "Failed to clone vcpkg. Please check your network connection or git setup.") - endif() - - # Bootstrap vcpkg (this builds the vcpkg binary) - message(STATUS "Bootstrapping vcpkg...") - if(WIN32) - execute_process(COMMAND "${VCPKG_ROOT}/bootstrap-vcpkg.bat" - WORKING_DIRECTORY "${VCPKG_ROOT}" - RESULT_VARIABLE BOOTSTRAP_RESULT) - else() - execute_process(COMMAND sh "${VCPKG_ROOT}/bootstrap-vcpkg.sh" - WORKING_DIRECTORY "${VCPKG_ROOT}" - RESULT_VARIABLE BOOTSTRAP_RESULT) - endif() - - if(NOT BOOTSTRAP_RESULT EQUAL 0) - message(FATAL_ERROR "vcpkg bootstrap failed.") - endif() -else() - message(STATUS "vcpkg found at ${VCPKG_ROOT}") -endif() - -# Export the path to the toolchain file so the parent CMakeLists can include it -set(VCPKG_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" PARENT_SCOPE) \ No newline at end of file diff --git a/buildLinux-debug.sh b/buildLinux-debug.sh deleted file mode 100644 index 0fbf95f..0000000 --- a/buildLinux-debug.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Stop at first error -set -e - -cmake -P ./CMake/setup_vcpkg.cmake - -export VCPKG_FEATURE_FLAGS="manifests" -export VCPKG_FORCE_SYSTEM_BINARIES=1 - -chmod +x "./external/vcpkg/vcpkg" -"./external/vcpkg/vcpkg" install - -# Check if Ninja is in PATH -if command -v ninja >/dev/null 2>&1; then - echo "Ninja is already installed." -else - # Download and install Ninja for Linux - echo "Installing Ninja..." - # Using curl (standard on most systems) - curl -LO https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip - - # Create directory and unzip - mkdir -p "./external/ninja" - unzip -o ninja-linux.zip -d "./external/ninja" - rm ninja-linux.zip - - # Make sure the binary is executable - chmod +x "./external/ninja/ninja" - - # Add to PATH for this session - export PATH="$PWD/external/ninja:$PATH" -fi - -# 7. Configure and Build -cmake -S . -B build -G "Ninja Multi-Config" -DCMAKE_TOOLCHAIN_FILE="./external/vcpkg/scripts/buildsystems/vcpkg.cmake" -cmake --build build --config Debug \ No newline at end of file diff --git a/buildLinux-release.sh b/buildLinux-release.sh deleted file mode 100644 index 0f36be2..0000000 --- a/buildLinux-release.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Stop at first error -set -e - -cmake -P ./CMake/setup_vcpkg.cmake - -export VCPKG_FEATURE_FLAGS="manifests" -export VCPKG_FORCE_SYSTEM_BINARIES=1 - -chmod +x "./external/vcpkg/vcpkg" -"./external/vcpkg/vcpkg" install - -# Check if Ninja is in PATH -if command -v ninja >/dev/null 2>&1; then - echo "Ninja is already installed." -else - # Download and install Ninja for Linux - echo "Installing Ninja..." - # Using curl (standard on most systems) - curl -LO https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip - - # Create directory and unzip - mkdir -p "./external/ninja" - unzip -o ninja-linux.zip -d "./external/ninja" - rm ninja-linux.zip - - # Make sure the binary is executable - chmod +x "./external/ninja/ninja" - - # Add to PATH for this session - export PATH="$PWD/external/ninja:$PATH" -fi - -# 7. Configure and Build -cmake -S . -B build -G "Ninja Multi-Config" -DCMAKE_TOOLCHAIN_FILE="./external/vcpkg/scripts/buildsystems/vcpkg.cmake" -cmake --build build --config Release \ No newline at end of file diff --git a/buildWindows-debug.bat b/buildWindows-debug.bat deleted file mode 100644 index 09256d1..0000000 --- a/buildWindows-debug.bat +++ /dev/null @@ -1,25 +0,0 @@ -cmake -P ./CMake/setup_vcpkg.cmake -set VCPKG_FEATURE_FLAGS=manifests -:: "./external/vcpkg/vcpkg.exe" install - - -@echo off -:: Check if Ninja is in PATH -where /q ninja.exe -if %errorlevel% equ 0 ( - echo Ninja is already installed. - goto :cmake -) - -:: Download and install Ninja -echo Installing Ninja... -powershell -Command "Invoke-WebRequest -Uri 'https://github.com/ninja-build/ninja/releases/latest/download/ninja-win.zip' -OutFile 'ninja-win.zip'" -powershell -Command "Expand-Archive -Path 'ninja-win.zip' -DestinationPath '%cd%\external\ninja' -Force" -del ninja-win.zip - -:: Add current directory to PATH for this session -set PATH=%cd%\external\ninja;%PATH% - -:cmake -cmake -S . -B build -G "Ninja Multi-Config" -DCMAKE_TOOLCHAIN_FILE="./external/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DVCPKG_HOST_TRIPLET=x64-windows -cmake --build build --config Debug \ No newline at end of file diff --git a/buildWindows-release.bat b/buildWindows-release.bat deleted file mode 100644 index 6732df5..0000000 --- a/buildWindows-release.bat +++ /dev/null @@ -1,25 +0,0 @@ -cmake -P ./CMake/setup_vcpkg.cmake -set VCPKG_FEATURE_FLAGS=manifests -"./external/vcpkg/vcpkg.exe" install - - -@echo off -:: Check if Ninja is in PATH -where /q ninja.exe -if %errorlevel% equ 0 ( - echo Ninja is already installed. - goto :cmake -) - -:: Download and install Ninja -echo Installing Ninja... -powershell -Command "Invoke-WebRequest -Uri 'https://github.com/ninja-build/ninja/releases/latest/download/ninja-win.zip' -OutFile 'ninja-win.zip'" -powershell -Command "Expand-Archive -Path 'ninja-win.zip' -DestinationPath '%cd%\external\ninja' -Force" -del ninja-win.zip - -:: Add current directory to PATH for this session -set PATH=%cd%\external\ninja;%PATH% - -:cmake -cmake -S . -B build -G "Ninja Multi-Config" -DCMAKE_TOOLCHAIN_FILE="./external/vcpkg/scripts/buildsystems/vcpkg.cmake" -cmake --build build --config Release \ No newline at end of file diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 7059b0a..9b65c24 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -1,28 +1,84 @@ -# Building Harbour of Harkinian +# Building Harbour Ports -## Prerequisites +## Prerequisites on all platforms - C++ compiler - Git - CMake +- vcpkg ## Windows -Powershell instructions +- Configure CMake (should automatically install vcpkg dependencies) + - I usually use Ninja for configuring, if you want to do that just add `-G Ninja` to the command + - _(if vcpkg dependencies do not automatically download, run vcpkg install in your project root, then delete the build folder and reconfigure)_ +```powershell +cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake" ``` -# When cloning, be sure to set the --recursive flag for submodule dependencies + -# In the root folder, i.e. Harbour/, run: +- Build Harbour Ports +```powershell +cmake --build build +``` +- The executable will be found at `build/Harbour.exe` -cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="external/vcpkg/scripts/buildsystems/vcpkg.cmake" +## Linux +- Ensure all dependencies are installed (Ubuntu) +```bash +sudo apt-get install -y \ + autoconf \ + autoconf-archive \ + automake \ + libtool \ + libltdl-dev \ + build-essential \ + curl \ + zip \ + unzip \ + tar \ + pkg-config \ + libssl-dev \ + libx11-dev \ + libgl1-mesa-dev +``` +- Ensure vcpkg dependencies are installed +```bash +./path/to/vcpkg install +``` -# Then to build a debug build, run +- Configure CMake +```bash +cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="path/to/vcpkg/scripts/buildsystems/vcpkg.cmake" +``` + +- Build Harbour Ports +```bash cmake --build build ``` +- The executable will be found at `build/Harbour` -## Linux -I only did a Linux build once, and in Github Codespaces, and even then I was unable to test it fully. -If someone else has a real Linux machine (or a fuller VM than GH Codespaces) and could test build this, that would be great. -## MacOS -Currently unknown, documentation will be added when verified. +## macOS +_note: documentation is still undergoing for macOS_ +- Ensure cURL is installed +``` +brew install curl +``` + +- Ensure vcpkg dependencies are installed +``` +./path/to/vcpkg install +``` + +- Configure CMake +``` +cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="path/to/vcpkg/scripts/buildsystems/vcpkg.cmake" +``` + +- Build Harbour Ports +``` +cmake --build build +``` + +For additional help, please refer to the [workflow](../.github/workflows/build.yaml) and the section for your specific platform.