瀏覽代碼

Updating the build system

BearishSun 8 年之前
父節點
當前提交
5be6731a08
共有 7 個文件被更改,包括 79 次插入96 次删除
  1. 44 44
      Documentation/GitHub/compiling.md
  2. 1 1
      Documentation/GitHub/install.md
  3. 二進制
      Scripts/tools/7z/7za.exe
  4. 二進制
      Scripts/tools/curl/curl.exe
  5. 27 1
      Source/CMake/Common.cmake
  6. 7 4
      Source/CMakeLists.txt
  7. 0 46
      setup.bat

+ 44 - 44
Documentation/GitHub/compiling.md

@@ -1,62 +1,62 @@
 # Compiling
 
-Banshee is available on two branches:
- - **preview** - This branch always contains latest "stable" pre-release version. This might be a few months behind master.
- - **master** - This branch contains the latest changes, might be quite unstable and might not even compile. Use this if you absolutely need the bleeding edge changes.
- 
-Banshee can be compiled in two modes:
- - **Runtime** (default) - This will compile the entire engine, scripting system and the editor. This is intended for those that plan on using the editor as their main environment for development.
- - **Framework** - This will compile only the C++ engine framework without the editor or the scripting API. This is intended for those that prefer to develop more directly with less high level abstractions.
- 
-Supported platforms:
- - Windows
- - (Mac & Linux coming soon)
+## Quick start
+Use the commands below to get Banshee up and running as quickly as possible. Scroll further below for advanced build options that allow for more customization.
 
-Supported compilers:
- - MSVC++ 14.0 (Visual Studio 2015)
- - (Clang/GCC coming soon)
- 
-Below we provide two sets of compile intructions depending on what you need:
- - Simple: Straightforward setup for those that don't need to perform any special configuration on Banshee's build and just want to compile with default settings
- - Advanced: Slightly more complicated setup, but allows you to configure exactly how to build Banshee and with which tools 
- 
-## Compile steps (Simple)
+**Windows (Visual Studio 2015)**
 
-### Windows
+Make sure you have installed *git* and *CMake* (version 3.7.2 or newer). Make sure paths to their binaries are in your *PATH* enviroment variable.
 
-To create a Visual Studio 2015 solution with the complete runtime, follow these steps:
- 1. Download source code
- 2. Run setup.bat in the source code root folder
- 3. Access Visual Studio solution in /Build/VS2015/Banshee.sln
- 4. If compilation fails with errors related to DirectX, you need to install relevant DirectX dependencies as described [here](#otherDeps) 
+Run the following commands and the *.sln* will be placed in the */Build* folder:
+```
+git clone https://github.com/BearishSun/BansheeEngine.git
+cd BansheeEngine
+mkdir Build
+cd Build
+cmake -G "Visual Studio 14 2015 Win64" ../Source
+```
 
-## Compile steps (Advanced)
+>Note: If compilation fails with errors related to DirectX, you need to install relevant DirectX dependencies as described [here](#otherDeps).
 
-### Windows
+**Linux**
 
-For those that wish to customize their build, or compile using something other than Visual Studio, follow the steps below:
- 1. Download source code
- 2. Set up [third party dependencies](#dependencies)
- 3. Generate build files using CMake:
-  1. Install CMake 3.6.1 or higher for Windows
-  2. Run CMake GUI
-  3. Point CMake to the /Source sub-folder in Banshee's source code (Browse Source... button in GUI)
-  4. Choose an output folder (Browse Build... button in GUI)
-  5. Hit Configure and choose the toolset to generate the files for (e.g. Visual Studio 2015 64-bit)
-  6. (Optionally) Customize your build by setting any of the properties that have appeared. You can choose whether to build the complete runtime or just the framework, as well as choose render API (Vulkan, DirectX, OpenGL), audio module (FMOD, OpenAudio) among other options.
-  7. Hit the Generate button
- 4. Once CMake is done generating you can use the toolset you chose (e.g. Visual Studio) to open the generated files (e.g. open the .sln file provided in the Build folder in the case of Visual Studio)
+*Coming soon*
 
-### <a name="dependencies"></a>Third party dependencies
-Banshee relies on a variety of third party dependencies. We provide a set of pre-compiled dependencies needed for the latest version of Banshee using Visual Studio 2015, to save you the hassle of compiling them yourself. If you are not using VS2015 or want to compile the dependencies yourself for some other reason, a guide is provided below.
+**OS X**
+
+*Coming soon*
 
- * [Download dependencies (VS2015)](http://bearishsun.thalassa.feralhosting.com/BansheeDependencies_VS2015_Master.zip)
+## Customizing the build
+
+By default the process above will fetch the *master* branch. If required switch to a different branch before building:
+ - **preview** - This branch always contains latest "stable" pre-release version. This might be a few months behind master.
+ - **master** - This branch contains the latest changes, might be quite unstable and might not even compile. Use this if you absolutely need the bleeding edge changes.
+ 
+Variety of *CMake* variables are provided that allow you to customize the build:
+ 
+- By default the process above will build the complete Banshee 3D runtime. You can pick between two modes using the *BUILD_SCOPE* variable in *CMake*:
+  - **Runtime** (default) - This will compile the entire engine, scripting system and the editor. This is intended for those that plan on using the editor as their main environment for development.
+  - **Framework** - This will compile only the C++ engine framework without the editor or the scripting API. This is intended for those that prefer to develop more directly with less high level abstractions.
+- Additional variables allow you to pick between the render API (Vulkan, DirectX, OpenGL), audio module (FMOD, OpenAudio) among other options. Run *CMake* to see all options.
+- Note that non-default *CMake* options might require additional dependencies to be installed, see [here](#otherDeps).
+ 
+You can choose to use a different *CMake* generator than those specified above, as long as the platform/compiler is supported:  
+  - Supported platforms:
+    - Windows
+    - (Mac & Linux coming soon)
+  - Supported compilers:
+    - MSVC++ 14.0 (Visual Studio 2015)
+    - (Clang/GCC coming soon)
+ 
+### <a name="dependencies"></a>Third party dependencies
+Banshee relies on a variety of third party dependencies. A set of pre-compiled dependencies are provided for every supported platform/compiler. These will be fetched automatically by the build process, but you may also download them manually or compile them from source:
+ * [Download dependencies (VS2015)](http://data.banshee3d.com/BansheeDependencies_VS2015_Master.zip)
  * [Compiling dependencies manually](dependencies.md)
  
 For older versions of pre-compiled dependencies check the git release tag descriptions for links.
 
 ## <a name="otherDeps"></a>Other dependencies
-The following dependencies will need to be installed manually regardless if you used pre-compiled dependency package or have compiled them yourself.
+The following dependencies will need to be installed manually. Which ones are required depend on the selected *CMake* options and your usage of Banshee (check text of each entry below).
 
 **DirectX SDK** (Optional if not using DirectX)
  - Only needed if on Windows 7 or earlier and using DirectX 11 render API

+ 1 - 1
Documentation/GitHub/install.md

@@ -6,7 +6,7 @@ Before running the editor make sure to install VS2015 redistributables:
  - https://www.microsoft.com/en-us/download/details.aspx?id=48145
 
 Latest version:
- - [Editor v0.4.0 (Windows x64)](http://bearishsun.thalassa.feralhosting.com/Banshee_Win_x64_v0.4.0.zip)
+ - [Editor v0.4.0 (Windows x64)](http://data.banshee3d.com/Banshee_Win_x64_v0.4.0.zip)
  
 Older versions:
  - Check git release tags for links

二進制
Scripts/tools/7z/7za.exe


二進制
Scripts/tools/curl/curl.exe


+ 27 - 1
Source/CMake/Common.cmake

@@ -58,4 +58,30 @@ MACRO(find_imported_library FOLDER_NAME LIB_NAME)
 	endif()
 
 	mark_as_advanced(${LIB_NAME}_LIBRARY_RELEASE ${LIB_NAME}_LIBRARY_DEBUG)
-ENDMACRO()
+ENDMACRO()
+
+function(update_binary_deps)
+	# Clean and create a temporary folder
+	execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/../Temp)	
+	execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/../Temp)	
+	
+	set(BINARY_DEPENDENCIES_URL https://www.dropbox.com/s/bmvqpimzeicb87i/BansheeDependencies_VS2015_Master.zip?dl=1)
+	file(DOWNLOAD ${BINARY_DEPENDENCIES_URL} ${PROJECT_SOURCE_DIR}/../Temp/Dependencies.zip SHOW_PROGRESS)
+	
+	message(STATUS "Exacting files. Please wait...")
+	execute_process(
+		COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/../Temp/Dependencies.zip
+		WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../Temp
+	)
+	
+	# Copy executables and dynamic libraries
+	execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/../bin)	
+	execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/../Temp/Built/bin ${PROJECT_SOURCE_DIR}/../bin)	
+	
+	# Copy static libraries, headers and tools
+	execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/../Dependencies)	
+	execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/../Temp/Built/Dependencies ${PROJECT_SOURCE_DIR}/../Dependencies)
+	
+	# Clean up
+	execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/../Temp)	
+endfunction()

+ 7 - 4
Source/CMakeLists.txt

@@ -61,15 +61,19 @@ endif()
 
 mark_as_advanced(CMAKE_INSTALL_PREFIX)
 
+include(CMake/Common.cmake)
+
 # Ensure dependencies are up to date
-## Check prebuilt dependencies that user downloads in a .zip
+## Check prebuilt dependencies that are downloaded in a .zip
 set(BUILTIN_DEP_VERSION_FILE ${PROJECT_SOURCE_DIR}/../Dependencies/.version)
 if(NOT EXISTS ${BUILTIN_DEP_VERSION_FILE})
-	message(FATAL_ERROR "Precompiled dependencies package is missing our out of date. Re-run setup or manually download the latest dependencies package.")
+	message(STATUS "Binary dependencies are missing. Downloading package...")
+	update_binary_deps()	
 else()
 	file (STRINGS ${BUILTIN_DEP_VERSION_FILE} CURRENT_BUILTIN_DEP_VERSION)
 	if(${BS_PREBUILT_DEPENDENCIES_VERSION} GREATER ${CURRENT_BUILTIN_DEP_VERSION})
-		message(FATAL_ERROR "Your precomiled dependencies package is out of date. Re-run setup or manually download the latest dependencies package.")
+		message(STATUS "Your precomiled dependencies package is out of date. Downloading latest package...")
+		update_binary_deps()
 	endif()
 endif()
 	
@@ -188,7 +192,6 @@ else()
 	set(BS_LIBRARY_EXTENSION ".a")
 endif()
 
-include(CMake/Common.cmake)
 include(CMake/FindPackageOrBuild.cmake)
 
 set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)

+ 0 - 46
setup.bat

@@ -1,46 +0,0 @@
-@ECHO OFF
-echo.
-echo.
-echo --------------------------------------------------------------------------------
-echo --------------------Downloading dependencies, please wait...--------------------
-echo --------------------------------------------------------------------------------
-IF EXIST Temp rmdir Temp /S /Q
-
-mkdir Temp
-cd Temp
-"../Scripts/tools/curl/curl" http://bearishsun.thalassa.feralhosting.com/BansheeDependencies_VS2015_Master.zip -o Dependencies.zip
-
-echo.
-echo.
-echo --------------------------------------------------------------------------------
-echo -----------------------Download successful! Extracting...-----------------------
-echo --------------------------------------------------------------------------------
-"../Scripts/tools/7z/7za" x Dependencies.zip
-
-IF EXIST "../bin" rmdir "../bin" /S /Q
-move /Y Built/bin ../
-
-IF EXIST "../Dependencies" rmdir "../Dependencies" /S /Q
-move /Y Built/Dependencies ../
-
-cd ..
-rmdir Temp /S /Q
-
-echo.
-echo.
-echo --------------------------------------------------------------------------------
-echo -----------------Extraction done! Generating Visual Studio solution...----------
-echo --------------------------------------------------------------------------------
-IF NOT EXIST Build mkdir Build
-cd Build
-IF NOT EXIST VS2015 mkdir VS2015
-cd VS2015
-
-"../../Dependencies/tools/cmake/bin/cmake" -G "Visual Studio 14 2015 Win64" ../../Source
-cd ../..
-
-echo.
-echo.
-echo All done! Visual Studio solution provided at %cd%/Build/VS2015/Banshee.sln
-
-pause