Skip to content

Commit

Permalink
Add unicode support info to C++ quick start
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Mar 3, 2024
1 parent 491d5c2 commit 3c88185
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions docs/getting-started/cpp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Get started with our cross-platform C++ header library.

1. Copy [Velopack.hpp](https://github.com/velopack/velopack.fusion/blob/master/for-cpp/Velopack.hpp) and [Velopack.cpp](https://github.com/velopack/velopack.fusion/blob/master/for-cpp/Velopack.cpp) into your project.

2. If you are on Linux or MacOS, you'll need [ICU4C](https://icu.unicode.org/) installed. Like many other C libraries,
0. If you are on Linux or MacOS, you'll need [ICU4C](https://icu.unicode.org/) installed. Like many other C libraries,
installing the development package with your package manager (`apt` etc) is sufficient to make it available to compilers.
The specific command you'll need is OS/Distro specific.

3. Add the `Velopack::startup()` to your entry point (eg. `main()` or `wmain()`) as early as possible, ideally the first statement to run:
0. Add the `Velopack::startup()` to your entry point (eg. `main()` or `wmain()`) as early as possible, ideally the first statement to run:
```cpp
#include "Velopack.hpp"

Expand All @@ -21,7 +21,7 @@ The specific command you'll need is OS/Distro specific.
}
```

3. Add auto-updates somewhere to your app:
0. Add auto-updates somewhere to your app:
```cpp
#include "Velopack.hpp"
#include <memory>
Expand All @@ -41,7 +41,24 @@ The specific command you'll need is OS/Distro specific.
}
```

4. Install the `vpk` command line tool:
0. Enable the [UTF-8 codepage](https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page) in your application manifest if you are targeting Windows.
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>
```
:::warning[Enabling Unicode Support]
The Velopack C++ Library expects UTF-8 `std::string` and `char*` strings, which is standard practice on Unix-like operating systems, so no extra steps are needed there.
On Windows, Velopack will use the `A` (ansi) windows functions which accept `char*` rather than the `W` (UTF-16) unicode functions.
By adding the UTF-8 code page to your application manifest, the `A` ansi functions will switch to accepting UTF-8.
:::

0. Install the `vpk` command line tool:
```sh
dotnet tool update -g vpk
```
Expand All @@ -50,14 +67,14 @@ The specific command you'll need is OS/Distro specific.
:::


5. Compile your app to a program using your usual compiler (eg. msvc, cmake, gcc, etc)
0. Compile your app to a program using your usual compiler (eg. msvc, cmake, gcc, etc)

6. Copy `Vfusion.exe`, `VfusionMac` or `VfusionNix` to your build output folder. This is a manual step for now, but may be automated in the future. You can compile this yourself, download a [recent build artifact](https://github.com/velopack/velopack.fusion/actions), or grab the latest [npm release](https://www.npmjs.com/package/velopack?activeTab=code) which also bundles the binaries.
0. Copy `Vfusion.exe`, `VfusionMac` or `VfusionNix` to your build output folder. This is a manual step for now, but may be automated in the future. You can compile this yourself, download a [recent build artifact](https://github.com/velopack/velopack.fusion/actions), or grab the latest [npm release](https://www.npmjs.com/package/velopack?activeTab=code) which also bundles the binaries.
:::warning
Until this is automated, failing to copy the fusion binary to your update directory will result in your app being unable to update.
:::

7. Package your Velopack release / installers:
0. Package your Velopack release / installers:
```sh
vpk pack -u MyAppUniqueId -v 1.0.0 -p /myBuildDir -e myexename.exe
```
Expand Down

0 comments on commit 3c88185

Please sign in to comment.