Skip to content

Commit

Permalink
Windows local build scripts (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dj-Viking committed Mar 6, 2024
1 parent 96550b3 commit d2889da
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -12,3 +12,5 @@ compile_commands.json
.vscode
.clangd
.cache
Qt/**
aqtinstall.log
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -28,6 +28,7 @@
- [Dependencies](#dependencies)
- [Building](#building)
- [Windows](#windows)
- [PowerShell](#powershell-installation-scripts)
- [Linux](#linux)
- [OS X](#os-x)

Expand Down Expand Up @@ -93,6 +94,17 @@ Power Tab Editor 2.0 - A powerful cross platform guitar tablature viewer and edi
* Open the project folder in Visual Studio and build.
* If running CMake manually, set `CMAKE_TOOLCHAIN_FILE` to `[vcpkg root]\scripts\buildsystems\vcpkg.cmake`

##### PowerShell Installation Scripts
* For a more installation streamlined process
- with at least PowerShell 5.1 is installed on your machine
- Run these powershell scripts in your powershell terminal with your shell working directory as your cloned project
```powershell
.\scripts\Get-Dependencies.ps1 -vcpkg_exe_path "your/path/to/your/vcpkg.exe" -python_exe_path "your/path/to/your/python.exe";
.\scripts\Run-CMakeBuild.ps1 -vcpkg_dir "your/path/to/your/vcpkg" -qt_path "your/path/to/qt";
```
You'll have to update the variables for your specific paths to `$vcpkg_exe_path`, `$python_exe_path`, and `$qt_path`


#### Linux:
* These instructions assume a recent Ubuntu/Debian-based system, but the package names should be similar for other package managers.
* Install dependencies:
Expand Down
23 changes: 23 additions & 0 deletions scripts/Get-Dependencies.ps1
@@ -0,0 +1,23 @@
param(
[string]
$vcpkg_exe_path = "C:\Program Files\vcpkg\vcpkg.exe",

[string]
$python_exe_path = "$($HOME)\AppData\Local\Programs\Python\Python39\python.exe"
)

if (!(Test-Path $python_exe_path)) {
throw "python exe path not found please update to your path to python";
}

if (!(Test-Path $vcpkg_exe_path)) {
throw "vcpkg exe path not found please update to your path to vcpkg and/or install vcpkg first";
}

& $vcpkg_exe_path install --triplet x64-windows boost-algorithm boost-date-time boost-endian boost-functional boost-iostreams boost-rational boost-signals2 boost-stacktrace doctest minizip nlohmann-json pugixml;

& $python_exe_path -m pip install setuptools wheel py7zr==0.20.*;

& $python_exe_path -m pip install aqtinstall==3.1.*;

& $python_exe_path -m aqt install-qt windows desktop 5.15.2 win64_msvc2019_64 --outputdir "$($PSScriptRoot)\..\Qt";
41 changes: 41 additions & 0 deletions scripts/Run-CMakeBuild.ps1
@@ -0,0 +1,41 @@
param(
[string]
$vcpkg_dir = "C:\Program Files\vcpkg\",

[string]
$qt_path = "$($PSScriptRoot)/../Qt"
)

if (!(Test-Path "$vcpkg_dir")) {
throw "could not find the vcpkg directory please update this value with your path to vcpkg directory";
}

if (!(Test-Path "$qt_path")) {
throw "Qt dependency is not installed yet, for this script to work install Qt to this project's root directory or change the path to your Qt installation";
}

$qt5_widgets_cmake_path = "$($qt_path)/5.15.2/msvc2019_64/lib/cmake/Qt5Widgets/";
$qt5_network_cmake_path = "$($qt_path)/5.15.2/msvc2019_64/lib/cmake/Qt5Network/";
$qt5_printsupport_cmake_path = "$($qt_path)/5.15.2/msvc2019_64/lib/cmake/Qt5PrintSupport/";
$qt5_linguisttools_cmake_path = "$($qt_path)/5.15.2/msvc2019_64/lib/cmake/Qt5LinguistTools";

<#
https://cmake.org/cmake/help/latest/envvar/CMAKE_PREFIX_PATH.html#envvar:CMAKE_PREFIX_PATH
#>
$cmake_prefix_path = $(
@(
$qt5_widgets_cmake_path,
$qt5_network_cmake_path,
$qt5_printsupport_cmake_path,
$qt5_linguisttools_cmake_path
# probably a unix system as per cmake documentation are colon separated
) -join $(if ($env:OS -match "Windows") {";"} else {":"})
);


cmake `
-A x64 `
-B ./build `
-DPTE_ENABLE_PCH=1 `
-DCMAKE_TOOLCHAIN_FILE="$($vcpkg_dir)/scripts/buildsystems/vcpkg.cmake" `
-DCMAKE_PREFIX_PATH="$($cmake_prefix_path)"

0 comments on commit d2889da

Please sign in to comment.