fix: fixed prepare scripts
This commit is contained in:
parent
42a03f1a57
commit
542bb459e8
|
@ -0,0 +1,117 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Prepare required 3rd-party
|
||||
#
|
||||
# Author: anjingyu_ws@foxmail.com
|
||||
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
$ProjRoot = Split-Path $PSScriptRoot -Parent
|
||||
$ThirdPartyDir = Join-Path ${ProjRoot} 3rd-party
|
||||
|
||||
function FetchLatestTag
|
||||
{
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory=$False,Position=1,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)][String] $GitRepoUrl,
|
||||
[Parameter(Mandatory=$False,Position=2,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)][String] $GrepString
|
||||
)
|
||||
|
||||
$_Tag = ""
|
||||
|
||||
if ("" -ne $GrepString)
|
||||
{
|
||||
$_Tag = $(-Split $(git ls-remote --refs -t --sort=-v:refname "${GitRepoUrl}" | Select-String "${GrepString}" | Select -first 1) | Select -index 1) -Split "/" | Select -last 1
|
||||
}
|
||||
else
|
||||
{
|
||||
$_Tag = $(-Split $(git ls-remote --refs -t --sort=-v:refname "${GitRepoUrl}" | Select -first 1) | Select -index 1) -Split "/" | Select -last 1
|
||||
}
|
||||
|
||||
return $_Tag
|
||||
}
|
||||
|
||||
function PrepareGlm
|
||||
{
|
||||
$_REPO_URL="https://github.com/g-truc/glm"
|
||||
$_VER=$(FetchLatestTag "$_REPO_URL" "/[0-9]+.[0-9]+.[0-9]+$")
|
||||
|
||||
if (-Not (Test-Path "$ThirdPartyDir/glm")) {
|
||||
Push-Location $ThirdPartyDir
|
||||
git clone --recursive --branch ${_VER} --depth 1 ${_REPO_URL}
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function PrepareGlew
|
||||
{
|
||||
$_REPO_URL="https://github.com/nigels-com/glew"
|
||||
$_VER=$(FetchLatestTag "$_REPO_URL" "/glew-[0-9]+.[0-9]+.[0-9]+$")
|
||||
|
||||
if (-Not (Test-Path "$ThirdPartyDir/glew")) {
|
||||
Push-Location $ThirdPartyDir
|
||||
git clone --recursive --branch ${_VER} --depth 1 ${_REPO_URL}
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function PrepareGlad2
|
||||
{
|
||||
pip install glad2
|
||||
|
||||
# Check the generated GLAD files
|
||||
if (-Not (Test-Path "$ThirdPartyDir/glad")) {
|
||||
python -m glad --out-path "$ThirdPartyDir/glad" --api gl:core=4.6 c --loader --header-only
|
||||
}
|
||||
}
|
||||
|
||||
function PrepareImgui
|
||||
{
|
||||
$_REPO_URL="https://github.com/ocornut/imgui"
|
||||
$_VER=$(FetchLatestTag "$_REPO_URL" "/v[0-9]+.[0-9]+.[0-9]+-docking$")
|
||||
|
||||
if (-Not (Test-Path "$ThirdPartyDir/imgui")) {
|
||||
Push-Location $ThirdPartyDir
|
||||
git clone --recursive --branch ${_VER} --depth 1 ${_REPO_URL}
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function PrepareNuklear
|
||||
{
|
||||
$_REPO_URL="https://github.com/Immediate-Mode-UI/Nuklear"
|
||||
$_VER=$(FetchLatestTag "$_REPO_URL")
|
||||
|
||||
if (-Not (Test-Path "$ThirdPartyDir/nuklear")) {
|
||||
Push-Location $ThirdPartyDir
|
||||
git clone --recursive --branch ${_VER} --depth 1 ${_REPO_URL} nuklear
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function PrepareGlfw
|
||||
{
|
||||
$_REPO_URL="https://github.com/glfw/glfw"
|
||||
$_VER=$(FetchLatestTag "$_REPO_URL")
|
||||
|
||||
if (-Not (Test-Path "$ThirdPartyDir/glfw")) {
|
||||
Push-Location $ThirdPartyDir
|
||||
git clone --recursive --branch ${_VER} --depth 1 ${_REPO_URL}
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function main
|
||||
{
|
||||
if (-Not (Test-Path "$ThirdPartyDir")) {
|
||||
mkdir $ThirdPartyDir
|
||||
}
|
||||
|
||||
PrepareGlm
|
||||
PrepareGlew
|
||||
PrepareGlad2
|
||||
PrepareImgui
|
||||
PrepareNuklear
|
||||
PrepareGlfw
|
||||
}
|
||||
|
||||
main
|
|
@ -111,6 +111,30 @@ function prepare_imgui()
|
|||
fi
|
||||
}
|
||||
|
||||
function prepare_nuklear()
|
||||
{
|
||||
local _REPO_URL="https://github.com/Immediate-Mode-UI/Nuklear"
|
||||
local _VER=$(fetch_latest_git_tag "$_REPO_URL")
|
||||
|
||||
if [ ! -d "$THIRD_PARTY_DIR/nuklear" ]; then
|
||||
pushd $THIRD_PARTY_DIR 1>/dev/null 2>&1
|
||||
git clone --recursive --branch ${_VER} --depth 1 ${_REPO_URL} nuklear
|
||||
popd 1>/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
function prepare_glfw()
|
||||
{
|
||||
local _REPO_URL="https://github.com/glfw/glfw"
|
||||
local _VER=$(fetch_latest_git_tag "$_REPO_URL")
|
||||
|
||||
if [ ! -d "$THIRD_PARTY_DIR/glfw" ]; then
|
||||
pushd $THIRD_PARTY_DIR 1>/dev/null 2>&1
|
||||
git clone --recursive --branch ${_VER} --depth 1 ${_REPO_URL}
|
||||
popd 1>/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
function prepare_freetypegl()
|
||||
{
|
||||
sudo apt install -y libfreetype6-dev \
|
||||
|
@ -139,11 +163,17 @@ function prepare_boost()
|
|||
|
||||
function main()
|
||||
{
|
||||
if [ ! -d "$THIRD_PARTY_DIR" ]; then
|
||||
mkdir -p "$THIRD_PARTY_DIR"
|
||||
fi
|
||||
|
||||
# prepare_boost
|
||||
prepare_glm
|
||||
# prepare_glew
|
||||
prepare_glad2
|
||||
prepare_imgui
|
||||
prepare_glfw
|
||||
prepare_nuklear
|
||||
prepare_freetypegl
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue