Преглед на файлове

Refactor to rename 'native' DBE to 'linux'.

Yao Wei Tjong 姚伟忠 преди 5 години
родител
ревизия
bb73a41d0e
променени са 5 файла, в които са добавени 28 реда и са изтрити 17 реда
  1. 2 2
      .github/workflows/ci_cd.rake
  2. 7 7
      .github/workflows/main.yml
  3. 3 3
      Docs/GettingStarted.dox
  4. 15 4
      Rakefile
  5. 1 1
      script/dockerized.sh

+ 2 - 2
.github/workflows/ci_cd.rake

@@ -46,8 +46,8 @@ task :ci do
   when 'DX11'
     ENV['URHO3D_D3D11'] = '1'
   when 'DX9'
-    ENV['URHO3D_OPENGL'] = '0'
-  when 'OGL'
+    ENV['URHO3D_OPENGL'] = '0'  # Need to make this explicit because 'MINGW' default to use OpenGL otherwise
+  when 'OpenGL'
     ENV['URHO3D_OPENGL'] = '1'
   else
     # Do nothing

+ 7 - 7
.github/workflows/main.yml

@@ -36,8 +36,8 @@ jobs:
       fail-fast: false
       matrix:
         platform:
-          - native-gcc
-          - native-clang
+          - linux-gcc
+          - linux-clang
           - mingw
           - rpi
           - arm
@@ -77,8 +77,8 @@ jobs:
       fail-fast: false
       matrix:
         platform:
-          - native-xcode
-          # native-make
+          - macOS-xcode
+          # macOS-make
         lib-type:
           - STATIC
           - SHARED
@@ -106,15 +106,15 @@ jobs:
       fail-fast: false
       matrix:
         platform:
-          - native-msvc
-          - native-gcc
+          - win-msvc
+          - win-gcc
         lib-type:
           - STATIC
           - SHARED
         graphics-api:
           - DX11
           - DX9
-          - OGL
+          - OpenGL
     env:
       HOST: ${{ github.job }}
       PLATFORM: ${{ matrix.platform }}

+ 3 - 3
Docs/GettingStarted.dox

@@ -382,11 +382,11 @@ OpenGL does not depend on a separate shader compiler DLL.
 
 \section Dockerized_Build_Environment Dockerized build environment (EXPERIMENTAL on *nix host only)
 
-The building prerequisites are understandably different for each target platform. If you want to target multiple platforms with a single build/host system then you have to not only install all of the prequisites in your host system, but also have to be able to configure your build environment properly so that they do not interfere with each other. Rather than configuring the build environment manually, we have now provided a new build mechanism that we called "dockerized build environment" which addresses both hurdles above. Currently the dockerized build environment, or DBE for short, supports the following platforms: native (Linux), MinGW (Windows), Android, Raspberry-Pi, generic ARM, and Web.
+The building prerequisites are understandably different for each target platform. If you want to target multiple platforms with a single build/host system then you have to not only install all of the prerequisites in your host system, but also have to be able to configure your build environment properly so that they do not interfere with each other. Rather than configuring the build environment manually, we have now provided a new build mechanism that we called "dockerized build environment" which addresses both hurdles above. Currently the dockerized build environment, or DBE for short, supports the following platforms: Linux, MinGW (Windows), Android, Raspberry-Pi, generic ARM, and Web.
 
 The DBE requires podman (from repository provided by your distro, recommended) or Docker-CE (from https://docs.docker.com/install/) to be installed in the host system and that's all it needs.
 
-To use the DBE, execute script/dockerized.sh in the project root directory, specify the platform name (native|mingw|android|rpi|arm|web) as the mandatory parameter, and optionally followed by an alternative command to be invoked in the docker container. By default the command is to generate a build tree for the specified target platform and then build it. The Urho3D build options can be specified by using environment variables in the host system before executing the dockerized.sh. It could be done just in time as well, e.g. "URHO3D_LIB_TYPE=SHARED script/dockerized.sh mingw". The build artifact from DBE can be found in the usual location as the normal build environment. In fact the build artifacts should function and work as if they are built using conventional way too.
+To use the DBE, execute script/dockerized.sh in the project root directory, specify the platform name (linux|mingw|android|rpi|arm|web) as the mandatory parameter, and optionally followed by an alternative command to be invoked in the docker container. By default the command is to generate a build tree for the specified target platform and then build it. The Urho3D build options can be specified by using environment variables in the host system before executing the dockerized.sh. It could be done just in time as well, e.g. "URHO3D_LIB_TYPE=SHARED script/dockerized.sh mingw". The build artifact from DBE can be found in the usual location as the normal build environment. In fact the build artifacts should function and work as if they are built using conventional way too.
 
 The DBE is designed to be used by Urho3D project and its downstream projects which reuse Urho3D build system.
 
@@ -729,7 +729,7 @@ rake make [<platform>] [<option>=<value> [<option>=<value>]] [[<platform>_]build
 
 The default <generator> when not specified is 'generic', which let CMake to detect and choose what generator is available in the host to use. The possible values are: 'codeblocks', 'eclipse', 'ninja', 'vs2015', 'vs2017', 'vs2019', 'xcode'.
 
-The default <platform> when not specified is 'native'. The possible values are: 'android', 'web', 'ios', 'tvos', 'mingw', 'rpi'. Naturally this influences the compiler toolchain being used in the generated build tree.
+The default <platform> when not specified is the native platform of the build host, 'linux', 'macOS', 'win'. The other possible values are: 'android', 'web', 'ios', 'tvos', 'mingw', 'rpi'. Naturally this influences the compiler toolchain being used in the generated build tree.
 
 When using the 'rake cmake' task, the <option>=\<value> pairs are optional build options supported by our build scripts as usual. However, the format here does not expect a leading '-D' for each pair. When using the 'rake make' task, the <option>=\<value> pairs are optional build options supported by the respective build tools. For example on iOS/tvOS platform using 'xcodebuild' build tool, one could pass the '-sdk' option as follows: 'rake make ios sdk=iphonesimulator'. Note the absence of leading '-' character in the example. To build a specific built-in target in the project, use the 'target' option, e.g. 'rake make target=install'. In a multi-config project, such as Xcode project or VS solution, use the 'config' option to choose which build configuration to use, e.g. 'rake make config=Release'. For Xcode project building using 'rake make' task, you may optional install the 'xcpretty' filter to address the verbosity of the 'xcodebuild' tool from its standard output stream. On the other hand, pass the 'unfilter' option to get the output from 'xcodebuild' tool unfiltered regardless the 'xcpretty' is installed or not. You can pass the 'clean_first' option to perform a clean build. By default this task invokes the respective build tool to use all the logical CPU cores available, but you can use the 'numjobs' option to override this default.
 

+ 15 - 4
Rakefile

@@ -42,7 +42,7 @@ task :cmake do
   end
   next if ENV['PLATFORM'] == 'android' || Dir.exist?("#{build_tree}")
   script = "script/cmake_#{ENV['GENERATOR']}#{ENV['OS'] ? '.bat' : '.sh'}"
-  build_options = ENV['PLATFORM'] == 'native' ? '' : "-D #{ENV['PLATFORM'].upcase}=1"
+  build_options = /linux|macOS|win/ =~ ENV['PLATFORM'] ? '' : "-D #{ENV['PLATFORM'].upcase}=1"
   File.readlines('script/.build-options').each { |var|
     var.chomp!
     build_options = "#{build_options} -D #{var}=#{ENV[var]}" if ENV[var]
@@ -85,7 +85,7 @@ task build: [:cmake] do
         $max_jobs = it.NumberOfLogicalProcessors
       }
     else
-      $max_jobs = 1
+      abort "Unsupported host system: #{build_host}"
     end
     concurrent = "-j#{$max_jobs}"
   end
@@ -107,8 +107,19 @@ def build_host
 end
 
 def build_tree
-  ENV['PLATFORM'] = 'native' unless ENV['PLATFORM']
-  ENV['BUILD_TREE'] || "build/#{ENV['PLATFORM']}"
+  unless ENV['PLATFORM']
+    case build_host
+    when /linux/
+      ENV['PLATFORM'] = 'linux'
+    when /darwin|macOS/
+      ENV['PLATFORM'] = 'macOS'
+    when /win32|mingw|mswin|windows/
+      ENV['PLATFORM'] = 'win'
+    else
+      abort "Unsupported host system: #{build_host}"
+    end
+  end
+  ENV['BUILD_TREE'] || "build/#{ENV['PLATFORM'].downcase}"
 end
 
 

+ 1 - 1
script/dockerized.sh

@@ -21,7 +21,7 @@
 # THE SOFTWARE.
 #
 
-if [[ $# -eq 0 ]]; then echo "Usage: dockerized.sh native|mingw|android|rpi|arm|web [command [params]]"; exit 1; fi
+if [[ $# -eq 0 ]]; then echo "Usage: dockerized.sh linux|mingw|android|rpi|arm|web [command]"; exit 1; fi
 
 PROJECT_DIR=$(cd "${0%/*}/.." || exit 1; pwd)