/SKSEPlugins

Scripted template for setting up SKSE64 development environment for both AE and SE.

Primary LanguagePowerShellMIT LicenseMIT

SKSEPlugins

Scripted template for setting up SKSE64 development environment for the latest CommonLibSSE-NG. (Multi targeting AE/SE/VR)

中文指南

Differences from CommonLibSSE-NG-ExamplePlugin

  • Unified workspace setup. Managing all plugin projects together, build as needed.
  • Enabled CommonLibSSE in Visual Studio IDE, able to view/modify/recompile CLib code on the fly.
  • Integrated building-testing-deploying with post build control tool.
  • Supports custom maintained fork of CommonLibSSE-NG.
  • Supports plugin configuration files in Visual Studio IDE.

Requirement

Bootstrap

Clone this repo onto your local environment, execute the command in PowerShell with admin privilege(needed for bootstrap):

git clone https://github.com/gottyduke/SKSEPlugins
cd .\SKSEPlugins
powershell -executionpolicy bypass -command "& .\!rebuild.ps1 -bootstrap"

bootstrap process is necessary for setting up environment variables!

Update

To get the latest SKSEPlugins updates:

cd <Path/To/SKSEPlugins>
git pull origin master
.\!Rebuild -bootstrap -update

New Project

!MakeNew <PluginName> 
    [-install 'PluginMO2InstallName'] 
    [-message 'Short description for plugin project'] 
    [-vcpkg 'Lib1[Feature1, Feature2]', 'Lib2', 'Lib3']

To generate a basic project:

.\!MakeNew MyBasicPlugin

To generate a project with imgui and xbyak vcpkg dependencies:

.\!MakeNew MyProject -vcpkg 'imgui', 'xbyak'

The -install parameter specifies the name for installation, used in post build control for MO2 support.

Generate VS Solution

!Rebuild <AE|SE|VR|ALL|PRE-AE|FLATRIM>
    [-C|-Custom] 
    [-N|-NoBuild]
    [-WhatIf]
    [-DBG]
    [-D]
Configuration Runtime targeting
AE Anniversary edition only(1.6.317+)
SE Special edition only(1.5.3+)
VR VR edition only(1.3.64)
ALL Default; All editions
PRE-AE Special edition(1.5.3+) and VR edition(1.3.64)
FLATRIM Anniversary edition(1.6.317+) and speical edition(1.5.3+)

Configuration parameter is case-insensitive. ALL configuration is set by default and therefore can be omitted.

Switch Description
-C|-Custom Use designated custom CommonLib for solution
-N|-NoBuild Disable the CommonLib compilation after generating solution
-WhatIf Do not initiate CMake generator; Preview CMakeLists.txt instead
-DBG [Project] Toggle debugger build for Project, i.e. testing suites
-D [CMAKE_ARGUMENTS] Pass additional arguments to CMake generator, same as CMake format

To generate a solution targetting special edition(1.5.3+) and anniversary edition(1.6.317+):
.\!Rebuild flatrim

To generate a solution targetting all editions with custom CommonLib(ALL is omitted):
.\!Rebuild -c

To generate a solution targetting special edition(1.5.3+) only and do not compile CommonLib after !Rebuild:
.\!Rebuild se -n
Report.png

Post Build Control

A handy post build control tool to help with developing-testing-deploying plugin in a speedy & convenient fashion.
Post-Build-Control.png
Deploy straight into MO2 with proper file structure, along with all supported files automatically. scripts(.psc), shockwave files(.swf), configuration files(.ini|.toml|.json).
MO2.png
Refresh MO2(F5) and start debugging! Or you can deploy straight into game's data folder, and launch desired SKSE without the struggle of MO2. Once done testing, you may also optionally remove the deployed plugins for game data's integrity.
Log.png

VCPKG

!Rebuild auto gathers vcpkg dependencies from sub projects and build them if needed.

Add/Remove files

Supports directly adding/removing files in VS by right clicking Add New Files, it will be carried over to the source folder upon building. When reloading VS projects after the second build, the newly added files may lose focus in VS tabs if they were open before reloading, simply re-open them from VS solution explorer.

CommonLib

!Rebuild builds with default CommonLibSSE-NG. To use a custom CommonLib, then append the switch -c or -custom to the !Rebuild command. Custom CommonLib has to be prepared in bootstrap process first!
However, !Rebuild uses custom pregenerated CMakeLists.txt in place of the default one came with CommonLibSSE.

DKUtil

This build setup bundles DKUtil header library, full documentation can be found here.

Migrating to SKSEPlugins

Simply use !MakeNew script to make new plugin project with the same name, then copy every source file except main.cpp, PCH.h, and Version.h into the new project's src folder. API or external header files can be placed in include folder. After doing so, manually check the CMakeLists.txt and vcpkg.json to address missing dependency if there's any. You may change the versioning after first successful build or manually changing the two above-mentioned files.

Do a full !Rebuild with the new project, and modify new project's main.cpp accordingly to adopt your old plugin's changes within VS.


Author: Dropkicker & Maxsu @ 2022