mirror of https://github.com/H-uru/korman.git
19 changed files with 1690 additions and 88 deletions
@ -0,0 +1,96 @@
|
||||
name: CI Build |
||||
on: [push, pull_request] |
||||
|
||||
jobs: |
||||
windows-build: |
||||
strategy: |
||||
matrix: |
||||
cfg: |
||||
- { |
||||
os: windows-2019, |
||||
generator: Visual Studio 16 2019, |
||||
arch: Win32, |
||||
str: windows-x86, |
||||
blender-url: "https://github.com/Hoikas/blender2.7/releases/download/blender2.79_20210808/blender-2.79.0-git20210808.d2e1ea3f63e3-windows32.zip", |
||||
} |
||||
- { |
||||
os: windows-2019, |
||||
generator: Visual Studio 16 2019, |
||||
arch: x64, |
||||
str: windows-x64, |
||||
blender-url: "https://github.com/Hoikas/blender2.7/releases/download/blender2.79_20210808/blender-2.79.0-git20210808.d2e1ea3f63e3-windows64.zip", |
||||
} |
||||
|
||||
env: |
||||
CMAKE_GENERATOR: ${{ matrix.cfg.generator }} |
||||
CMAKE_GENERATOR_PLATFORM: ${{ matrix.cfg.arch }} |
||||
|
||||
runs-on: ${{ matrix.cfg.os }} |
||||
steps: |
||||
- name: Checkout |
||||
uses: actions/checkout@v2 |
||||
with: |
||||
path: korman |
||||
|
||||
- name: Download Blender |
||||
run: | |
||||
curl --location "${{ matrix.cfg.blender-url }}" --output blender.zip |
||||
mkdir blender |
||||
7z x blender.zip -oblender -bsp1 |
||||
|
||||
- name: Build Standalone Korman |
||||
run: | |
||||
$BlenderSubDir = Split-Path -LeafBase $([System.URI]"${{ matrix.cfg.blender-url }}").Segments[-1] |
||||
korman/build.ps1 ` |
||||
-Modern ` |
||||
-BlenderDir "${{ github.workspace }}/blender/$BlenderSubDir" ` |
||||
-NoInstaller -NoBlender |
||||
|
||||
- name: Upload Standalone Korman |
||||
uses: actions/upload-artifact@v2 |
||||
with: |
||||
name: korman-standalone-${{ matrix.cfg.str }} |
||||
path: build/package |
||||
|
||||
- name: Build Korman+Blender Bundle |
||||
if: startsWith(github.ref, 'refs/tags') |
||||
run: | |
||||
Remove-Item -Recurse -Force build/package |
||||
korman/build.ps1 -Modern |
||||
|
||||
- name: Upload Korman+Blender Bundle |
||||
if: startsWith(github.ref, 'refs/tags') |
||||
uses: actions/upload-artifact@v2 |
||||
with: |
||||
name: korman-blender-${{ matrix.cfg.str }} |
||||
path: build/package |
||||
|
||||
publish: |
||||
if: startsWith(github.ref, 'refs/tags') |
||||
needs: [windows-build] |
||||
runs-on: windows-2019 |
||||
|
||||
steps: |
||||
- name: Checkout Korman |
||||
uses: actions/checkout@v2 |
||||
with: |
||||
path: korman |
||||
|
||||
- name: Download Artifacts |
||||
id: download |
||||
uses: actions/download-artifact@v2 |
||||
with: |
||||
path: artifacts |
||||
|
||||
- name: Publish Release |
||||
run: | |
||||
korman/release.ps1 ` |
||||
-Repository "${{ github.repository }}" ` |
||||
-Token "${{ secrets.GITHUB_TOKEN }}" ` |
||||
-UploadDir "${{ steps.download.outputs.download-path }}" ` |
||||
-SubDirs @{ |
||||
"korman-standalone-windows-x86" = "standalone" |
||||
"korman-standalone-windows-x64" = "standalone" |
||||
"korman-blender-windows-x86" = "bundled" |
||||
"korman-blender-windows-x64" = "bundled" |
||||
} |
@ -0,0 +1,93 @@
|
||||
# This file is part of Korman. |
||||
# |
||||
# Korman is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Korman is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Korman. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
cmake_minimum_required(VERSION 3.12) |
||||
|
||||
set(_PROJECT_INFO |
||||
korman |
||||
VERSION 0.11 |
||||
DESCRIPTION "Blender plugin for creating ages for Cyan Worlds' proprietary Plasma engine and its open source variant, CyanWorlds.com Engine." |
||||
LANGUAGES CXX # This should probably be NONE, but we need the compiler for string_theory tests |
||||
) |
||||
project(${_PROJECT_INFO}) |
||||
|
||||
include(CMakeDependentOption) |
||||
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") |
||||
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install" CACHE PATH "") |
||||
|
||||
# TODO: Maybe use cmake_path (requires CMake 3.21) to ensure Blender_EXECUTABLE is not in the CMAKE_INSTALL_PREFIX? |
||||
# That would indicate that we are installing Korman into the blender we found, so no need to install blender. |
||||
option(korman_INSTALL_BLENDER "Copy Blender as part of the INSTALL target" ON) |
||||
option(korman_INSTALL_SCRIPTS "Copy Korman python scripts as part of the INSTALL target" ON) |
||||
|
||||
# While, yes, we could tie our build process into Blender's, Blender pulls in |
||||
# tons of dependencies and can be quite slow if you start trying to build |
||||
# errthang from source. So, we'll jst let you handle that. Good luck! |
||||
if(NOT "${Blender_PYTHON_VERSION}" OR korman_INSTALL_BLENDER) |
||||
set(_Blender_REQUIRED "REQUIRED") |
||||
elseif("${Blender_PYTHON_VERSION}" AND NOT "${Blender_PYTHON_VERSION}" MATCHES "^[0-9]+\\.[0-9]+$") |
||||
message(FATAL_ERROR "Your manually defined Blender python version ($CACHE{Blender_PYTHON_VERSION}) doesn't pass muster.") |
||||
endif() |
||||
find_package(Blender 2.79 EXACT ${_Blender_REQUIRED}) |
||||
|
||||
# Gotta do this because libHSPlasma is still using the old broke-ass pre-3.12 find modules. |
||||
set(Python3_FIND_STRATEGY VERSION) |
||||
find_package(Python3 ${Blender_PYTHON_VERSION} EXACT COMPONENTS Development REQUIRED) |
||||
|
||||
include(Dependencies) |
||||
include(Packaging) |
||||
|
||||
if(korman_INSTALL_SCRIPTS) |
||||
set(korman_INSTALL_SCRIPTS_PATH "${Blender_VERSION}/scripts/addons" CACHE STRING "") |
||||
install(DIRECTORY |
||||
"${CMAKE_SOURCE_DIR}/korman" |
||||
DESTINATION "${korman_INSTALL_SCRIPTS_PATH}" |
||||
COMPONENT "Korman" |
||||
FILES_MATCHING |
||||
PATTERN "*.py" |
||||
) |
||||
endif() |
||||
|
||||
# When we update to CMake 3.21, it might be worth separating the dependency build |
||||
# and Korman build a little more and using install(TARGETS RUNTIME_DEPENDENCIES). For now, |
||||
# this causes no observable problems and gives a good result, so meh. |
||||
set(korman_INSTALL_BINARY_DIR "${Blender_VERSION}/python/lib/site-packages" CACHE STRING "") |
||||
install(DIRECTORY |
||||
"${korman_HARVEST_DIR}/bin/" |
||||
DESTINATION "${korman_INSTALL_BINARY_DIR}" |
||||
COMPONENT "Korman" |
||||
FILES_MATCHING |
||||
PATTERN "*.dll" |
||||
PATTERN "*.pyd" |
||||
PATTERN "*.so" |
||||
) |
||||
|
||||
if(korman_INSTALL_BLENDER) |
||||
get_filename_component(_Blender_PATH "${Blender_EXECUTABLE}" DIRECTORY) |
||||
install(DIRECTORY |
||||
"${_Blender_PATH}/" |
||||
DESTINATION "." |
||||
COMPONENT "Blender" |
||||
) |
||||
endif() |
||||
|
||||
if(korman_HARVEST_PYTHON22) |
||||
install(PROGRAMS |
||||
"${korman_HARVEST_DIR}/bin/Python-2.2.3.exe" |
||||
DESTINATION "." |
||||
COMPONENT "Python22" |
||||
) |
||||
endif() |
@ -0,0 +1,223 @@
|
||||
# This file is part of Korman. |
||||
# |
||||
# Korman is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Korman is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Korman. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
param( |
||||
[Parameter(ParameterSetName="classic", Mandatory=$false)] |
||||
[Parameter(ParameterSetName="modern", Mandatory=$false)] |
||||
[ValidateSet("Visual Studio 2013", "Visual Studio 2015", "Visual Studio 2017", "Visual Studio 2019", "Visual Studio 2022")] |
||||
[string]$Generator, |
||||
|
||||
[Parameter(ParameterSetName="classic", Mandatory=$false)] |
||||
[Parameter(ParameterSetName="modern", Mandatory=$false)] |
||||
[string]$BuildDir = "$(Get-Location)/build", |
||||
|
||||
[Parameter(ParameterSetName="modern", Mandatory=$true)] |
||||
[ValidateScript({ |
||||
if (Get-Command cpack) { |
||||
$true |
||||
} else { |
||||
throw "Modern requires that CPack be installed and available on the PATH." |
||||
} |
||||
})] |
||||
[switch]$Modern, |
||||
|
||||
[Parameter(ParameterSetName="classic", Mandatory=$true)] |
||||
[ValidateScript({ |
||||
if (Get-Command makensis) { |
||||
$true |
||||
} else { |
||||
throw "Classic requires that NSIS be installed and available on the PATH." |
||||
} |
||||
})] |
||||
[switch]$Classic, |
||||
|
||||
[Parameter(ParameterSetName="classic", Mandatory=$true)] |
||||
[string]$PythonVersion, |
||||
|
||||
[Parameter(ParameterSetName="modern")] |
||||
[ValidateSet("x86", "x64")] |
||||
[string]$Platform, |
||||
|
||||
[Parameter(ParameterSetName="modern")] |
||||
[string]$BlenderDir, |
||||
|
||||
[Parameter(ParameterSetName="modern")] |
||||
[switch]$NoInstaller, |
||||
|
||||
[Parameter(ParameterSetName="modern")] |
||||
[switch]$NoBlender, |
||||
|
||||
[Parameter(ParameterSetName="classic")] |
||||
[Parameter(ParameterSetName="modern")] |
||||
[switch]$RebuildDeps |
||||
) |
||||
|
||||
# Enable for prod |
||||
$ErrorActionPreference = "Stop" |
||||
|
||||
$Generator_LUT = @{ |
||||
"Visual Studio 2013" = "Visual Studio 12 2013" |
||||
"Visual Studio 2015" = "Visual Studio 14 2015" |
||||
"Visual Studio 2017" = "Visual Studio 15 2017" |
||||
"Visual Studio 2019" = "Visual Studio 16 2019" |
||||
"Visual Studio 2022" = "Visual Studio 17 2022" |
||||
}; |
||||
|
||||
$Platform_LUT = @{ |
||||
"x86" = "Win32" |
||||
"x64" = "x64" |
||||
} |
||||
|
||||
function Find-CMakeArgument($UserInput, $EnvValue, $LUT, $Default) { |
||||
if ($UserInput) { |
||||
return $LUT[$UserInput] |
||||
} |
||||
if ($EnvValue) { |
||||
return $EnvValue |
||||
} |
||||
return $Default |
||||
} |
||||
|
||||
function Convert-BoolToCMake($Value) { |
||||
if ($Value) { |
||||
"ON" |
||||
} else { |
||||
"OFF" |
||||
} |
||||
} |
||||
|
||||
function Start-KormanBuild($HostGenerator, $TargetPlatform, $OutputDir, $StagingDir) { |
||||
Write-Host -ForegroundColor Cyan "Configuring Korman with $HostGenerator for $TargetPlatform..." |
||||
$InstallBlender = Convert-BoolToCMake $(if ($NoBlender) { $false } else { $true }) |
||||
$HarvestPython22 = Convert-BoolToCMake $(if ($NoInstaller) { $false } else { $true }) |
||||
cmake ` |
||||
-G "$HostGenerator" ` |
||||
-A "$TargetPlatform" ` |
||||
-S "$PSScriptRoot" ` |
||||
-B "$OutputDir" ` |
||||
-DBlender_ROOT="$BlenderDir" ` |
||||
-DBlender_PYTHON_VERSION="$PythonVersion" ` |
||||
-Dkorman_EXTERNAL_STAGING_DIR="$StagingDir" ` |
||||
-Dkorman_HARVEST_PYTHON22="$HarvestPython22" ` |
||||
-Dkorman_INSTALL_BLENDER="$InstallBlender" | Write-Host |
||||
if ($LASTEXITCODE -Ne 0) { throw "Configure failed!" } |
||||
} |
||||
|
||||
function Set-KormanClassicBuild($OutputDir, $Arch) { |
||||
Write-Host -ForegroundColor Cyan "Setting up classic multi-arch build..." |
||||
cmake ` |
||||
-B "$OutputDir" ` |
||||
-Dkorman_INSTALL_BLENDER=OFF ` |
||||
-Dkorman_INSTALL_SCRIPTS=OFF ` |
||||
-Dkorman_INSTALL_BINARY_DIR="$PSScriptRoot/installer/Files/$Arch" |
||||
if ($LASTEXITCODE -Ne 0) { throw "Configure failed!" } |
||||
} |
||||
|
||||
function Complete-KormanBuild($OutputDir) { |
||||
Write-Host -ForegroundColor Cyan "Aaaand they're off!!!" |
||||
cmake --build "$OutputDir" --config Release --parallel | Write-Host |
||||
if ($LASTEXITCODE -Ne 0) { throw "Build failed!" } |
||||
} |
||||
|
||||
function Build-KormanClassicSingleArch($HostGenerator, $TargetPlatform, $OutputDir) { |
||||
$MyPlatform = $Platform_LUT[$TargetPlatform] |
||||
$MyBuildDir = "$OutputDir/$TargetPlatform" |
||||
$CheckBuildDir = Test-Path $MyBuildDir |
||||
Start-KormanBuild "$HostGenerator" "$MyPlatform" "$MyBuildDir" "$OutputDir/external" |
||||
Set-KormanClassicBuild "$MyBuildDir" "$TargetPlatform" |
||||
if (!$CheckBuildDir -Or $RebuildDeps) { |
||||
Complete-KormanBuild "$MyBuildDir" |
||||
} |
||||
} |
||||
|
||||
function Build-KormanClassicInstaller() { |
||||
# Ugh, CMake is nice enough to do this kind of shit for us. |
||||
New-Item -Path "$PSScriptRoot/installer/Files/x86" -ItemType Directory -Force |
||||
New-Item -Path "$PSScriptRoot/installer/Files/x64" -ItemType Directory -Force |
||||
|
||||
# CMake copies the vcredist for us. YAY! |
||||
Write-Host -ForegroundColor Cyan "Copying sub-installers..." |
||||
Copy-Item "$BuildDir/x86/harvest/bin/vcredist_x86.exe" "$PSScriptRoot/installer/Files/x86/vcredist_x86.exe" |
||||
Copy-Item "$BuildDir/x64/harvest/bin/vcredist_x64.exe" "$PSScriptRoot/installer/Files/x64/vcredist_x64.exe" |
||||
Copy-Item "$BuildDir/x86/harvest/bin/Python-2.2.3.exe" "$PSScriptRoot/installer/Files/x86/Python-2.2.3.exe" |
||||
|
||||
Write-Host -ForegroundColor Cyan "Determining Build Info..." |
||||
if (Get-Command git) { |
||||
Push-Location "$PSScriptRoot" |
||||
try { |
||||
$KormanRev = git describe --tags --dirty |
||||
} finally { |
||||
Pop-Location |
||||
} |
||||
} else { |
||||
$KormanRev = "untracked" |
||||
} |
||||
|
||||
Write-Host -ForegroundColor Cyan "Building NSIS installer..." |
||||
Push-Location installer |
||||
try { |
||||
$PythonDLL = "python$($PythonVersion.Replace('.', '')).dll" |
||||
makensis /DPYTHON_DLL=$PythonDLL Installer.nsi |
||||
if ($LASTEXITCODE -Ne 0) { throw "makensis failed!" } |
||||
|
||||
# Move it into the expected location for a "new" installer. |
||||
New-Item -Path "$BuildDir/package" -ItemType Directory -Force |
||||
Move-Item "$PSScriptRoot/installer/korman.exe" "$BuildDir/package/korman-$KormanRev-windows-classic.exe" |
||||
} finally { |
||||
Pop-Location |
||||
} |
||||
} |
||||
|
||||
function Build-KormanModern($HostGenerator, $TargetPlatform, $OutputDir) { |
||||
$CheckBuildDir = Test-Path $OutputDir |
||||
Start-KormanBuild "$HostGenerator" "$TargetPlatform" "$OutputDir" "$OutputDir/external" |
||||
if (!$CheckBuildDir -Or $RebuildDeps) { |
||||
Complete-KormanBuild "$OutputDir" |
||||
} |
||||
|
||||
if ($NoInstaller) { |
||||
$CPackGenerator = "ZIP" |
||||
} else { |
||||
$CPackGenerator = "WIX;ZIP" |
||||
} |
||||
|
||||
Push-Location "$BuildDir" |
||||
try { |
||||
cpack ` |
||||
-G "$CPackGenerator" ` |
||||
-C Release |
||||
if ($LASTEXITCODE -Eq 0) { |
||||
Remove-Item -Recurse -Force "$BuildDir/package/_CPack_Packages" |
||||
} |
||||
} finally { |
||||
Pop-Location |
||||
} |
||||
} |
||||
|
||||
try { |
||||
Get-Command cmake | Out-Null |
||||
} catch { |
||||
throw "CMake must be installed and available on the PATH." |
||||
} |
||||
|
||||
$MyGenerator = Find-CMakeArgument $Generator $Env:CMAKE_GENERATOR $Generator_LUT "Visual Studio 16 2019" |
||||
if ($Classic) { |
||||
Build-KormanClassicSingleArch "$MyGenerator" x86 "$BuildDir" |
||||
Build-KormanClassicSingleArch "$MyGenerator" x64 "$BuildDir" |
||||
Build-KormanClassicInstaller |
||||
} else { |
||||
$MyPlatform = Find-CMakeArgument $Platform $Env:CMAKE_GENERATOR_PLATFORM $Platform_LUT x64 |
||||
Build-KormanModern "$MyGenerator" "$MyPlatform" "$BuildDir" |
||||
} |
@ -0,0 +1,253 @@
|
||||
# This file is part of Korman. |
||||
# |
||||
# Korman is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Korman is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Korman. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
set(korman_EXTERNAL_STAGING_DIR "${PROJECT_BINARY_DIR}/external" CACHE PATH "External project staging directory") |
||||
mark_as_advanced(korman_EXTERNAL_STAGING_DIR) |
||||
|
||||
set(korman_HARVEST_DIR "${PROJECT_BINARY_DIR}/harvest" CACHE PATH "") |
||||
|
||||
cmake_dependent_option( |
||||
korman_HARVEST_VCREDIST |
||||
"Harvest the vcredist executable as part of Korman's build process" |
||||
ON |
||||
"MSVC" |
||||
OFF |
||||
) |
||||
|
||||
cmake_dependent_option( |
||||
korman_HARVEST_PYTHON22 |
||||
"Harvest (read: download) the Python 2.2.3 installer as part of Korman's build process" |
||||
ON |
||||
"WIN32" # If we ever decide to allow NSIS installers, NSIS can run on non-Windows. |
||||
OFF |
||||
) |
||||
|
||||
# Since we are (ideally) building everything static, inline right here, we can use IPO on |
||||
# all of the static libraries for a uuuuge file size win. Most libs do not do the correct |
||||
# CMake magic to turn this on. |
||||
include(CheckIPOSupported) |
||||
check_ipo_supported( |
||||
RESULT _IPO_SUPPORTED |
||||
OUTPUT _IPO_OUTPUT |
||||
) |
||||
message(STATUS "Checking for IPO: ${_IPO_SUPPORTED} ${_IPO_OUTPUT}") |
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${_IPO_SUPPORTED} CACHE BOOL "") |
||||
|
||||
if(WIN32) |
||||
set(_BUILD_SYSTEM_LIBS ON) |
||||
else() |
||||
set(_BUILD_SYSTEM_LIBS OFF) |
||||
endif() |
||||
|
||||
option(korman_BUILD_HSPLASMA "Build libHSPlasma as part of Korman's build process" ON) |
||||
option(korman_BUILD_JPEG "Build libpjeg-turbo as part of Korman's build process" ${_BUILD_SYSTEM_LIBS}) |
||||
option(korman_BUILD_OGGVORBIS "Build libogg and libvorbis as part of Korman's build process" ${_BUILD_SYSTEM_LIBS}) |
||||
option(korman_BUILD_PNG "Build libpng as part of Korman's build process" ${_BUILD_SYSTEM_LIBS}) |
||||
option(korman_BUILD_ZLIB "Build zlib as part of Korman's build process" ${_BUILD_SYSTEM_LIBS}) |
||||
option(korman_BUILD_STRING_THEORY "Build string_theory as part of Korman's build process" ON) |
||||
option(korman_BUILD_ALWAYS_UPDATE "Always run the update phase for external dependencies" OFF) |
||||
|
||||
if(korman_BUILD_HSPLASMA) |
||||
list(APPEND korlib_DEPENDS HSPlasma) |
||||
endif() |
||||
if(korman_BUILD_JPEG) |
||||
list(APPEND HSPlasma_DEPENDS libjpeg-turbo) |
||||
endif() |
||||
if(korman_BUILD_OGGVORBIS) |
||||
list(APPEND korlib_DEPENDS libvorbis) |
||||
list(APPEND libvorbis_DEPENDS libogg) |
||||
endif() |
||||
if(korman_BUILD_STRING_THEORY) |
||||
list(APPEND HSPlasma_DEPENDS string_theory) |
||||
endif() |
||||
if(korman_BUILD_PNG) |
||||
list(APPEND HSPlasma_DEPENDS libpng) |
||||
endif() |
||||
if(korman_BUILD_ZLIB) |
||||
list(APPEND HSPlasma_DEPENDS zlib) |
||||
list(APPEND libpng_DEPENDS zlib) |
||||
endif() |
||||
|
||||
set(_ExternalProjectCMakeCache |
||||
-DCMAKE_INSTALL_PREFIX:PATH=${korman_HARVEST_DIR} |
||||
-DCMAKE_POLICY_DEFAULT_CMP0069:STRING=NEW |
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=${CMAKE_INTERPROCEDURAL_OPTIMIZATION} |
||||
) |
||||
|
||||
include(ExternalProject) |
||||
include(FetchContent) |
||||
|
||||
function(korman_add_external_project TARGET) |
||||
set(_args ${ARGN}) |
||||
|
||||
if("GIT_REPOSITORY" IN_LIST _args) |
||||
list(APPEND _args GIT_PROGRESS TRUE) |
||||
if(NOT "GIT_SHALLOW" IN_LIST _args) |
||||
list(APPEND _args GIT_SHALLOW TRUE) |
||||
endif() |
||||
endif() |
||||
|
||||
list(FIND _args "CMAKE_CACHE_ARGS" _cache_args_idx) |
||||
if(_cache_args_idx EQUAL -1) |
||||
list(APPEND _args CMAKE_CACHE_ARGS ${_ExternalProjectCMakeCache}) |
||||
else() |
||||
math(EXPR _cache_insert_pos "${_cache_args_idx} + 1") |
||||
list(INSERT _args ${_cache_insert_pos} ${_ExternalProjectCMakeCache}) |
||||
endif() |
||||
|
||||
set(_builddir "${korman_EXTERNAL_STAGING_DIR}/${TARGET}/src/build") |
||||
if(CMAKE_GENERATOR_PLATFORM) |
||||
string(APPEND _builddir "-${CMAKE_GENERATOR_PLATFORM}") |
||||
endif() |
||||
|
||||
list(APPEND _args |
||||
PREFIX "${korman_EXTERNAL_STAGING_DIR}" |
||||
BINARY_DIR "${_builddir}" |
||||
DEPENDS ${${TARGET}_DEPENDS} |
||||
) |
||||
|
||||
ExternalProject_Add(${TARGET} ${_args}) |
||||
endfunction() |
||||
|
||||
if(korman_BUILD_JPEG) |
||||
korman_add_external_project(libjpeg-turbo |
||||
GIT_REPOSITORY "https://github.com/libjpeg-turbo/libjpeg-turbo.git" |
||||
GIT_TAG 2.1.0 |
||||
CMAKE_CACHE_ARGS |
||||
-DBUILD_SHARED_LIBS:BOOL=OFF |
||||
-DENABLE_SHARED:BOOL=FALSE |
||||
-DENABLE_STATIC:BOOL=TRUE |
||||
-DWITH_CRT_DLL:BOOL=ON # WTF libjpeg-turbo, this is a smell. |
||||
-DWITH_JAVA:BOOL=FALSE |
||||
-DWITH_TURBOJPEG:BOOL=FALSE |
||||
) |
||||
endif() |
||||
|
||||
if(korman_BUILD_OGGVORBIS) |
||||
korman_add_external_project(libogg |
||||
GIT_REPOSITORY "https://github.com/xiph/ogg.git" |
||||
GIT_TAG v1.3.5 |
||||
CMAKE_CACHE_ARGS |
||||
-DBUILD_SHARED_LIBS:BOOL=OFF |
||||
-DBUILD_TESTING:BOOL=OFF |
||||
-DINSTALL_DOCS:BOOL=OFF |
||||
) |
||||
korman_add_external_project(libvorbis |
||||
GIT_REPOSITORY "https://github.com/xiph/vorbis.git" |
||||
GIT_TAG v1.3.7 |
||||
CMAKE_CACHE_ARGS |
||||
-DBUILD_SHARED_LIBS:BOOL=OFF |
||||
) |
||||
endif() |
||||
|
||||
if(korman_BUILD_STRING_THEORY) |
||||
# Woe betide us if comaptibility breaks... |
||||
if(MSVC AND MSVC_VERSION LESS 1900) |
||||
set(_string_theory_tag 2.4) |
||||
else() |
||||
set(_string_theory_tag 3.4) |
||||
endif() |
||||
|
||||
korman_add_external_project(string_theory |
||||
GIT_REPOSITORY "https://github.com/zrax/string_theory.git" |
||||
GIT_TAG ${_string_theory_tag} |
||||
CMAKE_CACHE_ARGS |
||||
-DST_BUILD_TESTS:BOOL=OFF |
||||
) |
||||
endif() |
||||
|
||||
if(korman_BUILD_ZLIB) |
||||
# Using zlib-ng instead of zlib because the latter's CMakeLists is a pile of steaming garbage |
||||
# in that it always produces a shared library if BUILD_SHARED_LIBS=OFF, and bad problems when |
||||
# `if(UNIX)` -> TRUE. Grrr. |
||||
korman_add_external_project(zlib |
||||
#URL |
||||
# "https://zlib.net/zlib-1.2.11.tar.gz" |
||||
# "https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.gz/download" |
||||
#DOWNLOAD_NAME "zlib-1.2.11.tar.gz" |
||||
#URL_HASH "SHA256=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" |
||||
GIT_REPOSITORY "https://github.com/zlib-ng/zlib-ng.git" |
||||
GIT_TAG 2.0.5 |
||||
CMAKE_CACHE_ARGS |
||||
-DBUILD_SHARED_LIBS:BOOL=OFF |
||||
-DZLIB_COMPAT:BOOL=ON |
||||
-DZLIB_ENABLE_TESTS:BOOL=OFF |
||||
) |
||||
endif() |
||||
|
||||
if(korman_BUILD_PNG) |
||||
korman_add_external_project(libpng |
||||
URL "https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.gz/download" |
||||
DOWNLOAD_NAME "libpng-1.6.37.tar.gz" |
||||
URL_HASH "SHA256=daeb2620d829575513e35fecc83f0d3791a620b9b93d800b763542ece9390fb4" |
||||
CMAKE_CACHE_ARGS |
||||
-DBUILD_SHARED_LIBS:BOOL=OFF |
||||
-DPNG_EXECUTABLES:BOOL=OFF |
||||
-DPNG_SHARED:BOOL=OFF |
||||
-DPNG_TESTS:BOOL=OFF |
||||
) |
||||
endif() |
||||
|
||||
if(korman_BUILD_HSPLASMA) |
||||
korman_add_external_project(HSPlasma |
||||
GIT_REPOSITORY "https://github.com/H-uru/libhsplasma.git" |
||||
# Be sure to increase this as the feature set used by Korman increases |
||||
GIT_TAG 187e3ee8b63d0f7a7e3cac15ed399af5b825b998 |
||||
# We can only do shallow checkouts if the above is a branch or tag. |
||||
GIT_SHALLOW FALSE |
||||
CMAKE_CACHE_ARGS |
||||
-DCMAKE_UNITY_BUILD:BOOL=ON |
||||
-DENABLE_NET:BOOL=OFF |
||||
-DENABLE_PHYSX:BOOL=OFF |
||||
-DENABLE_PYTHON:BOOL=ON |
||||
-DENABLE_TOOLS:BOOL=OFF |
||||
-DPYTHON_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIRS} |
||||
-DPYTHON_LIBRARY:FILEPATH=${Python3_LIBRARIES} |
||||
) |
||||
endif() |
||||
|
||||
korman_add_external_project(korlib |
||||
SOURCE_DIR "${PROJECT_SOURCE_DIR}/korlib" |
||||
CMAKE_CACHE_ARGS |
||||
-Dkorlib_PYTHON_VERSION:STRING=${Blender_PYTHON_VERSION} |
||||
-DPython3_ROOT:PATH=${Python3_ROOT} # Passthru helper |
||||
) |
||||
|
||||
if(korman_HARVEST_VCREDIST) |
||||
find_package(VCRedist COMPONENTS Executable REQUIRED) |
||||
set(_vcredist_destination "${korman_HARVEST_DIR}/bin/${VCRedist_NAME}") |
||||
add_custom_target(VCRedist |
||||
ALL |
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${korman_HARVEST_DIR}" |
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${VCRedist_EXECUTABLE}" "${_vcredist_destination}" |
||||
BYPRODUCTS "${_vcredist_destination}" |
||||
) |
||||
install( |
||||
PROGRAMS |
||||
"${_vcredist_destination}" |
||||
DESTINATION "." |
||||
) |
||||
endif() |
||||
|
||||
FetchContent_Declare(Python22 |
||||
URL "https://www.python.org/ftp/python/2.2.3/Python-2.2.3.exe" |
||||
URL_HASH MD5=d76e774a4169794ae0d7a8598478e69e |
||||
DOWNLOAD_DIR "${korman_HARVEST_DIR}/bin" |
||||
DOWNLOAD_NAME "Python-2.2.3.exe" |
||||
DOWNLOAD_NO_EXTRACT TRUE # Why is this not a flag? Yes, that bit me. |
||||
) |
||||
if(korman_HARVEST_PYTHON22 AND NOT Python22_POPULATED) |
||||
FetchContent_Populate(Python22) |
||||
endif() |
@ -0,0 +1,85 @@
|
||||
# This file is part of Korman. |
||||
# |
||||
# Korman is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Korman is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Korman. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
# The parens in this env variable give CMake heartburn, so we whisper sweet nothings. |
||||
set(_PROGRAMFILES_X86 "PROGRAMFILES(X86)") |
||||
set(_PROGRAMFILES_X86 "$ENV{${_PROGRAMFILES_X86}}") |
||||
|
||||
find_program(Blender_EXECUTABLE |
||||
NAMES blender |
||||
PATHS |
||||
"${Blender_ROOT}" |
||||
"$ENV{PROGRAMFILES}/Blender Foundation/Blender" |
||||
"${_PROGRAMFILES_X86}/Blender Foundation/Blender" |
||||
) |
||||
|
||||
# Hacky? On Windows, we want to make sure that the Blender EXE matches sizeof void* |
||||
# Yes, this has bitten me. If it bites you, the result will be "Import Error: PyHSPlasma is not a |
||||
# valid Win32 application." That's hardly useful... |
||||
if(WIN32 AND EXISTS "${Blender_EXECUTABLE}") |
||||
find_package(dumpbin) |
||||
if(dumpbin_FOUND) |
||||
execute_process( |
||||
COMMAND "${dumpbin_EXECUTABLE}" /headers "${Blender_EXECUTABLE}" |
||||
RESULTS_VARIABLE _RETURNCODE |
||||
OUTPUT_VARIABLE _dumpbin_output |
||||
ERROR_VARIABLE _dumpbin_error |
||||
OUTPUT_STRIP_TRAILING_WHITESPACE |
||||
ERROR_STRIP_TRAILING_WHITESPACE |
||||
) |
||||
if(_RETURNCODE EQUAL 0) |
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
||||
set(_expected_arch "machine \\(x64\\)") |
||||
else() |
||||
set(_expected_arch "machine \\(x86\\)") |
||||
endif() |
||||
if(NOT "${_dumpbin_output}" MATCHES "${_expected_arch}") |
||||
unset(Blender_EXECUTABLE CACHE) |
||||
endif() |
||||
else() |
||||
message(WARNING "dumpbin failed ${_dumpbin_error}") |
||||
endif() |
||||
else() |
||||
message(WARNING "dumpbin not found, not verifying blender executable") |
||||
endif() |
||||
endif() |
||||
|
||||
if(EXISTS "${Blender_EXECUTABLE}") |
||||
# Starting Blender is noisy on stdout, so all the extra characters will make sure things go right. |
||||
# https://youtu.be/SlQFIsQ0dbs?t=19 |
||||
set(_Blender_PYTHON_EXPR |
||||
"import sys; print('!!! OOGABOOGA {}.{} AGOOBAGOO !!!'.format(sys.version_info[0], sys.version_info[1]))" |
||||
) |
||||
execute_process( |
||||
COMMAND "${Blender_EXECUTABLE}" -b --python-expr "${_Blender_PYTHON_EXPR}" |
||||
RESULTS_VARIABLE _RETURNCODE |
||||
OUTPUT_VARIABLE _Blender_VERSION_OUTPUT |
||||
ERROR_VARIABLE _Blender_VERSION_OUTPUT |
||||
OUTPUT_STRIP_TRAILING_WHITESPACE |
||||
ERROR_STRIP_TRAILING_WHITESPACE |
||||
) |
||||
string(REGEX MATCH [[Blender ([0-9]+\.[0-9]+)]] _match "${_Blender_VERSION_OUTPUT}") |
||||
set(Blender_VERSION "${CMAKE_MATCH_1}") |
||||
string(REGEX MATCH [[!!! OOGABOOGA ([0-9]+\.[0-9]+) AGOOBAGOO !!!]] _match "${_Blender_VERSION_OUTPUT}") |
||||
set(Blender_PYTHON_VERSION "${CMAKE_MATCH_1}") |
||||
endif() |
||||
|
||||
mark_as_advanced(Blender_EXECUTABLE) |
||||
|
||||
include(FindPackageHandleStandardArgs) |
||||
find_package_handle_standard_args(Blender |
||||
REQUIRED_VARS Blender_EXECUTABLE Blender_VERSION Blender_PYTHON_VERSION |
||||
VERSION_VAR Blender_VERSION |
||||
) |
@ -0,0 +1,120 @@
|
||||
# This file is part of Korman. |
||||
# |
||||
# Korman is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Korman is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Korman. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
cmake_policy(PUSH) |
||||
cmake_policy(SET CMP0057 NEW) # if(IN_LIST) |
||||
|
||||
function(_get_subdirectories RESULT DIRECTORY) |
||||
file(GLOB children INCLUDE_DIRECTORIES RELATIVE "${DIRECTORY}" "${DIRECTORY}/*") |
||||
foreach(child IN LISTS children) |
||||
if(IS_DIRECTORY "${DIRECTORY}/${child}") |
||||
list(APPEND subdirectories "${child}") |
||||
endif() |
||||
endforeach() |
||||
set(${RESULT} ${subdirectories} PARENT_SCOPE) |
||||
endfunction() |
||||
|
||||
# Is this even legal? |
||||
if(NOT VCRedist_FIND_COMPONENTS) |
||||
set(VCRedist_FIND_COMPONENTS Executable MergeModules) |
||||
endif() |
||||
|
||||
if(MSVC) |
||||
# The parens in this env variable give CMake heartburn, so we whisper sweet nothings. |
||||
set(_PROGRAMFILES_X86 "PROGRAMFILES(X86)") |
||||
set(_PROGRAMFILES_X86 "$ENV{${_PROGRAMFILES_X86}}") |
||||
|
||||
# TODO: support non visual studio generators |
||||
set(_vs_install_root "${CMAKE_VS_DEVENV_COMMAND}/../../../") |
||||
get_filename_component(_vs_install_root "${_vs_install_root}" ABSOLUTE) |
||||
|
||||
# Valid paths: |
||||
# 2013, 2015: VC/redist/1033/<exe> |
||||
# 2017, 2019: VC/redist/MSVC/<MSVC VERSION>/<exe> |
||||
# 2019: VC/redist/MSVC/<toolset version>/<exe> |
||||
set(_redist_dir "${_vs_install_root}/VC/redist") |
||||
_get_subdirectories(_msvc_subdirs "${_redist_dir}/MSVC") |
||||
foreach(_subdir IN LISTS _msvc_subdirs) |
||||
list(APPEND _redist_paths "${_redist_dir}/MSVC/${_subdir}") |
||||
endforeach() |
||||
|
||||
# These are known, valid locations, so we prefer them first. |
||||
list(INSERT _redist_paths 0 "${_redist_dir}/1033" "${_redist_dir}/MSVC/v${MSVC_TOOLSET_VERSION}") |
||||
list(REMOVE_DUPLICATES _redist_paths) |
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
||||
set(_redist_arch x64) |
||||
else() |
||||
set(_redist_arch x86) |
||||
endif() |
||||
|
||||
if("Executable" IN_LIST VCRedist_FIND_COMPONENTS) |
||||
list(APPEND _required_vars "VCRedist_EXECUTABLE") |
||||
|
||||
find_program(VCRedist_EXECUTABLE |
||||
NAMES "vcredist_${_redist_arch}" "vc_redist.${_redist_arch}" |
||||
PATHS ${_redist_paths} |
||||
) |
||||
|
||||
mark_as_advanced(VCRedist_EXECUTABLE) |
||||
set(VCRedist_NAME "vcredist_${_redist_arch}.exe") |
||||
if(EXISTS "${VCRedist_EXECUTABLE}") |
||||
set(VCRedist_Executable_FOUND TRUE) |
||||
endif() |
||||
endif() |
||||
|
||||
# Valid Paths: |
||||
# Visual Studio <= 2015: <Program Files (x86)>/Common Files/Merge Modules/ |
||||
# Visual Studio >= 2017: <Visual Studio root>/VC/<MSVC or toolset version>/MergeModules/ |
||||
if("MergeModules" IN_LIST VCRedist_FIND_COMPONENTS) |
||||
list(APPEND _merge_module_paths "${_PROGRAMFILES_X86}/Common Files" ${_redist_paths}) |
||||
set(_merge_module_suffixes "Merge Modules" "MergeModules") |
||||
|
||||
# We'll flip it OFF if anything is missing |
||||
set(VCRedist_MergeModules_FOUND TRUE) |
||||
function(_find_merge_module MODULE_NAME) |
||||
string(TOUPPER "${MODULE_NAME}" _module_name_upper) |
||||
set(VARIABLE "VCRedist_${_module_name_upper}_MERGE_MODULE") |
||||
find_file(${VARIABLE} |
||||
NAMES "Microsoft_VC${MSVC_TOOLSET_VERSION}_${MODULE_NAME}_${_redist_arch}.msm" |
||||
PATHS ${_merge_module_paths} |
||||
PATH_SUFFIXES ${_merge_module_suffixes} |
||||
) |
||||
mark_as_advanced(${VARIABLE}) |
||||
set(_required_vars ${_required_vars} ${VARIABLE} PARENT_SCOPE) |
||||
if(EXISTS "${${VARIABLE}}") |
||||
set(VCRedist_MERGE_MODULES ${VCRedist_MERGE_MODULES} "${${VARIABLE}}" PARENT_SCOPE) |
||||
else() |
||||
set(VCRedist_MergeModules_FOUND FALSE PARENT_SCOPE) |
||||
endif() |
||||
endfunction() |
||||
|
||||
_find_merge_module(CRT) |
||||
_find_merge_module(MFC) |
||||
_find_merge_module(MFCLOC) |
||||
_find_merge_module(OpenMP) |
||||
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 110) |
||||
_find_merge_module(CXXAMP) |
||||
endif() |
||||
endif() |
||||
endif() |
||||
|
||||
include(FindPackageHandleStandardArgs) |
||||
find_package_handle_standard_args(VCRedist |
||||
REQUIRED_VARS ${_required_vars} # Optional in CMake 3.18+, but we only require 3.12 |
||||
HANDLE_COMPONENTS |
||||
) |
||||
|
||||
cmake_policy(POP) |
@ -0,0 +1,26 @@
|
||||
# This file is part of Korman. |
||||
# |
||||
# Korman is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Korman is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Korman. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
|
||||
get_filename_component(_linker_dir "${CMAKE_LINKER}" DIRECTORY) |
||||
find_program(dumpbin_EXECUTABLE |
||||
NAMES dumpbin |
||||
PATHS ${_linker_dir} |
||||
) |
||||
|
||||
mark_as_advanced(dumpbin_EXECUTABLE) |
||||
|
||||
include(FindPackageHandleStandardArgs) |
||||
find_package_handle_standard_args(dumpbin REQUIRED_VARS dumpbin_EXECUTABLE) |
@ -0,0 +1,121 @@
|
||||
# This file is part of Korman. |
||||
# |
||||
# Korman is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Korman is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Korman. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
set(CPACK_PACKAGE_NAME Korman) |
||||
set(CPACK_PACKAGE_VENDOR "Guild of Writers") |
||||
set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}/package") |
||||
set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/installer/Icon.ico") |
||||
set(CPACK_THREADS 0) # Allows multi-threaded LZMA compression in CMake 3.21+ |
||||
|
||||
find_package(Git) |
||||
if(Git_FOUND) |
||||
execute_process( |
||||
COMMAND ${GIT_EXECUTABLE} describe --tags --dirty |
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" |
||||
OUTPUT_VARIABLE _korman_rev |
||||
OUTPUT_STRIP_TRAILING_WHITESPACE |
||||
ERROR_QUIET |
||||
) |
||||
string(REGEX REPLACE "[\r\n]" " " _korman_rev "${_korman_rev}") |
||||
else() |
||||
set(_korman_rev "untracked") |
||||
endif() |
||||
|
||||
# Don't rely on the hardwired version number from project() since this may be some rando |
||||
# git checkout or CI run. Also, apparently CPACK_SYSTEM_NAME is faulty. Stupid CMake. |
||||
if(WIN32) |
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
||||
set(_korman_system "windows64") |
||||
else() |
||||
set(_korman_system "windows32") |
||||
endif() |
||||
else() |
||||
set(_korman_system "${CMAKE_SYSTEM_NAME}") |
||||
endif() |
||||
set(CPACK_PACKAGE_FILE_NAME "korman-${_korman_rev}-${_korman_system}") |
||||
|
||||
set(CPACK_PACKAGE_CHECKSUM SHA256) |
||||
|
||||
# Generate license file based on the install settings |
||||
if(korman_INSTALL_BINARY_DIR OR korman_INSTALL_SCRIPTS) |
||||
set(KORMAN_LICENSE "Korman is licensed under the GNU GPLv3.") |
||||
file(READ "${PROJECT_SOURCE_DIR}/installer/GPLv3.txt" _license) |
||||
string(APPEND LICENSE_TEXT "${_license}\n") |
||||
endif() |
||||
if(korman_INSTALL_BLENDER) |
||||
set(BLENDER_LICENSE "Blender is licensed under the GNU GPLv2.") |
||||
file(READ "${PROJECT_SOURCE_DIR}/installer/GPLv2.txt" _license) |
||||
string(APPEND LICENSE_TEXT "${_license}\n") |
||||
endif() |
||||
|
||||
configure_file( |
||||
"${PROJECT_SOURCE_DIR}/installer/license.txt.in" |
||||
"${PROJECT_BINARY_DIR}/license.txt" |
||||
@ONLY |
||||
) |
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/license.txt") |
||||
install(FILES |
||||
"${PROJECT_BINARY_DIR}/license.txt" |
||||
DESTINATION "." |
||||
) |
||||
|
||||
set(CPACK_COMPONENTS_ALL "Korman") |
||||
set(CPACK_COMPONENTS_GROUPING "ALL_COMPONENTS_IN_ONE") |
||||
set(CPACK_COMPONENT_KORMAN_HIDDEN TRUE) |
||||
|
||||
if(korman_INSTALL_BLENDER) |
||||
list(APPEND CPACK_PACKAGE_EXECUTABLES blender Blender) |
||||
list(APPEND CPACK_COMPONENTS_ALL "Blender") |
||||
set(CPACK_COMPONENT_BLENDER_HIDDEN TRUE) |
||||
endif() |
||||
|
||||
if(korman_HARVEST_PYTHON22) |
||||
list(APPEND CPACK_COMPONENTS_ALL "Python22") |
||||
set(CPACK_COMPONENT_PYTHON22_HIDDEN TRUE) |
||||
endif() |
||||
|
||||
if(WIN32) |
||||
# We're not actually going to ship this variant, but better prepared than sorry. |
||||
if(korman_HARVEST_VCREDIST) |
||||
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS |
||||
"ExecWait \\\"$INSTDIR\\\\${VCRedist_NAME} /q /norestart\\\"" |
||||
) |
||||
endif() |
||||
|
||||
set(CPACK_WIX_UPGRADE_GUID 84ef4b1d-27b6-54de-a73b-8fb1beb007ac) # KormanUpgrade |
||||
# I think this should be randomized by CPack and not hardcoded? |
||||
#set(CPACK_WIX_PRODUCT_GUID 74e91f5d-6d09-5d7f-a48f-3d0b011ef2df) # KormanProduct |
||||
|
||||
find_package(VCRedist COMPONENTS MergeModules REQUIRED) |
||||
configure_file( |
||||
"${PROJECT_SOURCE_DIR}/installer/WiX.template.in" |
||||
"${PROJECT_BINARY_DIR}/WiX.template" |
||||
@ONLY |
||||
) |
||||
set(CPACK_WIX_TEMPLATE "${PROJECT_BINARY_DIR}/WiX.template") |
||||
|
||||
set(CPACK_WIX_UI_BANNER "${PROJECT_SOURCE_DIR}/installer/WIX_UI_BANNER.bmp") |
||||
set(CPACK_WIX_UI_DIALOG "${PROJECT_SOURCE_DIR}/installer/WIX_UI_DIALOG.bmp") |
||||
|
||||
set(CPACK_WIX_ROOT_FEATURE_TITLE "Blender for Korman") |
||||
|
||||
# Great release compression. Change it to "none" to iterate faster. |
||||
set(CPACK_WIX_LIGHT_EXTRA_FLAGS -dcl:high) |
||||
endif() |
||||
|
||||
set(CPACK_ARCHIVE_THREADS 0) |
||||
|
||||
# Apparently this has to come last. Shaweet. |
||||
include(CPack) |
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE |
||||
Version 2, June 1991 |
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., |
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
Everyone is permitted to copy and distribute verbatim copies |
||||
of this license document, but changing it is not allowed. |
||||
|
||||
Preamble |
||||
|
||||
The licenses for most software are designed to take away your |
||||
freedom to share and change it. By contrast, the GNU General Public |
||||
License is intended to guarantee your freedom to share and change free |
||||
software--to make sure the software is free for all its users. This |
||||
General Public License applies to most of the Free Software |
||||
Foundation's software and to any other program whose authors commit to |
||||
using it. (Some other Free Software Foundation software is covered by |
||||
the GNU Lesser General Public License instead.) You can apply it to |
||||
your programs, too. |
||||
|
||||
When we speak of free software, we are referring to freedom, not |
||||
price. Our General Public Licenses are designed to make sure that you |
||||
have the freedom to distribute copies of free software (and charge for |
||||
this service if you wish), that you receive source code or can get it |
||||
if you want it, that you can change the software or use pieces of it |
||||
in new free programs; and that you know you can do these things. |
||||
|
||||
To protect your rights, we need to make restrictions that forbid |
||||
anyone to deny you these rights or to ask you to surrender the rights. |
||||
These restrictions translate to certain responsibilities for you if you |
||||
distribute copies of the software, or if you modify it. |
||||
|
||||
For example, if you distribute copies of such a program, whether |
||||
gratis or for a fee, you must give the recipients all the rights that |
||||
you have. You must make sure that they, too, receive or can get the |
||||
source code. And you must show them these terms so they know their |
||||
rights. |
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and |
||||
(2) offer you this license which gives you legal permission to copy, |
||||
distribute and/or modify the software. |
||||
|
||||
Also, for each author's protection and ours, we want to make certain |
||||
that everyone understands that there is no warranty for this free |
||||
software. If the software is modified by someone else and passed on, we |
||||
want its recipients to know that what they have is not the original, so |
||||
that any problems introduced by others will not reflect on the original |
||||
authors' reputations. |
||||
|
||||
Finally, any free program is threatened constantly by software |
||||
patents. We wish to avoid the danger that redistributors of a free |
||||
program will individually obtain patent licenses, in effect making the |
||||
program proprietary. To prevent this, we have made it clear that any |
||||
patent must be licensed for everyone's free use or not licensed at all. |
||||
|
||||
The precise terms and conditions for copying, distribution and |
||||
modification follow. |
||||
|
||||
GNU GENERAL PUBLIC LICENSE |
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
||||
|
||||
0. This License applies to any program or other work which contains |
||||
a notice placed by the copyright holder saying it may be distributed |
||||
under the terms of this General Public License. The "Program", below, |
||||
refers to any such program or work, and a "work based on the Program" |
||||
means either the Program or any derivative work under copyright law: |
||||
that is to say, a work containing the Program or a portion of it, |
||||
either verbatim or with modifications and/or translated into another |
||||
language. (Hereinafter, translation is included without limitation in |
||||
the term "modification".) Each licensee is addressed as "you". |
||||
|
||||
Activities other than copying, distribution and modification are not |
||||
covered by this License; they are outside its scope. The act of |
||||
running the Program is not restricted, and the output from the Program |
||||
is covered only if its contents constitute a work based on the |
||||
Program (independent of having been made by running the Program). |
||||
Whether that is true depends on what the Program does. |
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's |
||||
source code as you receive it, in any medium, provided that you |
||||
conspicuously and appropriately publish on each copy an appropriate |
||||
copyright notice and disclaimer of warranty; keep intact all the |
||||
notices that refer to this License and to the absence of any warranty; |
||||
and give any other recipients of the Program a copy of this License |
||||
along with the Program. |
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and |
||||
you may at your option offer warranty protection in exchange for a fee. |
||||
|
||||
2. You may modify your copy or copies of the Program or any portion |
||||
of it, thus forming a work based on the Program, and copy and |
||||
distribute such modifications or work under the terms of Section 1 |
||||
above, provided that you also meet all of these conditions: |
||||
|
||||
a) You must cause the modified files to carry prominent notices |
||||
stating that you changed the files and the date of any change. |
||||
|
||||
b) You must cause any work that you distribute or publish, that in |
||||
whole or in part contains or is derived from the Program or any |
||||
part thereof, to be licensed as a whole at no charge to all third |
||||
|