diff --git a/.appveyor.yml b/.appveyor.yml
index be21d1e..b3c3408 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -6,10 +6,20 @@ environment:
VS_LOC: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"'
JOM_LOC: '"C:\Qt\Tools\QtCreator\bin\jom.exe"'
NSIS_LOC: '"C:\Program Files (x86)\NSIS\"'
- ZIP_LOC: 7z
- CLANG_FORMAT_LOC: '"C:\Program Files\LLVM\bin\clang-format.exe"'
- COMPILER: msvc
- VSVER: 14
+ ZIP_LOC: '"C:\Program Files\7-zip\7z.exe"'
+ LLVM_LOC: '"C:\Program Files\LLVM\bin\"'
+ PYTHON_LOC: '"C:\Python37\"'
+ BUILD_PACKAGE: "1"
+
+ - QT_LOC: '"C:\Qt\5.11.2\msvc2017_64\bin\"'
+ VS_LOC: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"'
+ JOM_LOC: '"C:\Qt\Tools\QtCreator\bin\jom.exe"'
+ NSIS_LOC: '"C:\Program Files (x86)\NSIS\"'
+ ZIP_LOC: '"C:\Program Files\7-zip\7z.exe"'
+ LLVM_LOC: '"C:\Program Files\LLVM\bin\"'
+ PYTHON_LOC: '"C:\Python37\"'
+ BUILD_PACKAGE: "1"
+ BUILD_CLANG: '"1"'
clone_depth: 1
@@ -18,11 +28,11 @@ init:
- set TAG_NAME=%APPVEYOR_REPO_TAG_NAME%
build_script:
- - python ./build_scripts/run-clang-format.py ./src -r --clang-format-executable %CLANG_FORMAT_LOC% --color always
+ - python ./build_scripts/run-clang-format.py ./src -r --clang-format-executable "C:\Program Files\LLVM\bin\clang-format.exe" --color always
- call "build_windows.cmd"
artifacts:
- - path: bin\win64\AdvancedSettings.zip
+ - path: bin\win64\AdvancedSettings*.7z
name: portable
- - path: installer\AdvancedSettings-Installer.exe
+ - path: installer\AdvancedSettings*.exe
name: installer
diff --git a/.gitignore b/.gitignore
index 8cf1675..a8a664c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ Makefile*
*.stash
*.appxmanifest
*.user
-installer/AdvancedSettings-Installer.exe
+installer/*.exe
*.user*
-
+build_scripts/win/__pycache__
+build_scripts/win/current_build.bat
\ No newline at end of file
diff --git a/advancedSettings.pro b/advancedSettings.pro
index b44dec1..17c0b17 100644
--- a/advancedSettings.pro
+++ b/advancedSettings.pro
@@ -22,8 +22,13 @@ TEMPLATE = app
QMAKE_CXXFLAGS_WARN_ON -= -W3
#C4127 was in a third party file with no way to turn off.
QMAKE_CXXFLAGS += /W4 /wd4127
- QMAKE_CXXFLAGS += /WX
-
+ !*clang-msvc {
+ #win32-clang-msvc is unable to correctly build the first time
+ #with warnings as errors on. There seems to be an issue with the moc_predefs.h
+ #file not being built correctly when /WX is on. Until the issue is fixed,
+ #win32-clang-msvc is built without /WX.
+ QMAKE_CXXFLAGS += /WX
+ }
}
*g++* {
diff --git a/build_scripts/win/build.cmd b/build_scripts/win/build.cmd
index 1118d41..0f6a908 100644
--- a/build_scripts/win/build.cmd
+++ b/build_scripts/win/build.cmd
@@ -1,115 +1,8 @@
-@echo off
-REM Echo off to avoid spam.
-
-REM Non zero is failure, 0 is success.
-SET exit_code_success=0
-SET exit_code_failure_build_apps=1
-SET exit_code_failure_build_locations=2
-
-REM Used for echos.
-SET current_activity=BUILD
-
-REM If scripts are chain called the original dirs should not be overwritten.
-IF NOT DEFINED original_dir (
- SET original_dir=%CD%
-)
-IF NOT DEFINED project_dir (
- REM Arg 0 (called %0) is the full path to the file.
- REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters
- REM As per above link, %~dp0 expands the zeroth arg to a drive letter and path only.
- REM Project dir is up two dirs from the file.
- SET project_dir=%~dp0\..\..\
-)
-
-REM Change dir to the project dir, otherwise qmake doesn't know where it is.
-CD %project_dir%
-
-REM QT_LOC is a directory, it can't be in the path, no reason to check using WHERE.
-ECHO %current_activity%: Testing if all required build environment values are set:
-IF NOT DEFINED QT_LOC (
- ECHO %current_activity%: QT_LOC not defined. Using default value.
- SET QT_LOC="C:\Qt\5.11.1\msvc2017_64\bin\"
-)
-ECHO %current_activity%: QT_LOC set to '%QT_LOC%'.
-IF EXIST %QT_LOC% (
- ECHO %current_activity%: QT_LOC exists.
-) ELSE (
- ECHO %current_activity%: QT_LOC directory does not exist. Exiting.
- EXIT /B %exit_code_failure_build_locations%
-)
-
-IF NOT DEFINED VS_LOC (
- ECHO %current_activity%: VS_LOC not defined. Using default value.
- SET VS_LOC="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
-)
-ECHO %current_activity%: VS_LOC set to '%VS_LOC%'.
-
-REM EXIST won't find items in the PATH. WHERE will.
-SET VS_VALID=0
-IF EXIST %VS_LOC% SET VS_VALID=1
-REM Prevents error message spam if it doesn't find it in PATH.
-IF NOT %VS_VALID% EQU 1 (
- WHERE /Q %VS_LOC%
- IF NOT ERRORLEVEL 1 SET VS_VALID=1
-)
-
-IF %VS_VALID% EQU 1 (
- ECHO %current_activity%: VS_LOC exists.
-) ELSE (
- ECHO %current_activity%: VS_LOC directory does not exist. Exiting.
- EXIT /B %exit_code_failure_build_locations%
-)
-
-ECHO %current_activity%: All required build environment values are set.
-
-IF DEFINED BUILD_DEBUG (
- ECHO %current_activity%: BUILD_DEBUG var set. Compiling for debug.
- SET compile_level=debug
-) ELSE (
- ECHO %current_activity%: BUILD_DEBUG var not set. Compiling for release.
- SET compile_level=release
-)
-
-ECHO %current_activity%: Setting up environment with Visual Studio 'vcvarsall.bat'.
-REM Currently only this platform is supported.
-SET target_platform=AMD64
-REM Set up environment for qmake.
-CALL %VS_LOC% %target_platform%
-
-IF DEFINED BUILD_VSPROJ (
- ECHO %current_activity%: BUILD_VSPROJ defined. Building Visual Studio project files.
- %QT_LOC%\qmake -tp vc
- ECHO %current_activity%: Building Visual Studio project files done.
-) ELSE (
- ECHO %current_activity%: BUILD_VSPROJ not defined. Not building Visual Studio project files.
-)
-
-ECHO %current_activity%: Running qmake for %compile_level%:
-%QT_LOC%\qmake -spec win32-msvc CONFIG+=x86_64 CONFIG+=%compile_level%
-ECHO %current_activity%: qmake done.
-
-IF NOT DEFINED JOM_LOC (
- ECHO %current_activity%: JOM_LOC not defined. Using default value.
- SET JOM_LOC="C:\Qt\Tools\QtCreator\bin\jom.exe"
-)
-ECHO %current_activity%: JOM_LOC set to '%JOM_LOC%'.
-
-IF EXIST %JOM_LOC% (
- ECHO %current_activity%: JOM_LOC exists.
- ECHO %current_activity%: Running jom:
- %JOM_LOC%
- REM jom will not exit with an error code. Leading to a passing build even with errors.
- IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
- ECHO %current_activity%: jom done.
-) ELSE (
- ECHO JOM_LOC directory does not exist. Using nmake.
- ECHO %current_activity%: Running nmake:
- nmake
- REM nmake will not exit with an error code. Leading to a passing build even with errors.
- IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
- ECHO %current_activity%: nmake done.
-)
-
-CD %original_dir%
-
-ECHO %current_activity%: %current_activity% DONE.
\ No newline at end of file
+@ECHO OFF
+python build.py build
+IF ERRORLEVEL 1 EXIT /B 1
+call current_build.bat
+IF ERRORLEVEL 1 EXIT /B 1
+del current_build.bat
+IF ERRORLEVEL 1 EXIT /B 1
+PAUSE
diff --git a/build_scripts/win/build.py b/build_scripts/win/build.py
new file mode 100644
index 0000000..a1d8a21
--- /dev/null
+++ b/build_scripts/win/build.py
@@ -0,0 +1,241 @@
+"""
+Build script to compile OpenVR Advanced Settings on Windows.
+
+The entire purpose of the script is to locate the correct install locations
+for seven different applications:
+
+1. Qt Framework, used for compiling.
+2. Visual Studio, used for setting up the variables needed to compile with Qt.
+3. jom.exe, a part of Qt, basically a multi core nmake.
+4. 7zip. Used for creating the portable versions of the app.
+5. NSIS. Used for creating the installer versions of the app.
+6. LLVM. Used for clang-format and clang-cl.
+7. Qmake, a part of Qt, used for creating the makefiles.
+
+The script does error checking on environmental variables before outputting
+a simple Windows batch file that will be called by other batch scripts.
+
+The reason that a batch file is created and run outside of python is that if
+you don't do it like that, you have these options
+
+1) Run applications one by one in python.
+
+ This is not viable because the build() function requires that a batch file
+ be run to set up environmental variables for QMAKE and nmake, and all environmental
+ variables and settings are lost between sessions.
+
+2) Batch all applications together and run them in python.
+
+ This is still a viable way of doing things, but creating an actual file
+ makes debugging and experimentation a lot easier by less experienced people.
+ Furthermore the stdout and stderr output wouldn't be real time without adding
+ unnecessary complexity.
+
+3) Write the entire thing in another language (like Powershell).
+
+ This was tried and even though Powershell has decent stdlib functionality like
+ testing paths and replacing chars in strings, it is still lacking in some areas
+ like actually running .exe files without resorting to weird tricks and cmd line hacks.
+ In addition, Powershell has some weird tendencies compared to other "real"
+ programming languages that would add unnecessary complexity.
+
+Writing this script in pure Windows batch file language is definitely possible,
+but the large amounts of replication and low amounts of abstraction possibilities
+will make development and extension a chore.
+"""
+
+import os
+from sys import argv
+import inspect
+from common import *
+
+def package():
+ """
+ Runs 7zip and NSIS to create portable and installer versions.
+ """
+ set_current_activity("PACKAGE")
+ set_dirs()
+
+ say("Testing if all required build environment variables are set:")
+ ZIP_LOC = get_required_env_var_path(ZIP_LOC_VAR_NAME, ZIP_LOC_DEFAULT)
+ NSIS_LOC = get_required_env_var_path(NSIS_LOC_VAR_NAME, NSIS_LOC_DEFAULT)
+ say("All required build environment values are set.")
+
+ say("Adding 7zip to file:")
+ ZIP_NAME = "AdvancedSettings-" + VERSION_STRING + ".7z"
+
+ add_line_to_run_bat_file("@ECHO Starting 7zip:")
+ # -t7z means to output a 7zip file.
+ add_line_to_run_bat_file('"' + ZIP_LOC + '"' + " a -t7z " + get_project_dir() + "\\bin\\win64\\" + ZIP_NAME + " " + get_deploy_dir() + "\\*")
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO 7zip done.")
+ say("7zip added to file.")
+
+ say("Adding NSIS to file.")
+ add_line_to_run_bat_file("@ECHO Starting NSIS:")
+ add_line_to_run_bat_file("cd " + NSIS_LOC)
+ add_line_to_run_bat_file("makensis /V2 /WX " + get_project_dir() + "\\installer\\installer.nsi")
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO NSIS done.")
+ say("NSIS added to file.")
+
+ create_batch_file()
+
+
+def deploy():
+ """
+ Runs windeployqt and copies necessary files.
+ """
+ set_current_activity("DEPLOY")
+ set_dirs()
+
+ say("Testing if all required build environment variables are set:")
+ QT_LOC = get_required_env_var_path(QT_LOC_VAR_NAME, QT_LOC_DEFAULT)
+ say("All required build environment values are set.")
+
+ if is_env_var_set(BUILD_DEBUG_VAR_NAME):
+ COMPILE_MODE = "debug"
+ say(f"{BUILD_DEBUG_VAR_NAME} defined. Deploying '{COMPILE_MODE}' version.")
+ else:
+ COMPILE_MODE = "release"
+ say(f"{BUILD_DEBUG_VAR_NAME} not defined. Deploying '{COMPILE_MODE}' version.")
+
+ say("Adding windeployqt to file.")
+
+ add_line_to_run_bat_file("set PATH=%PATH%;" + QT_LOC + ";")
+
+ add_line_to_run_bat_file("@ECHO Starting windeployqt:")
+
+ #Extremely long line
+ add_line_to_run_bat_file('"' + "windeployqt" + '"'
+ + " --dir " + get_deploy_dir()
+ + "\\qtdata --libdir " + get_deploy_dir()
+ + " --plugindir " + get_deploy_dir() + "\\qtdata\\plugins --no-system-d3d-compiler --no-opengl-sw --"
+ + COMPILE_MODE + " --qmldir " + get_project_dir() + "\\src\\res\\qml\\ " + get_deploy_dir() + "\\AdvancedSettings.exe")
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO windeployqt finished.")
+
+ say("windeployqt added to file.")
+
+ say("Copying necessary files:")
+
+ #readme
+ copy_file(get_project_dir() + "\Readme.md", get_deploy_dir() + "\Readme.md")
+
+ #license
+ copy_file(get_project_dir() + "\\LICENSE", get_deploy_dir() + "\\LICENSE-GPL.txt")
+ copy_file(get_project_dir() + "\\third-party\\openvr\\LICENSE", get_deploy_dir() + "\\LICENSE-VALVE.txt")
+ copy_file(get_project_dir() + "\\third-party\\easylogging++\\LICENSE", get_deploy_dir() + "\\LICENSE-MIT.txt")
+
+ #res
+ copy_folder(get_project_dir() + "\\src\\res", get_deploy_dir() + "\\res")
+
+ #package files
+ copy_folder(get_project_dir() + "\\src\\package_files", get_deploy_dir())
+
+ #openvr dll
+ copy_file(get_project_dir() + "\\third-party\\openvr\\bin\\win64\\openvr_api.dll", get_deploy_dir() + "\\openvr_api.dll")
+
+ say("Creating batch file:")
+ create_batch_file()
+ say("Batch file created.")
+
+
+def build():
+ """
+ Runs:
+ 'vcvarsall.bat', a Visual Studio file to set up the environment for QMAKE.
+ QMAKE, creates the makefiles.
+ jom/nmake, builds the makefiles.
+ """
+ set_current_activity("BUILD")
+ set_dirs()
+
+ COMPILE_MODE = ""
+ COMPILER = ""
+
+ say("Testing if all required build environment variables are set:")
+ QT_LOC = get_required_env_var_path(QT_LOC_VAR_NAME, QT_LOC_DEFAULT)
+ VS_LOC = get_required_env_var_path(VS_LOC_VAR_NAME, VS_LOC_DEFAULT)
+
+ if is_env_var_set(BUILD_CLANG_VAR_NAME):
+ say(f"{BUILD_CLANG_VAR_NAME} defined. Building for win32-clang-msvc.")
+ get_required_env_var_path(LLVM_LOC_VAR_NAME, LLVM_LOC_DEFAULT)
+ COMPILER = "win32-clang-msvc"
+ else:
+ say(f"{BUILD_CLANG_VAR_NAME} not defined. Building for msvc.")
+ COMPILER = "win32-msvc"
+
+ say("All required build environment values are set.")
+
+ #Otherwise qmake gets confused
+ add_line_to_run_bat_file("cd " + get_project_dir())
+
+ say("Adding 'vcvarsall.bat' to batch file.")
+ add_line_to_run_bat_file("@ECHO Setting up environment with Visual Studio 'vcvarsall.bat':")
+ add_line_to_run_bat_file("call " + '"' + VS_LOC + '"' + " " + PLATFORM_TARGET)
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO Environment set up.")
+ say("'vcvarsall.bat' added to batch file.")
+
+ QMAKE_LOC = QT_LOC + r"\qmake.exe"
+
+ if is_env_var_set(BUILD_VSPROJ_VAR_NAME):
+ say(f"{BUILD_VSPROJ_VAR_NAME} defined. Building Visual Studio project files.")
+ add_line_to_run_bat_file("@ECHO Running Visual Studio project file building:")
+ add_line_to_run_bat_file('"' + QMAKE_LOC + '"' + " -tp vc")
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO Done building Visual Studio project files.")
+ else:
+ say(f"{BUILD_VSPROJ_VAR_NAME} not defined. Not building Visual Studio project files.")
+
+ if is_env_var_set(BUILD_DEBUG_VAR_NAME):
+ COMPILE_MODE = "debug"
+ say(f"{BUILD_DEBUG_VAR_NAME} defined. Building '{COMPILE_MODE}' version.")
+ else:
+ COMPILE_MODE = "release"
+ say(f"{BUILD_DEBUG_VAR_NAME} not defined. Building '{COMPILE_MODE}' version.")
+
+ add_line_to_run_bat_file("@ECHO Running qmake:")
+ add_line_to_run_bat_file('"' + QMAKE_LOC + '"' + " -spec " + COMPILER + " CONFIG+=X86_64 " + "CONFIG+=" + COMPILE_MODE)
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO qmake done.")
+
+ if is_env_var_set(JOM_LOC_VAR_NAME):
+ JOM_LOC = os.getenv(JOM_LOC_VAR_NAME)
+ else:
+ say(f"{JOM_LOC_VAR_NAME} not defined. Using default value")
+ JOM_LOC = JOM_LOC_DEFAULT
+ say(f"{JOM_LOC_VAR_NAME} set to '{JOM_LOC}")
+
+ if os.path.exists(JOM_LOC):
+ say(f"{JOM_LOC_VAR_NAME} exists. Using jom.")
+ add_line_to_run_bat_file("@ECHO Running jom:")
+ add_line_to_run_bat_file(JOM_LOC)
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO jom done.")
+ say(f"{JOM_LOC_VAR_NAME} added to batch file.")
+ else:
+ say(f"{JOM_LOC_VAR_NAME} does not exists. Using nmake.")
+ add_line_to_run_bat_file("@ECHO Running nmake:")
+ #nmake is in the path because of 'vcvarsall.bat' from VS_LOC
+ add_line_to_run_bat_file("nmake")
+ add_error_handling_line_to_bat_file()
+ add_line_to_run_bat_file("@ECHO nmake done.")
+ say("nmake added to batch file.")
+
+ add_line_to_run_bat_file("cd " + get_original_dir())
+
+ create_batch_file()
+
+if __name__ == "__main__":
+ if argv[1] == "build":
+ build()
+ elif argv[1] == "deploy":
+ deploy()
+ elif argv[1] == "package":
+ package()
+
+
+
+
diff --git a/build_scripts/win/common.py b/build_scripts/win/common.py
new file mode 100644
index 0000000..6a462cd
--- /dev/null
+++ b/build_scripts/win/common.py
@@ -0,0 +1,191 @@
+"""
+Utility functions for building OpenVR Advanced Settings.
+"""
+import os
+import sys
+import argparse
+import subprocess
+import shutil
+import distutils.dir_util
+
+#Const globals
+#Version string must be bumped every release.
+#TODO: See developer documentation.
+VERSION_STRING = "2-8-0"
+
+EXIT_CODE_SUCCESS = 0
+EXIT_CODE_FAILURE_BUILD_APP = 1
+EXIT_CODE_FAILURE_BUILD_LOCATION = 2
+
+QT_LOC_VAR_NAME = "QT_LOC"
+VS_LOC_VAR_NAME = "VS_LOC"
+JOM_LOC_VAR_NAME = "JOM_LOC"
+ZIP_LOC_VAR_NAME = "ZIP_LOC"
+NSIS_LOC_VAR_NAME = "NSIS_LOC"
+LLVM_LOC_VAR_NAME = "LLVM_LOC"
+
+QT_LOC_DEFAULT = r"C:\Qt\5.11.1\msvc2017_64\bin\""
+VS_LOC_DEFAULT = r"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
+JOM_LOC_DEFAULT = r"C:\Qt\Tools\QtCreator\bin\jom.exe"
+ZIP_LOC_DEFAULT = r"C:\Program Files\7-Zip\7z.exe"
+NSIS_LOC_DEFAULT = r"C:\Program Files (x86)\NSIS\""
+LLVM_LOC_DEFAULT = r"C:\Program Files\LLVM\bin\""
+
+BUILD_CLANG_VAR_NAME = "BUILD_CLANG"
+BUILD_VSPROJ_VAR_NAME = "BUILD_VSPROJ"
+BUILD_DEBUG_VAR_NAME = "BUILD_DEBUG"
+
+PLATFORM_TARGET = "AMD64"
+
+#Mutable globals
+ORIGINAL_DIR = ""
+PROJECT_DIR = ""
+OUTPUT_DIR = r"\\bin\\win64\\AdvancedSettings"
+DEPLOY_DIR = ""
+
+current_activity = ""
+
+bat_file_contents = ""
+
+def set_current_activity(activity: str):
+ """
+ Wrapper around the current_activity global var to make it usable in other files.
+ """
+ global current_activity
+ current_activity = activity
+
+def say(message: str):
+ """
+ Prints a message to the console prepended by the current activity, like:
+ BUILD: Building things.
+ DEPLOY: Deploying things.
+ """
+ global current_activity
+ print(current_activity + ": " + message)
+
+def say_error(message: str):
+ """
+ Prints an error message to the console.
+
+ Not currently different from say, but put in incase somebody wanted to
+ do something fancy with outputting to stderr or something instead.
+ """
+ global current_activity
+ print(current_activity + ": " + message)
+
+def is_env_var_set(env_var_name: str):
+ """
+ Returns whether or not an environment variable is set.
+ """
+ var = os.getenv(env_var_name)
+ if var is None:
+ return False
+ return True
+
+def add_line_to_run_bat_file(line: str):
+ """
+ Adds a line ended by a newline to the batch file.
+ """
+ global bat_file_contents
+ bat_file_contents += line + "\n"
+
+def add_error_handling_line_to_bat_file():
+ """
+ Adds an error handling line to the batch file.
+
+ This is because some applications don't cause the script to error out
+ even if they exit with an error.
+ """
+ global bat_file_contents
+ bat_file_contents += "IF ERRORLEVEL 1 EXIT /B " + str(EXIT_CODE_FAILURE_BUILD_APP) + "\n"
+
+def get_required_env_var_path(env_var_name: str, default_env_var_value: str):
+ """
+ Easy function for getting *_LOC values, complete with testing for path validity and
+ outputting status to console.
+ """
+ if not is_env_var_set(env_var_name):
+ say(f"{env_var_name} not defined. Using default value.")
+ #Sanitize quotes because we'll add them later and they might mess up
+ #how we put together strings.
+ path = default_env_var_value.replace('"', '')
+ else:
+ path = os.getenv(env_var_name).replace('"', '')
+ say(f"{env_var_name} set to '{path}'")
+ if not os.path.exists(path):
+ say_error(f"{env_var_name} does not exist. Exiting")
+ exit_on_error(EXIT_CODE_FAILURE_BUILD_LOCATION)
+ say(f"{env_var_name} exists.")
+ return path
+
+def create_batch_file():
+ """
+ Creates a batch file in the dir. Must be called by another outside batch file.
+ """
+ file = open(get_project_dir() + "\\build_scripts\\win\\current_build.bat", "w+")
+ file.write(bat_file_contents)
+ file.close()
+
+def exit_on_error(error_number):
+ """Wrapper around sys.exit."""
+ sys.exit(error_number)
+
+def set_dirs():
+ """
+ Sets up the directories.
+
+ We know that the project dir will always be two dirs up from the dir the file is in.
+ """
+ global ORIGINAL_DIR
+ global PROJECT_DIR
+ global DEPLOY_DIR
+ ORIGINAL_DIR = os.path.dirname(__file__)
+ PROJECT_DIR = os.path.abspath(os.path.join(ORIGINAL_DIR, r"..\.."))
+ DEPLOY_DIR = DEPLOY_DIR = PROJECT_DIR + OUTPUT_DIR
+
+ print(ORIGINAL_DIR)
+
+def get_project_dir():
+ return PROJECT_DIR
+
+def get_original_dir():
+ return ORIGINAL_DIR
+
+def get_deploy_dir():
+ return DEPLOY_DIR
+
+def copy_file(src, dest):
+ """Copies a file and outputs status to console."""
+ say(f"Copying {src} to {dest}")
+ shutil.copy(src, dest)
+ say(f"{src} to {dest} copied.")
+
+def copy_folder(src, dest):
+ """Copies a folder and outputs status to console."""
+ say(f"Copying {src} to {dest}")
+ distutils.dir_util.copy_tree(src, dest)
+ say(f"{src} to {dest} copied.")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build_scripts/win/deploy.cmd b/build_scripts/win/deploy.cmd
index f19f1b9..7ba1243 100644
--- a/build_scripts/win/deploy.cmd
+++ b/build_scripts/win/deploy.cmd
@@ -1,119 +1,8 @@
-@echo off
-REM Echo off to avoid spam.
-
-REM Non zero is failure, 0 is success.
-SET exit_code_success=0
-SET exit_code_failure_build_apps=1
-SET exit_code_failure_build_locations=2
-
-SET output_dir="\bin\win64\"
-
-REM Used for echos.
-SET current_activity=DEPLOY
-
-REM If scripts are chain called the original dirs should not be overwritten.
-IF NOT DEFINED original_dir (
- SET original_dir=%CD%
-)
-IF NOT DEFINED project_dir (
- REM Arg 0 (called %0) is the full path to the file.
- REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters
- REM As per above link, %~dp0 expands the zeroth arg to a drive letter and path only.
- REM Project dir is up two dirs from the file.
- SET project_dir=%~dp0\..\..\
-)
-
-ECHO %current_activity%: Testing if all required build environment values are set:
-IF NOT DEFINED QT_LOC (
- ECHO %current_activity%: QT_LOC not defined. Using default value.
- SET QT_LOC="C:\Qt\5.11.1\msvc2017_64\bin\"
-)
-REM QT_LOC is a directory, it can't be in the path, no reason to check using WHERE.
-ECHO %current_activity%: QT_LOC set to '%QT_LOC%'.
-IF EXIST %QT_LOC% (
- ECHO %current_activity%: QT_LOC exists.
-) ELSE (
- ECHO %current_activity%: QT_LOC directory does not exist. Exiting.
- EXIT /B %exit_code_failure_build_locations%
-)
-
-ECHO %current_activity%: All required build environment values are set.
-
-IF NOT EXIST %project_dir%\%output_dir% (
- ECHO %current_activity%: Output dir '%output_dir%' does not exist. Creating.
- mkdir %project_dir%\%output_dir%
- ECHO %current_activity%: Output dir created.
-)
-
-cd %project_dir%\%output_dir%
-
-IF DEFINED BUILD_DEBUG (
- ECHO %current_activity%: BUILD_DEBUG var set. Compiling for debug.
- SET compile_level=debug
-) ELSE (
- ECHO %current_activity%: BUILD_DEBUG var not set. Compiling for release.
- SET compile_level=release
-)
-
-ECHO %current_activity%: Running windeployqt:
-
-REM windeployqt requires the QT\bin location to be in the path.
-REM Changing the PATH var is not ideal, but windeployqt does not work otherwise.
-set original_path=%PATH%
-set PATH=%QT_LOC%;%PATH%
-
-REM Caret newline (^CFLR) splits a command over several lines.
-REM This is done to avoid one ultra long line.
-
-windeployqt --dir AdvancedSettings\qtdata ^
---libdir AdvancedSettings ^
---plugindir AdvancedSettings\qtdata\plugins ^
---no-system-d3d-compiler ^
---no-opengl-sw ^
---%compile_level% ^
---qmldir ..\..\src\res\qml\ ^
-AdvancedSettings\AdvancedSettings.exe
-
-REM windeployqt does not exit on error by itself.
-IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
-REM Return the PATH to original as quickly as possible.
-set PATH=%original_path%
-ECHO %current_activity%: windeployqt done.
-
-REM Switches used for copy:
-REM /V Verifies that files have been copied correctly.
-REM /Q Suppresses xcopy spam.
-REM /Y Skips the overwrite yes prompt.
-REM /E Copies all subdirs, even if they are empty.
-REM /I "If Source is a directory or contains wildcards and Destination does not exist,
-REM xcopy assumes Destination specifies a directory name and creates a new directory.
-REM Then, xcopy copies all specified files into the new directory. By default,
-REM xcopy prompts you to specify whether Destination is a file or a directory."
-
-ECHO %current_activity%: Copying necessary files.
-copy /V /Y "%project_dir%\Readme.md" "%project_dir%\%output_dir%\AdvancedSettings\Readme.md"
-ECHO %current_activity%: README copied.
-
-REM All three licenses must be included in binary releases, as per the terms.
-copy /V /Y "%project_dir%\LICENSE" "%project_dir%\%output_dir%\AdvancedSettings\LICENSE-GPL.txt"
-copy /V /Y "%project_dir%\third-party\openvr\LICENSE" "%project_dir%\%output_dir%\AdvancedSettings\LICENSE-VALVE.txt"
-copy /V /Y "%project_dir%\third-party\easylogging++\LICENSE" "%project_dir%\%output_dir%\AdvancedSettings\LICENSE-MIT.txt"
-ECHO %current_activity%: LICENSE files copied.
-
-xcopy /Q /Y /E /I /V "%project_dir%\src\res" "%project_dir%\%output_dir%\AdvancedSettings\res\"
-ECHO %current_activity%: Resource files copied.
-
-copy /V /Y "%project_dir%\src\restartvrserver.bat" "%project_dir%\%output_dir%\AdvancedSettings\restartvrserver.bat"
-copy /V /Y "%project_dir%\src\startdesktopmode.bat" "%project_dir%\%output_dir%\AdvancedSettings\startdesktopmode.bat"
-ECHO %current_activity%: Extra batch files copied.
-
-copy /V /Y "%project_dir%\src\qt.conf" "%project_dir%\%output_dir%\AdvancedSettings\qt.conf"
-copy /V /Y "%project_dir%\src\manifest.vrmanifest" "%project_dir%\%output_dir%\AdvancedSettings\manifest.vrmanifest"
-ECHO %current_activity%: VR specific configuration files copied.
-
-copy /V /Y "%project_dir%\third-party\openvr\bin\win64\openvr_api.dll" "%project_dir%\%output_dir%\AdvancedSettings\openvr_api.dll"
-ECHO %current_activity%: OpenVR .dll copied.
-
-cd %original_dir%
-
-ECHO %current_activity%: %current_activity% DONE.
\ No newline at end of file
+@ECHO OFF
+python build.py deploy
+IF ERRORLEVEL 1 EXIT /B 1
+call current_build.bat
+IF ERRORLEVEL 1 EXIT /B 1
+del current_build.bat
+IF ERRORLEVEL 1 EXIT /B 1
+PAUSE
diff --git a/build_scripts/win/format.cmd b/build_scripts/win/format.cmd
index ac87b88..dae47d2 100644
--- a/build_scripts/win/format.cmd
+++ b/build_scripts/win/format.cmd
@@ -23,38 +23,38 @@ IF NOT DEFINED project_dir (
ECHO %current_activity%: Testing if clang-format can be located:
-IF NOT DEFINED CLANG_FORMAT_LOC (
- ECHO %current_activity%: CLANG_FORMAT_LOC not defined. Using default value.
- SET CLANG_FORMAT_LOC="C:\Program Files\LLVM\bin\clang-format.exe"
+IF NOT DEFINED LLVM_LOC (
+ ECHO %current_activity%: LLVM_LOC not defined. Using default value.
+ SET LLVM_LOC="C:\Program Files\LLVM\bin\"
)
-ECHO %current_activity%: CLANG_FORMAT_LOC set to '%CLANG_FORMAT_LOC%'.
+ECHO %current_activity%: LLVM_LOC set to '%LLVM_LOC%'.
REM EXIST won't find items in the PATH. WHERE will.
-SET CLANG_FORMAT_VALID=0
-IF EXIST %CLANG_FORMAT_LOC% SET CLANG_FORMAT_VALID=1
-IF %CLANG_FORMAT_VALID% EQU 0 (
- WHERE /Q %CLANG_FORMAT_LOC%
- IF NOT ERRORLEVEL 1 SET CLANG_FORMAT_VALID=1
+SET LLVM_VALID=0
+IF EXIST %LLVM_LOC% SET LLVM_VALID=1
+IF %LLVM_VALID% EQU 0 (
+ WHERE /Q %LLVM_LOC%\clang-format.exe
+ IF NOT ERRORLEVEL 1 SET LLVM_VALID=1
)
-IF %CLANG_FORMAT_VALID% EQU 1 (
- ECHO %current_activity%: CLANG_FORMAT_LOC exists.
+IF %LLVM_VALID% EQU 1 (
+ ECHO %current_activity%: LLVM_LOC exists.
) ELSE (
- ECHO %current_activity%: CLANG_FORMAT_LOC directory does not exist. Exiting.
+ ECHO %current_activity%: LLVM_LOC directory does not exist. Exiting.
EXIT /B %exit_code_failure_build_locations%
)
ECHO %current_activity%: Clang-format located.
-%CLANG_FORMAT_LOC% --version
+%LLVM_LOC%\clang-format.exe --version
REM First iteration.
-FOR /R %project_dir%\src\ %%F IN (*.cpp *.h) DO (%CLANG_FORMAT_LOC% --style=file -i %%F & ECHO Iteration 1. %%F)
+FOR /R %project_dir%\src\ %%F IN (*.cpp *.h) DO (%LLVM_LOC%\clang-format.exe --style=file -i %%F & ECHO Iteration 1. %%F)
REM Clang-format is sometimes indecisive about which exact rules to apply,
REM leading to differences between first and second iteration.
REM Do it twice, just to be sure.
-FOR /R %project_dir%\src\ %%F IN (*.cpp *.h) DO (%CLANG_FORMAT_LOC% --style=file -i %%F & ECHO Iteration 2. %%F)
+FOR /R %project_dir%\src\ %%F IN (*.cpp *.h) DO (%LLVM_LOC%\clang-format.exe --style=file -i %%F & ECHO Iteration 2. %%F)
ECHO %current_activity%: %current_activity% DONE.
diff --git a/build_scripts/win/package.cmd b/build_scripts/win/package.cmd
index b7b76ad..95a2084 100644
--- a/build_scripts/win/package.cmd
+++ b/build_scripts/win/package.cmd
@@ -1,96 +1,8 @@
-@echo off
-REM Echo off to avoid spam.
-
-REM Non zero is failure, 0 is success.
-SET exit_code_success=0
-SET exit_code_failure_build_apps=1
-SET exit_code_failure_build_locations=2
-
-SET output_dir="\bin\win64\"
-
-REM Used for echos.
-SET current_activity=PACKAGE
-
-REM If scripts are chain called the original dirs should not be overwritten.
-IF NOT DEFINED original_dir (
- SET original_dir=%CD%
-)
-IF NOT DEFINED project_dir (
- REM Arg 0 (called %0) is the full path to the file.
- REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters
- REM As per above link, %~dp0 expands the zeroth arg to a drive letter and path only.
- REM Project dir is up two dirs from the file.
- SET project_dir=%~dp0\..\..\
-)
-
-REM ZIP_LOC can't be called 7Z_LOC because of Windows limitations.
-ECHO %current_activity%: Testing if all required build environment values are set:
-
-IF NOT DEFINED ZIP_LOC (
- ECHO %current_activity%: ZIP_LOC not defined. Using default value.
- SET ZIP_LOC="C:\Program Files\7-Zip\7z.exe"
-)
-ECHO %current_activity%: ZIP_LOC set to '%ZIP_LOC%'.
-
-REM EXIST won't find items in the PATH. WHERE will.
-SET ZIP_VALID=0
-IF EXIST %ZIP_LOC% SET ZIP_VALID=1
-IF %ZIP_VALID% EQU 0 (
- WHERE /Q %ZIP_LOC%
- IF NOT ERRORLEVEL 1 SET ZIP_VALID=1
-)
-
-IF %ZIP_VALID% EQU 1 (
- ECHO %current_activity%: ZIP_LOC exists.
-) ELSE (
- ECHO %current_activity%: ZIP_LOC directory does not exist. Exiting.
- EXIT /B %exit_code_failure_build_locations%
-)
-
-IF NOT DEFINED NSIS_LOC (
- ECHO %current_activity%: NSIS_LOC not defined. Using default value.
- SET NSIS_LOC="C:\Program Files (x86)\NSIS\"
-)
-ECHO %current_activity%: NSIS_LOC set to '%NSIS_LOC%'.
-
-REM EXIST won't find items in the PATH. WHERE will.
-SET NSIS_VALID=0
-IF EXIST %NSIS_LOC% SET NSIS_VALID=1
-REM Prevents error message spam if it doesn't find it in PATH.
-IF %NSIS_VALID% EQU 0 (
- WHERE /Q %NSIS_LOC%
- IF NOT ERRORLEVEL 1 SET NSIS_VALID=1
-)
-
-IF %NSIS_VALID% EQU 1 (
- ECHO %current_activity%: NSIS_LOC exists.
-) ELSE (
- ECHO %current_activity%: NSIS_LOC directory does not exist. Exiting.
- EXIT /B %exit_code_failure_build_locations%
-)
-
-ECHO %current_activity%: All required build environment values are set.
-
-IF DEFINED BUILD_DEBUG (
- ECHO %current_activity%: BUILD_DEBUG var set. NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
- ECHO %current_activity%: NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
- ECHO %current_activity%: NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
- ECHO %current_activity%: NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
- EXIT /B %exit_code_failure_build_apps%
-)
-
-ECHO %current_activity%: Running 7zip:
-%ZIP_LOC% a %project_dir%\%output_dir%\AdvancedSettings.zip %project_dir%\%output_dir%\AdvancedSettings\*
-ECHO %current_activity%: 7zip done.
-
-ECHO %current_activity%: Running NSIS:
-REM Trying to launch makensis without CD into the dir does not work for some reason.
-CD %NSIS_LOC%
-REM /V2 is show warnings and errors, /WX is treat warnings as errors.
-makensis /V2 /WX %project_dir%\installer\installer.nsi
-IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
-ECHO %current_activity%: NSIS done.
-
-CD %original_dir%
-
-ECHO %current_activity%: %current_activity% DONE.
\ No newline at end of file
+@ECHO OFF
+python build.py package
+IF ERRORLEVEL 1 EXIT /B 1
+call current_build.bat
+IF ERRORLEVEL 1 EXIT /B 1
+del current_build.bat
+IF ERRORLEVEL 1 EXIT /B 1
+PAUSE
diff --git a/build_scripts/win/verify_formatting.cmd b/build_scripts/win/verify_formatting.cmd
index 997643d..eeb532b 100644
--- a/build_scripts/win/verify_formatting.cmd
+++ b/build_scripts/win/verify_formatting.cmd
@@ -32,7 +32,7 @@ ECHO %current_activity%: Clang-format located.
%CLANG_FORMAT_LOC% --version
-python %project_dir%/build_scripts/run-clang-format.py %project_dir%/src -r --color never --clang-format-executable %CLANG_FORMAT_LOC%
+%PYTHON_LOC%python %project_dir%/build_scripts/run-clang-format.py %project_dir%/src -r --color never --clang-format-executable %CLANG_FORMAT_LOC%
IF NOT ERRORLEVEL 1 (
ECHO FORMATTED CORRECTLY.
) ELSE (
diff --git a/build_windows.cmd b/build_windows.cmd
index 87afac4..2133014 100644
--- a/build_windows.cmd
+++ b/build_windows.cmd
@@ -1,6 +1,10 @@
@echo off
REM Echo off to avoid spam.
+SET exit_code_success=0
+SET exit_code_failure_build_apps=1
+SET exit_code_failure_build_locations=2
+
REM Used for echos.
SET top_level_activity=MASTER
@@ -18,17 +22,29 @@ SET project_dir=%folder_path%
ECHO %top_level_activity%: Calling build script.
-CALL %project_dir%\build_scripts\win\build.cmd
-IF ERRORLEVEL 1 EXIT /B 1
+%PYTHON_LOC%python %project_dir%\build_scripts\win\build.py build
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+call %project_dir%\build_scripts\win\current_build.bat
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
ECHO %top_level_activity%: Calling deployment script.
-CALL %project_dir%\build_scripts\win\deploy.cmd
-IF ERRORLEVEL 1 EXIT /B 1
+%PYTHON_LOC%python %project_dir%\build_scripts\win\build.py deploy
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+call %project_dir%\build_scripts\win\current_build.bat
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+REM The average dev doesn't need to package and zip it, just build it and test.
+IF NOT DEFINED BUILD_PACKAGE (
+ ECHO %top_level_activity%: BUILD_PACKAGE not set. Not building installer and portable zip versions.
+ ECHO %top_level_activity%: MASTER DONE.
+ EXIT /B %exit_code_success%
+)
ECHO %top_level_activity%: Calling packaging script.
-CALL %project_dir%\build_scripts\win\package.cmd
-IF ERRORLEVEL 1 EXIT /B 1
+%PYTHON_LOC%python %project_dir%\build_scripts\win\build.py package
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+call %project_dir%\build_scripts\win\current_build.bat
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
CD %original_dir%
-ECHO %top_level_activity%: MASTER DONE.
\ No newline at end of file
+ECHO %top_level_activity%: MASTER DONE.
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 07bc064..e94ecfa 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -10,7 +10,9 @@
## You found a bug or have a suggestion for improvement
-First, look through the [issues page](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/issues) and see if there are any open issues relevant to yours. If there are, describe your issue in detail and why you think it's relevant to the already open issue.
+First, update to the newest release.
+
+If the issue persists, look through the [issues page](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/issues) and see if there are any open issues relevant to yours. If there are, describe your issue in detail and why you think it's relevant to the already open issue.
If there aren't any open issues relevant to yours, create a new issue and give as much detail as possible.
@@ -26,7 +28,7 @@ Include logs if possible. Logs can be found in `%APPDATA%\matzman666\OpenVRAdvan
### Building
-If you haven't already, read the instructions for how to build on [Windows](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/tree/master#building_on_windows) or [Linux](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/tree/master#building_on_linux). Your patch must build on all platforms without errors (warnings are treated as errors). Notice that different compilers have different warning messages, being able to successfully compile on one does not mean that all of them will pass. The pull request will be built on both Windows (msvc) and Linux (gcc and clang) CI servers.
+If you haven't already, read the instructions for how to build on [Windows](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/tree/master#building_on_windows) or [Linux](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/tree/master#building_on_linux). Your patch must build on all platforms without errors (warnings are treated as errors). Notice that different compilers have different warning messages, being able to successfully compile on one does not mean that all of them will pass. The pull request will be built on both Windows (msvc and clang-msvc) and Linux (gcc and clang) CI servers.
### Formatting
@@ -35,13 +37,13 @@ This project uses `clang-format` (part of the [LLVM collection](https://releases
The `.\build_scripts\win\format.cmd` (for Windows) and `./build_scripts/linux/format` (for Linux) scripts will automatically run `clang-format` on all required files.
-The Windows script requires that either your `clang-format.exe` is in `C:\Program Files\LLVM\bin\clang-format.exe` or the `CLANG_FORMAT_LOC` environment variable is set to the location of the `.exe`.
+The Windows script requires that either your `clang-format.exe` is in `C:\Program Files\LLVM\bin\clang-format.exe` or the `LLVM_LOC` environment variable is set to the LLVM bin directory.
The Linux script requires that `clang-format` is in your `path`.
There are `clang-format` plugins for many IDEs, including [Qt Creator](https://doc.qt.io/qtcreator/creator-beautifier.html) and [Visual Studio](https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.ClangFormat).
-To verify that your patch has been formatted correctly, run `.\build_scripts\win\verify_formatting.cmd` on Windows or `./build_scripts/linux/verify_formatting` on Linux. If there are formatting changes needed the script will output a diff showing which changes are needed, otherwise it will output `FORMATTED CORRECTLY.`. The verification script requires `python` in the `path` for Linux and Windows. On Windows the verification script will either use the `CLANG_FORMAT_LOC` environment variable or the default location.
+To verify that your patch has been formatted correctly, run `.\build_scripts\win\verify_formatting.cmd` on Windows or `./build_scripts/linux/verify_formatting` on Linux. If there are formatting changes needed the script will output a diff showing which changes are needed, otherwise it will output `FORMATTED CORRECTLY.`. The verification script requires `python` in the `path` for Linux and Windows. On Windows the verification script will either use the `LLVM_LOC` environment variable or the default location.
### Style guide
diff --git a/docs/building_for_windows.md b/docs/building_for_windows.md
index 4a08a03..f23731b 100644
--- a/docs/building_for_windows.md
+++ b/docs/building_for_windows.md
@@ -15,10 +15,10 @@ For compiling:
1. [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/) (tested on 2017 Community)
2. [Qt Framework](https://www.qt.io/download) version later than 5.6 (tested on 5.10 and 5.11)
+3. [Python 3](https://www.python.org/downloads/) (must be in `PATH` environment variable)
For pushing changes to the repo:
-1. [Python 3](https://www.python.org/downloads/) (must be in `PATH` environment variable)
2. Clang format. Part of the [LLVM collection](https://releases.llvm.org/download.html).
@@ -41,7 +41,8 @@ The following environmental variables are relevant for building the project.
| `JOM_LOC` | Path to an `.exe` of `jom.exe`. Usually installed with Qt. `jom` is a wrapper around `nmake` allowing more threads to be used. It is not required, but using `nmake`is slower. If `JOM_LOC` isn't defined, or the `.exe` can't be found `nmake` will be used by default. To force using `nmake`, set `JOM_LOC` to a non-valid path like `1`. |
| `ZIP_LOC` | Path to your 7zip `.exe`. Both portable and installer will work. |
| `NSIS_LOC` | Path to your installation of NSIS containing the `makensis` file. Both portable and installer will work. |
-| `CLANG_FORMAT_LOC` | Path to your `clang-format.exe`. Not necessary for building, but necessary for pushing changes to the repo. |
+| `LLVM_LOC` | Path to your LLVM bin directory containing `clang-format.exe`. Not necessary for building with the MSVC compiler, but necessary for pushing changes to the repo. Leave as empty string if your `clang-format.exe` and `clang-cl.exe` are in the path. |
+| `PYTHON_LOC` | A non-error-checked way of referring to a specific python installation. Must end on a backslash or be undefined. If undefined `python` must be in the path. |
If an environment variable isn't set a default value will be provided. The default values are shown in the table below.
@@ -52,7 +53,8 @@ If an environment variable isn't set a default value will be provided. The defau
| `JOM_LOC` | `"C:\Qt\Tools\QtCreator\bin\jom.exe"`|
| `ZIP_LOC` | `"C:\Program Files\7-Zip\7z.exe"` |
| `NSIS_LOC` | `"C:\Program Files (x86)\NSIS\"` |
-| `CLANG_FORMAT_LOC` | `"C:\Program Files\LLVM\bin\clang-format.exe"` |
+| `LLVM_LOC` | `"C:\Program Files\LLVM\bin\"` |
+| `PYTHON_LOC` | NONE SUPPLIED. It is expected that `python` is in the path if `PYTHON_LOC` is defined.|
Additionally, these optional environment variables are supported.
@@ -60,6 +62,7 @@ Additionally, these optional environment variables are supported.
| -------------------- | ------------- |
| `BUILD_DEBUG` | If set, a debug version will be built. The packaging script will not run with this var set. |
| `BUILD_VSPROJ` | If set, Visual Studio project files will be built. |
+| `BUILD_PACKAGE` | If set, the script will create a zipped portable version and installer `.exe`. Unset by default since only the build server really needs to create zips and installer versions. |
Remember that there's a difference between an unset variable and a variable set to an empty string. `SET BUILD_DEBUG=""` does not unset the variable. You need to write `SET BUILD_DEBUG=`.
diff --git a/docs/developer_docs.md b/docs/developer_docs.md
new file mode 100644
index 0000000..c7e2f02
--- /dev/null
+++ b/docs/developer_docs.md
@@ -0,0 +1,23 @@
+
+# OpenVR Advanced Settings Developer Docs
+
+For things that don't directly belong a single place in the source code.
+
+ > * [New Patch Release Checklist](#patch_checklist)
+ > * [Increment Version Numbers](#inc_vers_numbers)
+
+
+## New Patch Release Checklist
+
+
+### Increment Version Numbers
+
+Currently there are three version strings in the source.
+
+1. `src\overlaycontroller.h` - Variable named `applicationVersionString`.
+2. `build_scripts\win\common.py` - Variable named `VERSION_STRING`.
+3. `installer\installer.nsi` - Variable named `VERSION_STRING`.
+
+The first string should be three digits separated by dots (periods), as described in [semantic versioning](https://semver.org/) (like "2.8.0"). The second and third should be three digits separated by hyphens/dashes (like "2-8-0").
+
+The reason for the difference is that the first string is only used as a string in the source code, while the second and third are used to name files. Some operating system can become confused with more than one dot in the file name (like Windows). It's better to just avoid the situation entirely.
\ No newline at end of file
diff --git a/installer/installer.nsi b/installer/installer.nsi
index 26b0bbd..9bb87f0 100644
--- a/installer/installer.nsi
+++ b/installer/installer.nsi
@@ -9,10 +9,13 @@
!define BASEDIR "..\bin\win64\AdvancedSettings"
!define SRCDIR "..\src"
!define THIRDDIR "..\third-party"
+ !define PACKAGEDIR "..\src\package_files"
+ !define PROJECTDIR "..\"
+ !define VERSION_STRING "2-8-0"
;Name and file
Name "OpenVR Advanced Settings"
- OutFile "AdvancedSettings-Installer.exe"
+ OutFile "AdvancedSettings-${VERSION_STRING}-Installer.exe"
;Default installation folder
InstallDir "$PROGRAMFILES64\OpenVR-AdvancedSettings"
@@ -103,13 +106,15 @@ Section "Install" SecInstall
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
- File "${SRCDIR}\LICENSE.txt"
+ File "${BASEDIR}\LICENSE-GPL.txt"
+ File "${BASEDIR}\LICENSE-MIT.txt"
+ File "${BASEDIR}\LICENSE-VALVE.txt"
File "${BASEDIR}\*.exe"
File "${THIRDDIR}\openvr\bin\win64\*.dll"
File "${BASEDIR}\*.dll"
- File "${SRCDIR}\*.bat"
- File "${SRCDIR}\*.vrmanifest"
- File "${SRCDIR}\*.conf"
+ File "${PACKAGEDIR}\*.bat"
+ File "${PACKAGEDIR}\*.vrmanifest"
+ File "${PACKAGEDIR}\*.conf"
File /r "${SRCDIR}\res"
File /r "${BASEDIR}\qtdata"
diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h
index 48cc081..5b5e07d 100644
--- a/src/overlaycontroller.h
+++ b/src/overlaycontroller.h
@@ -47,7 +47,7 @@ class OverlayController : public QObject
public:
static constexpr const char* applicationKey = "matzman666.AdvancedSettings";
static constexpr const char* applicationName = "Advanced Settings";
- static constexpr const char* applicationVersionString = "v2.5";
+ static constexpr const char* applicationVersionString = "v2.8.0";
private:
vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid;
diff --git a/src/LICENSE.txt b/src/package_files/LICENSE.txt
similarity index 100%
rename from src/LICENSE.txt
rename to src/package_files/LICENSE.txt
diff --git a/src/manifest.vrmanifest b/src/package_files/manifest.vrmanifest
similarity index 100%
rename from src/manifest.vrmanifest
rename to src/package_files/manifest.vrmanifest
diff --git a/src/qt.conf b/src/package_files/qt.conf
similarity index 100%
rename from src/qt.conf
rename to src/package_files/qt.conf
diff --git a/src/restartvrserver.bat b/src/package_files/restartvrserver.bat
similarity index 100%
rename from src/restartvrserver.bat
rename to src/package_files/restartvrserver.bat
diff --git a/src/startdesktopmode.bat b/src/package_files/startdesktopmode.bat
similarity index 100%
rename from src/startdesktopmode.bat
rename to src/package_files/startdesktopmode.bat