[Bf-blender-cvs] [1def985d78d] master: Windows: Add icons and icons_geom to make.bat

Ray Molenkamp noreply at git.blender.org
Thu Aug 5 03:32:30 CEST 2021


Commit: 1def985d78db113ea4426311692941e44f0467eb
Author: Ray Molenkamp
Date:   Wed Aug 4 19:32:24 2021 -0600
Branches: master
https://developer.blender.org/rB1def985d78db113ea4426311692941e44f0467eb

Windows: Add icons and icons_geom to make.bat

This adds support for building the icons from make.bat
unlike bash there is no passing environment variables
on the command line.

The scripts go out of their way to locate both blender
and inkscape however if they are not found, the user is
given a helpful error message telling them how to set
the variables.

Although some extra help can be given there, if your
normal build is a 2019 full build running

`make 2019 full icons`

will help it find the blender executable as well.

finally if you know the name of your build folder
running

`make builddir build_windows_Lite_x64_vc16_Release icons`

will also work, if all fails you can point directly to
the blender executable by running

`set BLENDER_BIN=c:\where\blender\lives\blender.exe`

before running `make icons` or `make icons_geom`

The python scripts needed some small modifications since
without the PATHEXT, SystemRoot and SystemDrive
environment variables python will not initialize properly
on windows. (Not blender related, even mainline python
won't start without those)

===================================================================

A	build_files/windows/find_blender.cmd
A	build_files/windows/find_inkscape.cmd
A	build_files/windows/icons.cmd
A	build_files/windows/icons_geom.cmd
M	build_files/windows/parse_arguments.cmd
M	build_files/windows/reset_variables.cmd
M	make.bat
M	release/datafiles/blender_icons_geom_update.py
M	release/datafiles/blender_icons_update.py

===================================================================

diff --git a/build_files/windows/find_blender.cmd b/build_files/windows/find_blender.cmd
new file mode 100644
index 00000000000..9adbfd35ae9
--- /dev/null
+++ b/build_files/windows/find_blender.cmd
@@ -0,0 +1,28 @@
+REM First see if there is an environment variable set
+if EXIST "%BLENDER_BIN%" (
+    goto detect_blender_done
+)
+
+REM Check the build folder next, if ninja was used there will be no
+REM debug/release folder
+set BLENDER_BIN=%BUILD_DIR%\bin\blender.exe
+if EXIST "%BLENDER_BIN%" (
+    goto detect_blender_done
+)
+
+REM Check the release folder next
+set BLENDER_BIN=%BUILD_DIR%\bin\release\blender.exe
+if EXIST "%BLENDER_BIN%" (
+    goto detect_blender_done
+)
+
+REM Check the debug folder next
+set BLENDER_BIN=%BUILD_DIR%\bin\debug\blender.exe
+if EXIST "%BLENDER_BIN%" (
+    goto detect_blender_done
+)
+
+REM at this point, we don't know where blender is, clear the variable
+set BLENDER_BIN=
+
+:detect_blender_done
diff --git a/build_files/windows/find_inkscape.cmd b/build_files/windows/find_inkscape.cmd
new file mode 100644
index 00000000000..2fa27f70d47
--- /dev/null
+++ b/build_files/windows/find_inkscape.cmd
@@ -0,0 +1,21 @@
+REM First see if there is an environment variable set
+if EXIST "%INKSCAPE_BIN%" (
+    goto detect_inkscape_done
+)
+
+REM Then see if inkscape is available in the path
+for %%X in (inkscape.exe) do (set INKSCAPE_BIN=%%~$PATH:X)
+if EXIST "%INKSCAPE_BIN%" (
+    goto detect_inkscape_done
+)
+
+REM Finally see if it is perhaps installed at the default location
+set INKSCAPE_BIN=%ProgramFiles%\Inkscape\bin\inkscape.exe
+if EXIST "%INKSCAPE_BIN%" (
+    goto detect_inkscape_done
+)
+
+REM If still not found clear the variable
+set INKSCAPE_BIN=
+
+:detect_inkscape_done
diff --git a/build_files/windows/icons.cmd b/build_files/windows/icons.cmd
new file mode 100644
index 00000000000..473a40885a8
--- /dev/null
+++ b/build_files/windows/icons.cmd
@@ -0,0 +1,42 @@
+if EXIST %PYTHON% (
+    goto detect_python_done
+)
+
+set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
+if EXIST %PYTHON% (
+    goto detect_python_done
+)
+
+echo python not found at %PYTHON%
+exit /b 1
+
+:detect_python_done
+echo found python (%PYTHON%)
+
+call "%~dp0\find_inkscape.cmd"
+
+if EXIST "%INKSCAPE_BIN%" (
+    goto detect_inkscape_done
+)
+
+echo unable to locate inkscape, run "set inkscape_BIN=full_path_to_inkscape.exe"
+exit /b 1
+
+:detect_inkscape_done
+
+call "%~dp0\find_blender.cmd"
+
+if EXIST "%BLENDER_BIN%" (
+    goto detect_blender_done
+)
+
+echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
+exit /b 1
+
+:detect_blender_done
+
+%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_update.py
+%PYTHON% -B %BLENDER_DIR%\release\datafiles\prvicons_update.py
+%PYTHON% -B %BLENDER_DIR%\release\datafiles\alert_icons_update.py
+
+:EOF
diff --git a/build_files/windows/icons_geom.cmd b/build_files/windows/icons_geom.cmd
new file mode 100644
index 00000000000..18312daf35b
--- /dev/null
+++ b/build_files/windows/icons_geom.cmd
@@ -0,0 +1,29 @@
+if EXIST %PYTHON% (
+    goto detect_python_done
+)
+
+set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
+if EXIST %PYTHON% (
+    goto detect_python_done
+)
+
+echo python not found at %PYTHON%
+exit /b 1
+
+:detect_python_done
+echo found python (%PYTHON%)
+
+call "%~dp0\find_blender.cmd"
+
+if EXIST "%BLENDER_BIN%" (
+    goto detect_blender_done
+)
+
+echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
+exit /b 1
+
+:detect_blender_done
+
+%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_geom_update.py 
+
+:EOF
diff --git a/build_files/windows/parse_arguments.cmd b/build_files/windows/parse_arguments.cmd
index 000b98c992e..c71093f2394 100644
--- a/build_files/windows/parse_arguments.cmd
+++ b/build_files/windows/parse_arguments.cmd
@@ -107,6 +107,12 @@ if NOT "%1" == "" (
 		set FORMAT=1
 		set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9
 		goto EOF
+	) else if "%1" == "icons" (
+		set ICONS=1
+		goto EOF
+	) else if "%1" == "icons_geom" (
+		set ICONS_GEOM=1
+		goto EOF
 	) else (
 		echo Command "%1" unknown, aborting!
 		goto ERR
diff --git a/build_files/windows/reset_variables.cmd b/build_files/windows/reset_variables.cmd
index 262874713eb..590d4ca246a 100644
--- a/build_files/windows/reset_variables.cmd
+++ b/build_files/windows/reset_variables.cmd
@@ -31,3 +31,5 @@ set PYDEBUG_CMAKE_ARGS=
 set FORMAT=
 set TEST=
 set BUILD_WITH_SCCACHE=
+set ICONS=
+set ICONS_GEOM=
\ No newline at end of file
diff --git a/make.bat b/make.bat
index ea80bd591f7..75d424202ae 100644
--- a/make.bat
+++ b/make.bat
@@ -58,6 +58,16 @@ if "%BUILD_UPDATE%" == "1" (
 
 call "%BLENDER_DIR%\build_files\windows\set_build_dir.cmd"
 
+if "%ICONS%" == "1" (
+	call "%BLENDER_DIR%\build_files\windows\icons.cmd"
+	goto EOF
+)
+
+if "%ICONS_GEOM%" == "1" (
+	call "%BLENDER_DIR%\build_files\windows\icons_geom.cmd"
+	goto EOF
+)
+
 echo Building blender with VS%BUILD_VS_YEAR% for %BUILD_ARCH% in %BUILD_DIR%
 
 call "%BLENDER_DIR%\build_files\windows\check_libraries.cmd"
diff --git a/release/datafiles/blender_icons_geom_update.py b/release/datafiles/blender_icons_geom_update.py
index df4683809db..257b7a49285 100755
--- a/release/datafiles/blender_icons_geom_update.py
+++ b/release/datafiles/blender_icons_geom_update.py
@@ -96,6 +96,11 @@ for blend in icons_blend:
     env = {}
     # Developers may have ASAN enabled, avoid non-zero exit codes.
     env["ASAN_OPTIONS"] = "exitcode=0:" + os.environ.get("ASAN_OPTIONS", "")
+    # These NEED to be set on windows for python to initialize properly.
+    if sys.platform[:3] == "win":
+        env["PATHEXT"] = os.environ.get("PATHEXT", "")
+        env["SystemDrive"] = os.environ.get("SystemDrive", "")
+        env["SystemRoot"] = os.environ.get("SystemRoot", "")
 
     run(cmd, env=env)
     files_new = set(names_and_time_from_path(output_dir))
diff --git a/release/datafiles/blender_icons_update.py b/release/datafiles/blender_icons_update.py
index dab3cd76a87..524cc512f29 100755
--- a/release/datafiles/blender_icons_update.py
+++ b/release/datafiles/blender_icons_update.py
@@ -37,6 +37,12 @@ env = {}
 # Developers may have ASAN enabled, avoid non-zero exit codes.
 env["ASAN_OPTIONS"] = "exitcode=0:" + os.environ.get("ASAN_OPTIONS", "")
 
+# These NEED to be set on windows for python to initialize properly.
+if sys.platform[:3] == "win":
+    env["PATHEXT"] = os.environ.get("PATHEXT", "")
+    env["SystemDrive"] = os.environ.get("SystemDrive", "")
+    env["SystemRoot"] = os.environ.get("SystemRoot", "")
+
 inkscape_bin = os.environ.get("INKSCAPE_BIN", "inkscape")
 blender_bin = os.environ.get("BLENDER_BIN", "blender")



More information about the Bf-blender-cvs mailing list