You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,8 +82,9 @@ One of the project's goals is to make it just as easy to work with C++ as it is
82
82
83
83
1. Download or clone this repo
84
84
2. Copy everything in `Unity/Assets` directory to your Unity project's `Assets` directory
85
-
3. Edit `NativeScriptTypes.json` and specify what parts of the Unity API you want access to from C++. Some examples are provided, but feel free to delete them if you're not using those features.
86
-
4. Edit `CppSource/Game.cpp` to create your game. Some example code is provided, but feel free to delete it. You can add more C++ source (`.cpp`) and header (`.h`) files here as your game grows.
85
+
3. Copy the `Unity/CppSource` directory to your Unity project directory
86
+
4. Edit `NativeScriptTypes.json` and specify what parts of the Unity API you want access to from C++. Some examples are provided, but feel free to delete them if you're not using those features.
87
+
5. Edit `Unity/CppSource/Game/Game.cpp` to create your game. Some example code is provided, but feel free to delete it. You can add more C++ source (`.cpp`) and header (`.h`) files here as your game grows.
87
88
88
89
# Building the C++ Plugin
89
90
@@ -93,7 +94,7 @@ One of the project's goals is to make it just as easy to work with C++ as it is
93
94
2. Create a directory for build files. Anywhere is fine.
94
95
3. Open the Terminal app in `/Applications/Utilities`
95
96
4. Execute `cd /path/to/your/build/directory`
96
-
5. Execute `cmake -G MyGenerator -DCMAKE_TOOLCHAIN_FILE=/path/to/your/project/Assets/iOS.cmake /path/to/your/project/Assets`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. Common choices include "Unix Makefiles" to build from command line or "Xcode" to use Apple's IDE.
97
+
5. Execute `cmake -G MyGenerator -DCMAKE_TOOLCHAIN_FILE=/path/to/your/project/CppSource/iOS.cmake /path/to/your/project/CppSource`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. Common choices include "Unix Makefiles" to build from command line or "Xcode" to use Apple's IDE.
97
98
6. The build scripts or IDE project files are now generated in your build directory
98
99
7. Build as appropriate for your generator. For example, execute `make` if you chose `Unix Makefiles` as your generator or open `NativeScript.xcodeproj` and click `Product > Build` if you chose Xcode.
99
100
@@ -103,7 +104,7 @@ One of the project's goals is to make it just as easy to work with C++ as it is
103
104
2. Create a directory for build files. Anywhere is fine.
104
105
3. Open the Terminal app in `/Applications/Utilities`
105
106
4. Execute `cd /path/to/your/build/directory`
106
-
5. Execute `cmake -G "MyGenerator" -DEDITOR=TRUE /path/to/your/project/Assets`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. Common choices include "Unix Makefiles" to build from command line or "Xcode" to use Apple's IDE. Remove `-DEDITOR=TRUE` for standalone builds.
107
+
5. Execute `cmake -G "MyGenerator" -DEDITOR=TRUE /path/to/your/project/CppSource`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. Common choices include "Unix Makefiles" to build from command line or "Xcode" to use Apple's IDE. Remove `-DEDITOR=TRUE` for standalone builds.
107
108
6. The build scripts or IDE project files are now generated in your build directory
108
109
7. Build as appropriate for your generator. For example, execute `make` if you chose `Unix Makefiles` as your generator or open `NativeScript.xcodeproj` and click `Product > Build` if you chose Xcode.
109
110
@@ -113,7 +114,7 @@ One of the project's goals is to make it just as easy to work with C++ as it is
113
114
2. Create a directory for build files. Anywhere is fine.
114
115
3. Open a Command Prompt by clicking the Start button, typing "Command Prompt", then clicking the app
115
116
4. Execute `cd /path/to/your/build/directory`
116
-
5. Execute `cmake -G "Visual Studio VERSION YEAR Win64" -DEDITOR=TRUE /path/to/your/project/Assets`. Replace `VERSION` and `YEAR` with the version of Visual Studio you want to use. To see the options, execute `cmake --help` and look at the list at the bottom. For example, use `"`Visual Studio 15 2017 Win64` for Visual Studio 2017. Any version, including Community, works just fine. Remove `-DEDITOR=TRUE` for standalone builds.
117
+
5. Execute `cmake -G "Visual Studio VERSION YEAR Win64" -DEDITOR=TRUE /path/to/your/project/CppSource`. Replace `VERSION` and `YEAR` with the version of Visual Studio you want to use. To see the options, execute `cmake --help` and look at the list at the bottom. For example, use `"`Visual Studio 15 2017 Win64` for Visual Studio 2017. Any version, including Community, works just fine. Remove `-DEDITOR=TRUE` for standalone builds.
117
118
6. The project files are now generated in your build directory
118
119
7. Open `NativeScript.sln` and click `Build > Build Solution`.
119
120
@@ -123,7 +124,7 @@ One of the project's goals is to make it just as easy to work with C++ as it is
123
124
2. Create a directory for build files. Anywhere is fine.
124
125
3. Open a terminal as appropriate for your Linux distribution
125
126
4. Execute `cd /path/to/your/build/directory`
126
-
5. Execute `cmake -G "MyGenerator" -DEDITOR=TRUE /path/to/your/project/Assets`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. The most common choice is "Unix Makefiles" to build from command line, but there are IDE options too. Remove `-DEDITOR=TRUE` for standalone builds.
127
+
5. Execute `cmake -G "MyGenerator" -DEDITOR=TRUE /path/to/your/project/CppSource`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. The most common choice is "Unix Makefiles" to build from command line, but there are IDE options too. Remove `-DEDITOR=TRUE` for standalone builds.
127
128
6. The build scripts or IDE project files are now generated in your build directory
128
129
7. Build as appropriate for your generator. For example, execute `make` if you chose `Unix Makefiles` as your generator.
129
130
@@ -133,13 +134,15 @@ One of the project's goals is to make it just as easy to work with C++ as it is
133
134
2. Create a directory for build files. Anywhere is fine.
134
135
3. Open a terminal (macOS, Linux) or Command Prompt (Windows)
135
136
4. Execute `cd /path/to/your/build/directory`
136
-
5. Execute `cmake -G MyGenerator -DANDROID_NDK=/path/to/android/ndk /path/to/your/project/Assets`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. To make a build for any platform other than Android, omit the `-DANDROID_NDK=/path/to/android/ndk` part.
137
+
5. Execute `cmake -G MyGenerator -DANDROID_NDK=/path/to/android/ndk /path/to/your/project/CppSource`. Replace `MyGenerator` with the generator of your choice. To see the options, execute `cmake --help` and look at the list at the bottom. To make a build for any platform other than Android, omit the `-DANDROID_NDK=/path/to/android/ndk` part.
137
138
6. The build scripts or IDE project files are now generated in your build directory
138
139
7. Build as appropriate for your generator. For example, execute `make` if you chose `Unix Makefiles` as your generator.
139
140
140
-
# Configuring the Code Generator
141
+
# The Code Generator
141
142
142
-
Open `NativeScriptTypes.json` and notice the existing examples. Add on to this file to expose more C# APIs from Unity, .NET, or custom DLLs to your C++ code.
143
+
To run the code generator, choose `NativeScript > Generate Bindings` from the Unity editor.
144
+
145
+
To configure the code generator, open `NativeScriptTypes.json` and notice the existing examples. Add on to this file to expose more C# APIs from Unity, .NET, or custom DLLs to your C++ code.
143
146
144
147
The code generator supports:
145
148
@@ -182,7 +185,7 @@ The JSON file is laid out as follows:
182
185
183
186
# Updating To A New Version
184
187
185
-
To update to a new version of this project, overwrite your Unity project's `Assets/NativeScript` directory with this project's `Unity/Assets/NativeScript` directory.
188
+
To update to a new version of this project, overwrite your Unity project's `Assets/NativeScript` directory with this project's `Unity/Assets/NativeScript` directory and re-run the code generator.
0 commit comments