Skip to content

Commit

Permalink
Tweaking info text (+11 squashed commits)
Browse files Browse the repository at this point in the history
Squashed commits:
[5d5705b] Add additional guard for reg key value (was throwing)
[c999aeb] Guard against non-existant regkey
[39bbf63] Helps to use the right operator
[ed13668] Put -toolbootstrap at end of net compile command
[6d8f715] Support error message if VS2017 registry entry doesn't exist
[f13173d] Support Visual Studio Mac
[1d39c47] Working on VS2015/VS2017 support
[069d705] Adding ide support VS2017
[9ae22cb] Removing some workarounds in root CMake
[b166a16] Cleanups for VS2015/VS2017 build
[769e74e] Visual Studio 2017 support (WIP)
  • Loading branch information
JoshEngebretson committed Nov 29, 2016
1 parent 82221ed commit a28af18
Show file tree
Hide file tree
Showing 23 changed files with 1,183 additions and 121 deletions.
11 changes: 7 additions & 4 deletions Build/Scripts/Bootstrap.js
Expand Up @@ -27,17 +27,20 @@ function printHelp() {
console.log("--with-android : Build with Android platform support");
console.log("--with-ios : Build with iOS platform support");
console.log("--with-web : Build with Web platform support");
if (os.platform() == "win32") {
console.log("--opengl : Enable OpenGL renderer");
console.log("--d3d11 : Enable DirectX 11 renderer");
}
console.log("--debug : Build debug version of the editor and associated platform runtimes");
console.log("--noclean : Do not clean before building, useful during development");
console.log("--nonet : Build without AtomicNET C# scripting support");
console.log("--with-docs : Build and install API documents into the editor (requires npm on path)");
console.log("--noexamples : Don't include examples with editor");
console.log("--task=name : Build the specified task (for development)");
console.log("--package : packages the editor to Artifacts/Dist");
if (os.platform() == "win32") {
console.log("--vs2015 : Build with VS2015");
console.log("--vs2017 : Build with VS2017");
console.log("--opengl : Enable OpenGL renderer");
console.log("--d3d11 : Enable DirectX 11 renderer");
}

console.log("--------------------------")

process.exit(0);
Expand Down
11 changes: 10 additions & 1 deletion Build/Scripts/BuildAtomicNET.js
Expand Up @@ -64,7 +64,16 @@ namespace('build', function() {

var cmds = [];

var netCmd = host.atomicTool + " net compile " + atomicRoot + "Script/AtomicNET/AtomicNETProject.json " + platforms + " -config " + config["config"] + " -toolbootstrap";
var netCmd = host.atomicTool + " net compile " + atomicRoot + "Script/AtomicNET/AtomicNETProject.json " + platforms + " -config " + config["config"];

if (os.platform() == 'win32') {

var vsver = (config["vs2017"] ? "VS2017" : "VS2015");
netCmd += " -toolversion " + vsver;

}

netCmd += " -toolbootstrap"

console.log(netCmd);

Expand Down
62 changes: 26 additions & 36 deletions Build/Scripts/BuildWindows.js
Expand Up @@ -30,7 +30,7 @@ function copyAtomicEditor() {
// copy AtomicTool
fs.copySync(buildDir + "Source/AtomicTool/" + config["config"] +"/AtomicTool.exe",
editorAppFolder + "AtomicTool.exe");

// We need some resources to run
fs.copySync(atomicRoot + "Resources/CoreData",
editorAppFolder + "Resources/CoreData");
Expand Down Expand Up @@ -59,14 +59,34 @@ function copyAtomicEditor() {

namespace('build', function() {

// get CMake flags for generator, vsver parameter can be VS2017/VS2015, etc
function getCMakeFlags(vsver) {

var flags = "\"";

// Redistributable editor build
flags += "-DATOMIC_DEV_BUILD=0";

// graphics backend (overrides default DX9)
flags += " -DATOMIC_OPENGL=" + (config["opengl"] ? "ON" : "OFF");
flags += " -DATOMIC_D3D11=" + (config["d3d11"] ? "ON" : "OFF");

flags += "\"";

return flags;

}

task('atomiceditor_phase2', {
async: true
}, function() {

process.chdir(buildDir);

var vsver = (config["vs2017"] ? "VS2017" : "VS2015");

var cmds = [];
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAtomicEditorPhase2.bat " + config["config"]);
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAtomicEditorPhase2.bat " + config["config"] + " " + vsver);

jake.exec(cmds, function() {

Expand Down Expand Up @@ -102,10 +122,13 @@ namespace('build', function() {

process.chdir(buildDir);

var vsver = (config["vs2017"] ? "VS2017" : "VS2015");

var cmds = [];

// Generate Atomic solution, AtomicTool binary, and script bindings
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAtomicEditorPhase1.bat " + config["config"]);
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAtomicEditorPhase1.bat " + config["config"] + " " +
vsver + " " + getCMakeFlags(vsver));

jake.exec(cmds, function() {

Expand All @@ -129,37 +152,4 @@ namespace('build', function() {

});

// Generate a Visual Studio 2015 solution
task('genvs2015', {
async: true
}, function(devBuild) {
if (devBuild === undefined)
devBuild = 1;

var opengl = config["opengl"] ? "ON" : "OFF";
var d3d11 = config["d3d11"] ? "ON" : "OFF";

var slnRoot = path.resolve(atomicRoot, "") + "-VS2015\\";

if (!fs.existsSync(slnRoot)) {
jake.mkdirP(slnRoot);
}

process.chdir(slnRoot);

var cmds = [];

cmds.push(atomicRoot + "Build/Scripts/Windows/GenerateVS2015.bat " + atomicRoot + " " + devBuild + " " + opengl + " " + d3d11);

jake.exec(cmds, function() {

complete();

}, {
printStdout: true
});

});


});// end of build namespace
104 changes: 104 additions & 0 deletions Build/Scripts/CMakeWindows.js
@@ -0,0 +1,104 @@
var fs = require('fs-extra');
var path = require("path");
var host = require("./Host");
var buildTasks = require("./BuildTasks");
var config = require("./BuildConfig");

const nodeSpawn = require('child_process').spawn;

var atomicRoot = config.atomicRoot;
var buildDir = config.artifactsRoot + "Build/Windows/";
var editorAppFolder = config.editorAppFolder

namespace('build', function() {

// converts / to \ and removes trailing slash
function fixpath(path) {
return path.replace(/\//g, "\\").replace(/\\$/, "");
}

// get CMake flags for generator, vsver parameter can be VS2017/VS2015, etc
function getCMakeFlags(vsver) {

// local cmake builds are always dev builds
var flags = "-DATOMIC_DEV_BUILD=1";

// graphics backend (overrides default DX9)
flags += " -DATOMIC_OPENGL=" + (config["opengl"] ? "ON" : "OFF");
flags += " -DATOMIC_D3D11=" + (config["d3d11"] ? "ON" : "OFF");

return flags;

}

// spawn cmake process
function spawnCMake(vsver) {

host.cleanCreateDir(atomicRoot + "/Artifacts/Build/Source/Generated");

var slnRoot = fixpath(path.resolve(atomicRoot, "") + "-" + vsver);

// we're running cmd.exe, this exits the shell when the command have finished
var args = ["/C"];

// Windows batch file which runs cmake
args.push(fixpath(atomicRoot + "\\Build\\Scripts\\Windows\\GenerateVSSolution.bat"));

// vsver VS2015/VS2017
args.push(vsver);

// Atomic root source dir
args.push(fixpath(atomicRoot));

// Folder to put generated solution in
args.push(fixpath(slnRoot));

// CMake flags
args.push(getCMakeFlags(vsver));

// we're using nodeSpawn here instead of jake.exec as the later was having much trouble with quotes
var cmakeProcess = nodeSpawn("cmd.exe", args);

cmakeProcess.stdout.on('data', (data) => {
process.stdout.write(data.toString());
});

cmakeProcess.stderr.on('data', (data) => {
process.stdout.write(data.toString());
});

cmakeProcess.on('exit', (code) => {

if (code != 0) {
fail(`CMake process exited with code ${code}`);
}

console.log("\n\n" + vsver + " solution created in " + fixpath(slnRoot) + "\n\n");

complete();

});

}

task('genvs2017', {
async: true
}, function() {

spawnCMake("VS2017");

}, {
printStdout: true,
printStderr: true
});

// Generate a Visual Studio 2015 solution
task('genvs2015', {
async: true
}, function() {

spawnCMake("VS2015");

});

});// end of build namespace
1 change: 1 addition & 0 deletions Build/Scripts/Host.js
Expand Up @@ -3,6 +3,7 @@ var os = require('os');
if (os.platform() == "win32") {
module.exports = require("./HostWindows");
require("./BuildWindows");
require("./CMakeWindows");
} else if (os.platform() == "darwin") {
module.exports = require("./HostMac");
require("./BuildMac");
Expand Down
3 changes: 0 additions & 3 deletions Build/Scripts/Windows/CompileAtomicEditor.bat

This file was deleted.

17 changes: 15 additions & 2 deletions Build/Scripts/Windows/CompileAtomicEditorPhase1.bat
@@ -1,4 +1,17 @@
call "%VS140COMNTOOLS%..\..\VC\bin\amd64\vcvars64.bat"
cmake ..\\..\\..\\ -DATOMIC_DEV_BUILD=0 -G "Visual Studio 14 2015 Win64"
@echo OFF

call %0\..\SetupVSEnvironment.bat %2

if not defined ATOMIC_CMAKE_GENERATOR (
@echo Problem setting up %2 compilation environment
exit /b 1
)

set ATOMIC_CMAKE_FLAGS=%3
set ATOMIC_CMAKE_FLAGS=%ATOMIC_CMAKE_FLAGS:\=%
set ATOMIC_CMAKE_FLAGS=%ATOMIC_CMAKE_FLAGS:"=%

%ATOMIC_CMAKE% %0\..\..\..\..\ %ATOMIC_CMAKE_FLAGS% -G %ATOMIC_CMAKE_GENERATOR%

:: Note, we're building LibCpuId as it uses masm as getting XamlFactory load errors if delayed
msbuild /m Atomic.sln /t:LibCpuId /t:AtomicNETNative /p:Configuration=%1 /p:Platform=x64
10 changes: 9 additions & 1 deletion Build/Scripts/Windows/CompileAtomicEditorPhase2.bat
@@ -1,2 +1,10 @@
call "%VS140COMNTOOLS%..\..\VC\bin\amd64\vcvars64.bat"
@echo OFF

call %0\..\SetupVSEnvironment.bat %2

if not defined ATOMIC_CMAKE_GENERATOR (
@echo Problem setting up %2 compilation environment
exit /b 1
)

msbuild /m Atomic.sln /t:AtomicEditor /t:AtomicPlayer /p:Configuration=%1 /p:Platform=x64
3 changes: 0 additions & 3 deletions Build/Scripts/Windows/GenerateVS2015.bat

This file was deleted.

17 changes: 17 additions & 0 deletions Build/Scripts/Windows/GenerateVSSolution.bat
@@ -0,0 +1,17 @@
@echo OFF

call %0\..\SetupVSEnvironment.bat %1

if not defined ATOMIC_CMAKE_GENERATOR (
@echo Problem setting up %1 compilation environment
exit
)

@echo OFF

set ATOMIC_ROOT=%~2
set ATOMIC_SOLUTION_PATH=%~3
set ATOMIC_CMAKE_FLAGS="%4"

%ATOMIC_CMAKE% -E make_directory "%ATOMIC_SOLUTION_PATH%"
%ATOMIC_CMAKE% -E chdir "%ATOMIC_SOLUTION_PATH%" %ATOMIC_CMAKE% "%ATOMIC_ROOT%" %ATOMIC_CMAKE_FLAGS% -G %ATOMIC_CMAKE_GENERATOR%
30 changes: 30 additions & 0 deletions Build/Scripts/Windows/SetupVSEnvironment.bat
@@ -0,0 +1,30 @@
@echo OFF

:: locate VS2017, this is done first as inside the conditional was having problems
FOR /F "usebackq tokens=2,* skip=2" %%L IN (
`reg query ""HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7"" /v 15.0 2^> nul`
) DO (SET ATOMIC_VS2017PATH=%%M)

if "%1"=="VS2017" (

if defined ATOMIC_VS2017PATH (

set ATOMIC_CMAKE="%ATOMIC_VS2017PATH%\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
set ATOMIC_CMAKE_GENERATOR="Visual Studio 15 2017 Win64"

call "%ATOMIC_VS2017PATH%\Common7\Tools\VsDevCmd.bat"

)

) else (

if defined VS140COMNTOOLS (

set ATOMIC_CMAKE=cmake
set ATOMIC_CMAKE_GENERATOR="Visual Studio 14 2015 Win64"

call "%VS140COMNTOOLS%..\..\VC\bin\amd64\vcvars64.bat"

)

)
6 changes: 0 additions & 6 deletions CMakeLists.txt
Expand Up @@ -22,12 +22,6 @@ if (ATOMIC_DEV_BUILD)
add_definitions("-DATOMIC_DEV_BUILD=1")
endif()

# Disable until https://github.com/AtomicGameEngine/AtomicGameEngine/issues/554 is addressed
# add_definitions("-DATOMIC_SOURCE_BUILD=1")

# this is here as QtCreator is having trouble picking up #include <Atomic/*> without it
include_directories(${ATOMIC_SOURCE_DIR}/Source ${ATOMIC_SOURCE_DIR}/Source/AtomicEditor/Source)

add_link_libraries_exported (Atomic Box2D Duktape TurboBadger FreeType JO LZ4 PugiXml STB SDL)

if (NOT ATOMIC_BUILD_2D)
Expand Down

0 comments on commit a28af18

Please sign in to comment.