Skip to content

Commit

Permalink
Update README.md and project_setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirdEyeSqueegee committed Sep 10, 2023
1 parent 68aef2e commit fb747d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@

## Setup

- Clone the repository
- Optional:
- Run `cd .\CLibSFPluginTemplate\`
- Run `py .\project_setup.py\` (requires [Python 3.12+](https://www.python.org/download/pre-releases/))
- Enter your project name (in CamelCase)
- `project_setup.py` just does a few convenience things like setting the project name in `vcpkg.json` and `CMakeLists.txt`
1. Clone the repository
2. Set the `"name"` and `"version-semver"` fields in `vcpkg.json`
3. Update the `"baseline"` entries to the latest commits in both registries in `vcpkg.json`
- Follow the links in the `"repository"` fields and copy-paste the hash of the latest commit in each repository
4. Set the name and version of your plugin in `CMakeLists.txt`
5. Set the `Author` variable in `cmake/Plugin.h.in` to your name
6. Set the name of `contrib/Config/PluginName.ini` to the name of your plugin
7. Edit the `ini.LoadFile()` call in `src/Settings.cpp` to load the renamed ini from step 6

A python script, `project_setup.py`, is provided which automates the above steps (requires [Python 3.12+](https://www.python.org/download/pre-releases/)). To run the script:

1. Run `cd .\CLibSFPluginTemplate\`
2. Run `py .\project_setup.py\`
3. Enter your project name (in CamelCase)

## Building your project

- Visual Studio should prompt you to generate a CMake cache. Click on `Generate` and wait
- One the CMake cache is generated, build your project
- The .dll and .pdb files will be placed in `contrib\PluginRelease` or `contrib\PluginDebug` depending on your build configuration
- The `.dll` and `.pdb` files will be placed in `contrib\PluginRelease` or `contrib\PluginDebug` depending on your build configuration

## Build configs

Expand Down
13 changes: 13 additions & 0 deletions project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,21 @@ def onexc(func, path, exc_info):
os.remove(os.path.join(cwd, "README.md"))

project_name = input("Enter project name: ")
author = input("Enter author: ")
pattern = re.compile(r"(?<!^)(?=[A-Z])")

with open(
os.path.join(cwd, "cmake\\Plugin.h.in"), "r", encoding="utf-8"
) as pluginh_file:
pluginh = pluginh_file.read()

pluginh = pluginh.replace("AuthorName", author)

with open(
os.path.join(cwd, "cmake\\Plugin.h.in"), "w", encoding="utf-8"
) as pluginh_file:
pluginh_file.write(pluginh)

with open(os.path.join(cwd, "vcpkg.json"), "r", encoding="utf-8") as vcpkg_json_file:
vcpkg_json = json.load(vcpkg_json_file)

Expand Down

0 comments on commit fb747d1

Please sign in to comment.