Add CMake Buildsystem
parent
4f6aaa1056
commit
772efb4d6a
|
@ -1,3 +1,7 @@
|
|||
# CMake build dir
|
||||
build/
|
||||
build-*/
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
project(MinetestMapperGUI
|
||||
VERSION 1.0.0.0)
|
||||
|
||||
set(USE_FOLDERS ON)
|
||||
|
||||
add_subdirectory("Minetestmapper/")
|
||||
add_subdirectory("MinetestMapperGUI/")
|
||||
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
|
||||
include(InstallRequiredSystemLibraries)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
|
||||
include(CPack)
|
|
@ -1 +1 @@
|
|||
Subproject commit 53e9e642152f2a3d88a2befd804046e96fcf295c
|
||||
Subproject commit a2277a972d4c1306393edd0aa89cd6fd22659a10
|
|
@ -1 +1 @@
|
|||
Subproject commit 3917cf75e590ebf7c37a7ddf3b566c9e59503def
|
||||
Subproject commit 6a09c37893d895e8c425b1d7964317c0a814e2f1
|
21
README.md
21
README.md
|
@ -1 +1,22 @@
|
|||
MinetestMapperGUI-Bundle
|
||||
========================
|
||||
|
||||
Contains the Minetestmapper and the MinetestmapperGui as bundle.
|
||||
|
||||
Building on Windows
|
||||
-------------------
|
||||
Requirements:
|
||||
|
||||
- vcpkg https://github.com/Microsoft/vcpkg
|
||||
- Qt-Framework https://www.qt.io/
|
||||
|
||||
Build steps:
|
||||
just execute the build.ps1 script.
|
||||
|
||||
Building on Linux
|
||||
-----------------
|
||||
Im trying my best to support Linux too, but I does not have the experience to do so. Im happy about any help I can get here.
|
||||
|
||||
Building on Mac
|
||||
---------------
|
||||
Im trying my best to support Mac too, but I does not have the experience to do so. Im happy about any help I can get here.
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
# get usage information by using 'get-help .\build.ps1'
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Automatically build MinetestmapperGui
|
||||
|
||||
.DESCRIPTION
|
||||
Automatically installs the reqired dependencies from vcpkg,
|
||||
executes cmake and generates a zip archive
|
||||
|
||||
.EXAMPLE
|
||||
PS> .\build.ps1 -vcpkg_root D:\vcpkg\ -triplet x64-windows
|
||||
#>
|
||||
param (
|
||||
## Specifies the path to the vcpkg.exe. e.g D:\vcpkg
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$vcpkg_root = "D:\vcpkg",
|
||||
|
||||
## Specifies the target triplet eg. x64-windows or x68-windows-static.
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$triplet = "x64-windows",
|
||||
|
||||
## Specify the Visual studio version (15 = VS 2017)
|
||||
[int32]$vs_version = 15,
|
||||
|
||||
## Specify the qt version to use
|
||||
$qt_version = "5.12.1"
|
||||
)
|
||||
|
||||
$aTriplet = $triplet.Split('-')
|
||||
$arch = $aTriplet[0]
|
||||
$os = $aTriplet[1]
|
||||
$linkage = $aTriplet[2]
|
||||
|
||||
$generator = ""
|
||||
if ($vs_version -lt 14) {
|
||||
throw "Visual Studio versions older then 2015 are not supported!"
|
||||
}
|
||||
elseif ($vs_version -eq 14) {
|
||||
$generator = "Visual Studio 14 2015"
|
||||
$qt_dir = "C:\Qt\$qt_version\msvc2015"
|
||||
}
|
||||
elseif ($vs_version -eq 15) {
|
||||
$generator = "Visual Studio 15 2017"
|
||||
$qt_dir = "C:\Qt\$qt_version\msvc2017"
|
||||
}
|
||||
elseif ($vs_version -eq 16) {
|
||||
$generator = "Visual Studio 16 2019"
|
||||
$qt_dir = "C:\Qt\$qt_version\msvc2019"
|
||||
Write-Warning "$generator is currently not tested and may work or not"
|
||||
}
|
||||
|
||||
$cmake_generator = $generator
|
||||
if ($arch -eq "x64") {
|
||||
$cmake_generator = "$generator Win64"
|
||||
$qt_dir += "_64"
|
||||
}
|
||||
|
||||
$build_dir = ".\build\$triplet"
|
||||
|
||||
if ($linkage -eq "static") {
|
||||
Write-Output "Building $arch-$os-static"
|
||||
}
|
||||
else {
|
||||
Write-Output "Building $arch-$os-dynamic"
|
||||
}
|
||||
|
||||
Write-Output "Qt Dir: $qt_dir"
|
||||
Write-Output "Build Dir: $build_dir"
|
||||
Write-Output "Triplet: $triplet"
|
||||
Write-Output "Generator: $cmake_generator"
|
||||
|
||||
try {
|
||||
& "$vcpkg_root\vcpkg" install zlib sqlite3 libgd[core,png] --triplet "$triplet"
|
||||
if ($LASTEXITCODE -ne 0) {throw "Error while installing dependencies"}
|
||||
|
||||
if (!(test-path $build_dir)) {
|
||||
New-Item -ItemType Directory -Force -Path $build_dir
|
||||
}
|
||||
|
||||
Push-Location $build_dir
|
||||
if (Test-Path "CMakeCache.txt") {
|
||||
Remove-Item "CMakeCache.txt" # Perform a clean build
|
||||
}
|
||||
|
||||
cmake ../.. -G"$cmake_generator" `
|
||||
-DVCPKG_TARGET_TRIPLET="$triplet" `
|
||||
-DVCPKG_APPLOCAL_DEPS=ON `
|
||||
-DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake `
|
||||
-DCMAKE_BUILD_TYPE=Release `
|
||||
-DCMAKE_PREFIX_PATH="$qt_dir\lib\cmake"
|
||||
if ($LASTEXITCODE -ne 0) {throw "Error while configuring"}
|
||||
|
||||
cmake --build . --config Release
|
||||
if ($LASTEXITCODE -ne 0) {throw "Error while building"}
|
||||
|
||||
cpack -G "ZIP"
|
||||
if ($LASTEXITCODE -ne 0) {throw "Error while packing"}
|
||||
}
|
||||
catch {
|
||||
Write-Error $_.Exception.Message
|
||||
}
|
||||
Finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue