Skip to content

Commit 0d5286a

Browse files
authored
Increment version (#42)
* Increment version * Update README.md * Update README.md
1 parent 2ab91ae commit 0d5286a

2 files changed

Lines changed: 60 additions & 12 deletions

File tree

README.md

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,38 @@ See the full [CHANGELOG](./CHANGELOG) for detailed version history.
2828
How to build
2929
------------
3030

31-
Run `setup.py` with the required argument for your platform:
31+
Run `setup.py` with the required arguments for your platform:
3232

3333
```sh
34-
python setup.py --platform {linux_x64,linux_x86,osx,win32,win64,uwp} [--cfg {Release,Debug}] [--build] [--test] [--coverage]
34+
python setup.py --platform {linux_x64,linux_x86,osx,win32,win64,uwp} [--cfg {Release,Debug}] [--compiler {gcc,clang}] [--shared] [--build] [--test] [--coverage]
3535
```
3636

37-
The following arguments are supported:
37+
| Argument | Values | Description |
38+
|---|---|---|
39+
| `--platform` | `linux_x64`, `linux_x86`, `osx`, `win32`, `win64`, `uwp` | Target platform (**required**) |
40+
| `--cfg` | `Release`, `Debug` | Build configuration (default: `Debug`) |
41+
| `--compiler` | `gcc`, `clang` | Compiler selection — **Linux only** (default: `clang`) |
42+
| `--shared` || Build a shared library (`.dll`/`.so`/`.dylib`) instead of a static library |
43+
| `--build` || Execute the build step |
44+
| `--test` || Execute the test step (not available with `--shared`) |
45+
| `--coverage` || Generate code coverage report (not available with `--shared`) |
3846

39-
* `linux_x64`
40-
* `linux_x86`
41-
* `osx`
42-
* `win32`
43-
* `win64`
47+
#### Examples
4448

45-
The generated project can be found inside the `build` folder.
49+
Static library (default):
50+
```sh
51+
python setup.py --platform osx --cfg Release --build --test
52+
```
53+
54+
Shared library (e.g. for Unity native plugin):
55+
```sh
56+
python setup.py --platform win64 --cfg Release --shared --build
57+
python setup.py --platform osx --cfg Release --shared --build
58+
python setup.py --platform linux_x64 --cfg Release --shared --build
59+
python setup.py --platform linux_x64 --compiler gcc --cfg Release --shared --build
60+
```
61+
62+
The generated project and build artifacts can be found inside the `build` folder. Packaged output (library + headers) is placed in `build/package/`.
4663

4764
Lib Dependencies
4865
----------------
@@ -59,23 +76,54 @@ Lib Dependencies
5976
Usage of the SDK
6077
----------------
6178

62-
Remember to include the GameAnalytics header file wherever you are using the SDK:
79+
### Static library (C++ API)
80+
81+
Include the GameAnalytics header file wherever you are using the SDK:
6382

6483
``` c++
6584
#include "GameAnalytics/GameAnalytics.h"
6685
```
6786

87+
### Shared library / Unity native plugin (C API)
88+
89+
When building with `--shared` / `-DGA_SHARED_LIB=ON`, the SDK exposes a C API via `GameAnalyticsExtern.h`. This is the intended integration path for Unity (P/Invoke) and other managed runtimes.
90+
91+
Include the header in your native wrapper:
92+
```c
93+
#include "GameAnalytics/GameAnalyticsExtern.h"
94+
```
95+
96+
From Unity C#, import via `[DllImport]`:
97+
```csharp
98+
[DllImport("GameAnalytics")]
99+
private static extern void gameAnalytics_initialize(string gameKey, string gameSecret);
100+
```
101+
102+
> **Note:** Always call `gameAnalytics_freeString(ptr)` on any `const char*` returned by the C API to avoid memory leaks.
103+
68104
### Custom log handler
69105
If you want to use your own custom log handler here is how it is done:
106+
107+
**C++ API:**
70108
``` c++
71-
void logHandler(const char *message, gameanalytics::EGALoggerMessageType type)
109+
void logHandler(std::string const& message, gameanalytics::EGALoggerMessageType type)
72110
{
73111
// add your logging in here
74112
}
75113

76114
gameanalytics::GameAnalytics::configureCustomLogHandler(logHandler);
77115
```
78116
117+
**C API (shared lib):**
118+
```c
119+
void myLogHandler(const char* message, GALoggerMessageType type)
120+
{
121+
// add your logging in here
122+
}
123+
124+
gameAnalytics_configureCustomLogHandler(myLogHandler);
125+
```
126+
79127
### Configuration
80128

81129
Example:

source/gameanalytics/GACommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace gameanalytics
8585
class GAState;
8686
}
8787

88-
constexpr const char* GA_VERSION_STR = "cpp 5.1.0";
88+
constexpr const char* GA_VERSION_STR = "cpp 5.2.0";
8989

9090
constexpr int MAX_CUSTOM_FIELDS_COUNT = 50;
9191
constexpr int MAX_CUSTOM_FIELDS_KEY_LENGTH = 64;

0 commit comments

Comments
 (0)