Windows Export

This commit is contained in:
Josef 2024-04-27 17:03:50 +02:00
parent aabd422b77
commit 64a8908bb6
9 changed files with 270 additions and 2 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
## NOTHING IN HERE FOR NOW
/build-steps/local-build-steps-windows.txt
/outputs
/godot-rj-nuget-package
/godot/modules/rokojori_action_library

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "godot"]
path = godot
url = https://github.com/godotengine/godot.git
[submodule "rokojori-action-library"]
path = rokojori-action-library
url = git@community.rokojori.com:Rokojori/rj-action-library-cpp.git

View File

@ -4,7 +4,12 @@
================================================
[ Build Cpp]
[ Copy C++]
cd {ROOT-PATH}
node copy-cpp-source.js
[ Build C++ ]
cd {GODOT-EDITOR-PATH}
"{SCONS-INSTALLATION-PATH}\scons" platform=windows module_mono_enabled=yes
[ Create Mono Glue ]
@ -13,4 +18,8 @@ cd {GODOT-EDITOR-PATH}
[ Build Assemblies ]
cd {GODOT-EDITOR-PATH}
"modules/mono/build_scripts/build_assemblies.py" --godot-output-dir=./bin
"modules/mono/build_scripts/build_assemblies.py" --godot-output-dir=./bin --push-nupkgs-local "{ROOT-PATH}/godot-rj-nuget-package"
[ Create Output Directory ]
cd {ROOT-PATH}
node create-output.js windows

88
copy-cpp-source.js Normal file
View File

@ -0,0 +1,88 @@
const { spawn } = require("node:child_process");
const fs = require( "node:fs/promises" );
const path = require( "path" );
const { loadJSON } = require( "./library.js" );
let from = "rokojori-action-library";
let to = "godot/modules/rokojori_action_library"
async function main()
{
console.log( "Copying C++ source" );
await deleteOldDirectory();
await copyToModules();
// await runBuild();
console.log( "Copying C++ source" );
}
async function deleteOldDirectory()
{
let stats = await fs.stat( to );
if ( stats )
{
console.log( `deleting previous directory: "${to}"` );
await fs.rm( to, { recursive: true } );
}
return Promise.resolve();
}
async function copyToModules()
{
console.log( "copying:", `"${from}" >> "${to}"` );
await fs.cp( from, to, { recursive : true } );
return Promise.resolve();
}
async function runBuild()
{
let { exec } = require( "child_process");
let settingsFileName = "build-settings.json";
let settings = await loadJSON( "build-settings.json" );
if ( ! settings )
{
console.error( `Build Settings missing... Add a json-file '${settingsFileName}' with a member 'sconsPath'` )
return Promise.reject();
}
let command = `${settings.sconsPath}/scons platform=windows module_mono_enabled=yes`;
let executionDirectory = path.join( __dirname, "godot" );
let options = { cwd: executionDirectory };
console.log( "Starting build:", command, "Options:", JSON.stringify( options ) );
let process = exec( command, options );
process.stdout.on( "data",
( data ) =>
{
console.log( `${data}` );
}
);
process.stderr.on( "data",
( data ) =>
{
console.error( `${data}` );
}
);
process.on( "close",
( code ) =>
{
console.log( `child process exited with code ${code} `);
}
);
}
main();

90
create-output.js Normal file
View File

@ -0,0 +1,90 @@
const { argv } = require("process");
const path = require( "path" );
const fs = require( "node:fs/promises" );
const { exists } = require( "./library.js" );
if ( argv.length !== 3 )
{
let platforms = [ "windows" ];
console.error( "Platform missing in the command. Add one of these to the command line:", platforms.join( ", " ) );
return;
}
let targetDirectory = "outputs";
let godotName = "godot-4.3-dev-rokojori";
let platform = argv[ 2 ];
let godotPlatformName = godotName + "-" + argv[ 2 ];
let platformTargetDirectory = path.join( targetDirectory, godotPlatformName );
async function main()
{
console.log( "Creating output" );
await deleteOldDirectory();
await createDirectory();
console.log( "Output done" );
}
async function deleteOldDirectory()
{
let directoryExists = await exists( platformTargetDirectory );
console.log( "checking if old directory exists", directoryExists );
if ( directoryExists )
{
console.log( `deleting previous directory: "${platformTargetDirectory}"` );
await fs.rm( platformTargetDirectory, { recursive: true } );
}
return Promise.resolve();
}
async function createDirectory()
{
console.log( `creating directory: "${platformTargetDirectory}"` );
await fs.mkdir( platformTargetDirectory, { recursive: true } );
let godotFrom = "godot/bin";
let godotTo = path.join( platformTargetDirectory, "godot" );
console.log( `copying godot: "${godotFrom}" >> "${godotTo}"` );
await fs.cp( godotFrom, godotTo, { recursive : true } );
let npFrom = "godot-rj-nuget-package";
let npTo = path.join( platformTargetDirectory, npFrom );
console.log( `copying nupkg: "${npFrom}" >> "${npTo}"` );
await fs.cp( npFrom, npTo, { recursive : true } );
let installers =
{
"windows" : "install-godot-windows.bat"
};
let installer = installers[ platform ];
let installFrom = "install-scripts/" + installer;
let installTo = path.join( platformTargetDirectory, installer );
console.log( `copying installer: "${installFrom}" >> "${installTo}"` );
await fs.cp( installFrom, installTo, { recursive : true } );
}
main();

1
godot Submodule

@ -0,0 +1 @@
Subproject commit 11d3768132582d192b8464769f26b493ae822321

View File

@ -0,0 +1 @@
dotnet nuget add source "godot-rj-nuget-package" --name RokojoriGodot

65
library.js Normal file
View File

@ -0,0 +1,65 @@
const { stat } = require("node:fs");
const fs = require( "node:fs/promises" );
async function exists( filePath )
{
try
{
let stats = await fs.stat( filePath );
let exists = stats !== undefined && stats !== null;
return Promise.resolve( exists );
}
catch( e )
{
}
return Promise.resolve( false );
}
async function loadUTF8( filePath )
{
try
{
let data = await fs.readFile( filePath );
let stringData = data.toString();
return Promise.resolve( stringData );
}
catch ( exception )
{
console.warn( exception );
}
return Promise.resolve( null );
}
async function loadJSON( filePath )
{
let text = await loadUTF8( filePath );
if ( text === null )
{
return Promise.resolve( null );
}
try
{
let jsonObject = JSON.parse( text );
return Promise.resolve( jsonObject );
}
catch ( exception )
{
console.warn( exception );
}
return Promise.resolve( null );
}
module.exports =
{
exists,
loadUTF8,
loadJSON
}

@ -0,0 +1 @@
Subproject commit 88c864ac6a6c90d63774e8f7b13eb8dcb1db56e5