瀏覽代碼

Build: Added an install step and CI

BearishSun 6 年之前
父節點
當前提交
afbe26d3ba

+ 2 - 1
.gitignore

@@ -30,4 +30,5 @@ Documentation/html
 *.opendb
 Source/Experimental
 .vs/*
-Source/EditorManaged/MBansheeEditor.csproj
+Source/EditorManaged/MBansheeEditor.csproj
+bsfImportToolBuild

+ 17 - 1
CMakeLists.txt

@@ -6,6 +6,12 @@ set (BSF_SOURCE_DIR ${BSF_DIRECTORY}/Source)
 set (APP_ROOT_DIR ${PROJECT_SOURCE_DIR})
 set (BS_IS_BANSHEE3D 1)
 
+# Version
+set (BS_B3D_VERSION_MAJOR 0)
+set (BS_B3D_VERSION_MINOR 5)
+set (BS_B3D_VERSION_PATCH 0) 
+set (BS_B3D_CURRENT_RELEASE_YEAR 2019)
+
 # Grab BSF
 find_path(SUBMODULE_SOURCES "Source/Foundation/bsfEngine/BsApplication.h" "Source/bsf/")
 if(NOT SUBMODULE_SOURCES)
@@ -65,4 +71,14 @@ add_dependencies(Game MBansheeEngine)
 
 if(MSVC)
 	set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Banshee3D)
-endif()
+endif()
+
+## Install
+install(
+	DIRECTORY Data/
+	DESTINATION bin/EditorData
+	PATTERN "Data/Raw" EXCLUDE
+	PATTERN ".version" EXCLUDE
+	PATTERN ".reqversion" EXCLUDE
+	PATTERN "Settings.asset" EXCLUDE
+)

+ 0 - 28
Scripts/build_editor_win_x64.py

@@ -1,28 +0,0 @@
-#!/usr/bin/python
-
-# Builds and packages the editor. Make sure you have MSBuild
-# installed and the path is valid.
-
-# Usage: "build_editor_win_x64 $Configuration"
-# Where: $Configuration - e.g. OptimizedDebug, Release
-
-import os
-
-msbuildPath = "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\amd64"
-configuration = 'Release' #sys.argv[1]
-buildPath = "..\\build\\"
-solutionPath = buildPath + "Banshee.sln"
-
-if not os.path.exists(msbuildPath):
-    print("MSBuild path is not valid. Used path {0}: ".format(msbuildPath))
-    exit;
-
-os.environ["PATH"] += os.pathsep + msbuildPath
-
-# Build the engine
-os.system("msbuild {0} /p:Configuration={1};Platform=x64 /m".format(solutionPath, configuration))
-
-# Build Win32 game executable
-os.system("msbuild {0} /p:Configuration={1};Platform=x64 /m".format(solutionPath, configuration))
-
-os.system("package_editor.py " + configuration)

+ 0 - 72
Scripts/package_editor.py

@@ -1,72 +0,0 @@
-#!/usr/bin/python
-
-# Packages the editor by copying all relevant files to the Builds directory.
-# This will not execute the editor build, and is implied the editor has been
-# been built before executing this script.
-
-# Usage: "package_editor $Configuration"
-# Where: $Configuration - e.g. Debug, OptimizedDebug, Release
-
-import os
-import sys
-import shutil
-
-configuration = 'Release' #sys.argv[1]
-dataEntriesToIgnore = ['Raw', 'Settings.asset']
-binEntriesToIgnore = ['Game.exe', 'Game.pdb']
-
-dataFolder = 'Data'
-bsfDataFolder = 'Source\\bsf\\Data'
-assembliesFolder = 'Assemblies'
-monoFolder = 'Mono'
-libFolder = 'x64\\' + configuration + '\\'
-
-inputDataFolder = '..\\' + dataFolder
-inputBsfDataFolder = '..\\' + bsfDataFolder
-inputBinFolder = '..\\build\\bin\\'
-inputAssembliesFolder = inputBinFolder + assembliesFolder
-inputMonoFolder = inputBinFolder + monoFolder
-inputLibFolder = inputBinFolder + libFolder
-
-outputBaseFolder = '..\\Builds\Banshee3D\\'
-outputEditorDataFolder = outputBaseFolder + 'EditorData'
-outputDataFolder = outputBaseFolder + dataFolder
-outputBinFolder = outputBaseFolder + '\\bin\\'
-outputAssembliesFolder = outputBinFolder + assembliesFolder
-outputMonoFolder = outputBinFolder + monoFolder
-outputLibFolder = outputBaseFolder
-
-def copytree(src, dst):
-    if not os.path.exists(dst):
-        os.makedirs(dst)
-    
-    for item in os.listdir(src):
-        if item in dataEntriesToIgnore:
-            print("Ignoring " + item)
-            continue
-        
-        s = os.path.join(src, item)
-        d = os.path.join(dst, item)
-        print(s)
-        if os.path.isdir(s):
-            copytree(s, d)
-        else:
-            shutil.copy2(s, d)	
-	
-def package_editor():
-    if os.path.exists(outputBaseFolder):
-        shutil.rmtree(outputBaseFolder)
-
-    copytree(inputDataFolder, outputEditorDataFolder)
-    copytree(inputBsfDataFolder, outputDataFolder)
-    copytree(inputAssembliesFolder, outputAssembliesFolder)
-    copytree(inputMonoFolder, outputMonoFolder)
-
-    for root, dirs, files in os.walk(inputLibFolder):
-        for file in files:
-            if(file.lower().endswith(('.dll', '.exe', '.pdb', '.so', '.dylib'))):
-                if(not file in binEntriesToIgnore):
-                    filePath = os.path.join(root, file)
-                    shutil.copy(filePath, outputLibFolder)
-
-package_editor()

+ 4 - 1
Source/Banshee3D/CMakeLists.txt

@@ -35,4 +35,7 @@ install_dll_on_build(Banshee3D ${BSF_DIRECTORY})
 
 # Make sure 'mono' dlls and other files are copied to our folders
 install_dll_on_build(Banshee3D ${BSF_SOURCE_DIR}/../Dependencies/mono)
-copy_folder_on_build(Banshee3D ${BSF_SOURCE_DIR}/../Dependencies/mono ${PROJECT_BINARY_DIR} bin/Mono "*.*")
+copy_folder_on_build(Banshee3D ${BSF_SOURCE_DIR}/../Dependencies/mono ${PROJECT_BINARY_DIR} bin/Mono "*.*")
+
+# Install
+install_bsf_target(Banshee3D)

+ 4 - 1
Source/EditorCore/CMakeLists.txt

@@ -35,4 +35,7 @@ elseif(APPLE) # MacOS
 endif()
 
 # IDE specific
-set_property(TARGET EditorCore PROPERTY FOLDER Foundation)
+set_property(TARGET EditorCore PROPERTY FOLDER Foundation)
+
+# Install
+install_bsf_target(EditorCore)

+ 2 - 0
Source/EditorManaged/CMakeLists.txt

@@ -6,6 +6,8 @@ set(BS_CS_PROJ "MBansheeEditor.csproj")
 
 if(MSVC)
 	include_external_msproject(MBansheeEditor ${CMAKE_CURRENT_SOURCE_DIR}/${BS_CS_PROJ})
+	
+	add_dependencies(MBansheeEditor MBansheeEngine)
 	set_property(TARGET MBansheeEditor PROPERTY FOLDER Script)
 else()
 	find_package(mcs)

+ 1 - 1
Source/EditorManaged/MBansheeEditor.csproj.in

@@ -38,7 +38,7 @@
 ${BS_SHARP_FILE_LIST}
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\bsf\Source\Plugins\bsfSharp\MBansheeEngine.csproj">
+    <ProjectReference Include="..\bsf\Source\Scripting\bsfSharp\MBansheeEngine.csproj">
       <Project>{876EB338-489E-4727-84DA-8CBBF0DA5B5E}</Project>
       <Name>MBansheeEngine</Name>
     </ProjectReference>

+ 21 - 0
Source/Game/CMakeLists.txt

@@ -64,3 +64,24 @@ add_engine_dependencies(Game)
 if(MSVC)
 	target_compile_options(Game PUBLIC /wd4509)
 endif()
+
+# Install
+set(PLATFORM_PATH_PREFIX "")
+if(WIN32)
+	set(PLATFORM_PATH_PREFIX "Win")
+elseif(LINUX)
+	set(PLATFORM_PATH_PREFIX "Linux")
+elseif(APPLE)
+	set(PLATFORM_PATH_PREFIX "macOS")
+else()
+	message(FATAL "Unsupported platform.")
+endif()
+
+if(BS_64BIT)
+	set(PLATFORM_PATH_PREFIX "${PLATFORM_PATH_PREFIX}64")
+endif()
+	
+install(
+	TARGETS Game
+	RUNTIME DESTINATION bin/EditorData/Binaries/${PLATFORM_PATH_PREFIX}
+)

+ 1 - 1
Source/Game/Main.cpp

@@ -156,7 +156,7 @@ void runApplication()
 		if (mainScene.isLoaded(false))
 		{
 			HSceneObject root = mainScene->instantiate();
-			HSceneObject oldRoot = gSceneManager().getRootNode();
+			HSceneObject oldRoot = gSceneManager().getMainScene()->getRoot();
 
 			gSceneManager().setRootNode(root);
 			oldRoot->destroy();

+ 1 - 1
Source/bsf

@@ -1 +1 @@
-Subproject commit 50b2c145fcdacf1c529ee2767c4b794397c787ee
+Subproject commit c4042b283e325f86f01951ecfb01068e56e502f9

+ 67 - 0
appveyor.yml

@@ -0,0 +1,67 @@
+image: Visual Studio 2017
+platform: x64
+configuration: Release
+clone_folder: C:\Projects\Banshee3D
+
+build_script:
+  # Setup and CMake configure
+  - cmd: set INSTALL_DIR=C:/Projects/bsf/install
+  - cmd: mkdir "%INSTALL_DIR%"
+  - cmd: mkdir Build
+  - cmd: cd Build
+  - cmd: cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX:STRING=%INSTALL_DIR% ..
+  - cmd: cd ..  
+  # Build and install
+  - cmd: cd Build
+  - cmd: cmake --build ./ --config Debug --target MBansheeEditor
+  - cmd: cmake --build ./ --config Release
+  - cmd: cmake --build ./ --config Release --target INSTALL
+
+after_build:
+ - ps: cd ..
+ - ps: mkdir packaged
+ - ps: cd packaged
+ - ps: Move-Item -Path ../install/bin/* -Destination ./
+ - ps: cd ..
+ - ps: >-
+      if($env:APPVEYOR_REPO_TAG -eq "true") 
+      { $buildName = $env:APPVEYOR_REPO_TAG_NAME } 
+      else 
+      { $buildName = "$(Get-Date -format yyyy.MM.dd)" }
+ - ps: Set-AppveyorBuildVariable "B3D_BUILD_NAME" "$buildName"
+ - cmd: 7z a b3d_%B3D_BUILD_NAME%_win64.zip ./packaged/* -xr!*pdb
+ - cmd: 7z a b3d_%B3D_BUILD_NAME%_win64_symbols.zip ./packaged/*pdb -r
+
+artifacts:
+  - path: b3d_%B3D_BUILD_NAME%_win64.zip
+    name: b3dBinaries
+    type: zip
+  - path: b3d_%B3D_BUILD_NAME%_win64_symbols.zip
+    name: b3dSymbols
+    type: zip
+
+deploy:
+  - provider: S3
+    access_key_id: 
+      secure: DjX7NEjBDYhAMURrE5ucaP95zFdO32Ep91oLWr++/WM=
+    secret_access_key: 
+      secure: QtDQyveDiuE42QLzLmmaWltDOUgEB9eRzT0GicW4DIeWU+K5szFOkHLpCfL9ukRV
+    bucket: b3d-nightly
+    region: us-east-1
+    folder:
+    artifact: b3dBinaries,b3dSymbols
+    set_public: false
+    on:
+      APPVEYOR_SCHEDULED_BUILD: true
+  - provider: S3
+    access_key_id: 
+      secure: DjX7NEjBDYhAMURrE5ucaP95zFdO32Ep91oLWr++/WM=
+    secret_access_key: 
+      secure: QtDQyveDiuE42QLzLmmaWltDOUgEB9eRzT0GicW4DIeWU+K5szFOkHLpCfL9ukRV
+    bucket: b3d-nightly
+    region: us-east-1
+    folder:
+    artifact: b3dBinaries,b3dSymbols
+    set_public: false
+    on:
+      APPVEYOR_REPO_TAG: true