Files
CosmicEngineGradleVersion/build.gradle
T

90 lines
2.8 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* This file was generated by the Gradle 'init' task.
*
* This is a general purpose Gradle build.
* Learn more about Gradle by exploring our Samples at https://docs.gradle.org/9.9.0/samples
*/
plugins {
id("org.ysb33r.doxygen") version "3.0.0"
}
def isWindows = org.gradle.internal.os.OperatingSystem.current().isWindows()
/**
* Récupération du triplet vcpkg (x64-windows, x64-linux…).
*/
def triplet = project.findProperty('vcpkg.triplet') ?: 'x64-windows'
def assetDir = file("CosmicEngine/src/main/resources")
/**
* Répertoires générés par vcpkg.
*/
def includeDir = file("./vcpkg_installed/${triplet}/include")
def libDir = file("./vcpkg_installed/${triplet}/lib")
def binDir = file("./vcpkg_installed/${triplet}/bin")
// DLL (Windows: bin/) ou SO (Linux: lib/) à copier à côté de l'exécutable.
def runtimeDir = isWindows ? binDir : libDir
// Fichier de réponse généré APRÈS l'install vcpkg (liste des libs à lier).
def rspFile = layout.buildDirectory.file('vcpkg/libs.rsp').get().asFile
// Partagé avec les sous-projets (CosmicEngine, Scripts, App).
ext.vcpkgInclude = includeDir
ext.vcpkgLibDir = libDir
ext.vcpkgRsp = rspFile
ext.runtimeDir = runtimeDir
ext.assetDir = assetDir
def vcpkgRoot = file('vcpkg')
def vcpkgExe = new File(vcpkgRoot, isWindows ? 'vcpkg.exe' : 'vcpkg')
def tripletsDir = file('vcpkg/triplets') // pour les triplets custom (x64-linux-dynamic, x64-clang-dynamic...) si jamais
/**
* Tâche "vcpkg" – lance vcpkg.
*/
tasks.register('vcpkg', Exec) {
commandLine vcpkgExe.absolutePath, 'install',
'--triplet', triplet,
'--host-triplet', triplet,
"--overlay-triplets=${tripletsDir.absolutePath}"
environment 'VCPKG_ROOT', vcpkgRoot.absolutePath
workingDir '.'
description = 'Installe les dépendances via vcpkg.'
group = 'build'
// Liste les libs installées dans un fichier @rsp lu par le linker.
doLast {
def libs = libDir.exists() ? libDir.listFiles().findAll {
it.isFile() && !it.name.contains('VkLayer') &&
(it.name.endsWith('.lib') || it.name.endsWith('.a') || it.name.endsWith('.so'))
}.sort { it.name } : []
def lines = libs.collect { '"' + it.absolutePath.replace('\\', '/') + '"' }
if (!isWindows) {
lines = ['-Wl,--as-needed', '-Wl,--start-group'] + lines + ['-Wl,--end-group']
}
rspFile.parentFile.mkdirs()
rspFile.text = lines.join('\n') + '\n'
}
}
/**
* Nettoyage complet (incluant vcpkg_installed).
*/
tasks.named('clean') {
delete 'vcpkg_installed'
}
doxygen {
sourceSets {
main {
option 'generate_html', true
sources new File(projectDir,'CosmicEngine/src/main')
}
internal {
options generate_latex: false
}
}
}