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
_Forked from [Google's C++ coding style](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) rev. 3.274_
6
8
@@ -144,15 +146,15 @@ The following rules will guide you through the various pitfalls of using header
144
146
145
147
All header files should have `#define` guards to prevent multiple inclusion. The format of the symbol name should be `<PROJECT>_<PATH>_<FILE>_H_.`
146
148
147
-
To guarantee uniqueness, they should be based on the full path in a project's source tree. For example, the file `cocos2dx/sprites_nodes/CCSprite.h` in project foo should have the following guard:
149
+
To guarantee uniqueness, they should be based on the full path in a project's source tree. For example, the file `axmol/core/2d/Sprite.h` in project foo should have the following guard:
148
150
149
151
```cpp
150
-
#ifndefCOCOS2DX_SPRITE_NODES_CCSPRITE_H_
151
-
#define COCOS2DX_SPRITE_NODES_CCSPRITE_H_
152
+
#ifndefAX_CORE_2D_SPRITE_H_
153
+
#define AX_CORE_2D_SPRITE_H_
152
154
153
155
...
154
156
155
-
#endif//COCOS2DX_SPRITE_NODES_CCSPRITE_H_
157
+
#endif//AX_CORE_2D_SPRITE_H_
156
158
```
157
159
158
160
```cpp
@@ -2844,6 +2846,3 @@ The point of having style guidelines is to have a common vocabulary of coding so
2844
2846
2845
2847
OK, enough writing about writing code; the code itself is much more interesting. Have fun!
- powershell-7 is recommended, it's support Windows,macOS,Linux
7
-
- How to Install:
8
-
- Quick Install
9
-
- macOS, Ubuntu, ArchLinux: you can simply run `1k/install-pwsh.sh` in axmol root directory [`Recommended`]
10
-
- win10+, system installed PowerShell 5.x should works, but you need run command `Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force` to allow run powershell script file
11
-
- Manually Install: [installing-powershell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell) or download from [github release](https://github.com/PowerShell/PowerShell/releases)
12
-
-[cmake-3.28.1+](https://cmake.org/download/), install it on your host system manully is recommended(ensure add cmake bin to system `PATH``), otherwise the `axmol build` will auto setup it to `tools/external/cmake`
5
+
-**PowerShell**: used to install Axmol. PowerShell 7 is recommended, it supports Windows, macOS and Linux.
6
+
- Quick installation:
7
+
- macOS, Ubuntu, ArchLinux: run `1k/install-pwsh.sh` in `axmol` root directory (recommended).
8
+
- Windows 10+: system installed PowerShell 5.x should work, but in that case you'll need to run the command `Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force` in order to allow PowerShell script file to run.
- Manual installation is recommended ([download](https://cmake.org/download/)). Make sure to add CMake bin to the system `PATH`, otherwise `axmol build` will auto-setup it to `tools/external/cmake`.
13
12
14
13
## Prerequisites
15
14
16
-
1. Enter `axmol` root directory
17
-
2. Run `pwsh setup.ps1`, restart the console after it has finished for environment variables to take effect
18
-
3. Ensure C/C++ compiler toolset installed on your host machine
19
-
- Windows: visual studio 2022 with desktop workflow
20
-
- macOS: xcode14.2+
21
-
- Linux: GCC(G++)
15
+
1. Download or clone Axmol from GitHub ([https://github.com/axmolengine/axmol](https://github.com/axmolengine/axmol)).
16
+
2. Enter `axmol` root directory.
17
+
3. Run `pwsh setup.ps1`. Restart the console after it has finished for environment variables to take effect.
18
+
4. Ensure that the C / C++ compiler toolset is installed on your host machine.
19
+
- Windows: Visual Studio 2022 with desktop workflow
20
+
- macOS: XCode 14.2+
21
+
- Linux: GCC (G++)
22
22
23
-
## Creating A New Project
23
+
## Creating a new project
24
24
25
-
Using a powershell console window, an example of a command to generate a new project is as follows:
25
+
Enter to PowerShell (`pwsh`). This is the command to generate a new project:
26
26
27
27
```axmol new -p YOUR.UNIQUE.ID -d PROJECT_PATH -l [cpp|lua] [--portrait] PROJECT_NAME```
28
28
29
-
Type `axmol new --help` at the command line for more options you can pass to `axmol new`
29
+
Note: Avoid using special characters in `YOUR.UNIQUE.ID`
30
+
31
+
Type `axmol new --help` at the command line for more options.
For android: it will search the NDK in sdk_root first, which is specified by env ANDROID_HOME.
59
+
If not found, by default it will install ndk-r16b, or you can specify by the option: -cc 'ndk-r23c'
60
+
-a: build architecture: x86,x64,armv7,arm64
61
+
-d: the build workspace. For example, the project root which contains root CMakeLists.txt, empty use script run working directory (aka cwd)
62
+
-cc: The C/C++ compiler toolchain: clang, msvc or gcc(mingw). Leave it empty tou use the current installed default.
61
63
msvc: msvc-120, msvc-141
62
64
ndk: ndk-r16b, ndk-r16b+
63
-
-xt: cross build tool, default: cmake, for android can be gradlew, can be path of cross build tool program
64
-
-xc: cross build tool configure options: i.e. -xc '-Dbuild'
65
-
-xb: cross build tool build options: i.e. -xb '--config','Release'
66
-
-prefix: the install location for missing tools in system, default is "$HOME/build1k"
67
-
-sdk: specific windows sdk version, i.e. -sdk '10.0.19041.0', leave empty, cmake will autochoose latest avaiable
68
-
-setupOnly: this param present, only execute step: setup
69
-
-configOnly: if this param present, will skip build step
65
+
-xt: cross build tool. Default: cmake. For Android it can be gradlew, or it can be the path of the cross-build tool program
66
+
-xc: cross build tool configure options. For example, -xc '-Dbuild'
67
+
-xb: cross build tool build options. For example, -xb '--config','Release'
68
+
-prefix: the install location for missing tools in the system. Default is "$HOME/build1k"
69
+
-sdk: specific Windows SDK version. For example, -sdk '10.0.19041.0'. Leaved empty, cmake will auto-choose the latest available
70
+
-setupOnly: this parameter is present, it only will execute the 'setup' step
71
+
-configOnly: if this parameter is present, it will skip the 'build' step
70
72
```
71
73
72
-
## Quick build engine for host targets?
74
+
## How to quick build the engine for host targets
75
+
76
+
Go to `axmol` root directory and run `build.ps1` without any parameters. It will build `HelloCpp` by default.
73
77
74
-
Goto axmol root directory, double click or run `build.ps1` without any parameters, it will build `HelloCpp` by default
78
+
## How to quick build a test project (e.g. 'cpp-tests')
75
79
76
-
## Quick build a test project e.g. 'cpp-tests'?
77
-
Using a powershell console window, goto `axmol\tests\<testdir e.g. 'cpp-tests'>` directory, perform`axmol build -p android -a arm64`, it will build `cpp-tests` for android.
80
+
Using a PowerShell console window (command `pwsh`), go to `axmol\tests\<testdir e.g. 'cpp-tests'>` directory and perform `axmol build -p android -a arm64`. It will build `cpp-tests` for Android.
78
81
79
-
## Manually build with cmake
82
+
## Manually build with CMake
80
83
81
-
### Windows (Visual Studio)
84
+
### Windows (Visual Studio 2022)
82
85
83
-
1. Install [CMake](https://cmake.org/) 3.27.4+
84
-
2. Install Visual Studio 2022 (VS2019 should be support, but VS2022 is recommended)
85
-
3. Create a new project as shown [here](#creating-a-new-project)
86
-
4. In a console window, navigate into the root directory of the project you created in the previous step
##### Creating the Visual Studio solution for all axmol test projects (Win/UWP)
114
+
#### Creating the Visual Studio solution for all Axmol test projects (Win / UWP)
115
+
116
+
First, perform the steps 1. to 6., or the Windows UWP step above (if not is already done).
109
117
110
-
- Perform steps 1.-6. or the Windows UWP step above (if not done)
111
118
7. Open the solution (".\build\axmol.sln" or ".\build_uwp\axmol.sln") in Visual Studio and build any of the test projects via the IDE.
112
119
113
-
#### Improve 'Visual Studio' workflow, support linking with engine prebuilt libs
120
+
#### Improving the Visual Studio workflow, supporting linking with engine prebuilt libraries
114
121
115
-
See [windows workflow guide](https://github.com/axmolengine/axmol/issues/564)
122
+
Please see the [Windows workflow guide](https://github.com/axmolengine/axmol/issues/564).
116
123
117
124
### Android (Android Studio)
118
125
119
-
1. Install Android Studio 2023.1.1+
120
-
2. When starting Android Studio for the first time, it will guide you to install the SDK and other tools, so ensure that you do install them.
121
-
3. Start Android and choose [Open an existing Android Studio Project] and select your project. For example, the existing cpp-test project located in ```axmol\tests\cpp-tests\proj.android```
122
-
4. Start Android Studio and Open [Tools][SDKManager], then switch to ```SDK Tools```, check the ```Show Package Details```, choose the following tools and click the button ```Apply``` to install them:
126
+
1. Install [Android Studio 2023.1.1+](https://developer.android.com/studio).
127
+
2. When starting Android Studio for the first time, it will guide you through the installation of the SDK and other tools. Please make sure that you do install them.
128
+
3. Start Android Studio and choose [Open an existing Android Studio Project] and select your project. For example, the existing `cpp-test` project located in `axmol\tests\cpp-tests\proj.android`.
129
+
4. Start Android Studio and open 'Tools' -> 'SDKManager', then switch to 'SDK Tools', check the 'Show Package Details' field, and choose the following tools clicking the button 'Apply' to install them:
123
130
- Android SDK Platform 34
124
131
- Android Gradle Plugin (AGP) 8.2.1
125
132
- Android SDK Build-Tools 34.0.0 match with AGP, refer to: <https://developer.android.com/studio/releases/gradle-plugin>
126
133
- Gradle 8.5
127
134
- NDK r23c
128
-
5. Wait for ```Gradle sync``` finish.
129
-
6. Note: If you use non-sdk provided CMake edition, you will need to download ```ninja``` from <https://github.com/ninja-build/ninja/releases>, and copy ```ninja.exe``` to cmake's bin directory
135
+
5. Wait for the `Gradle sync` to finish.
136
+
137
+
Note: if you use non-SDK provided CMake, you will need to download `ninja` from <https://github.com/ninja-build/ninja/releases>, and copy `ninja.exe` to CMake's bin directory.
130
138
131
139
### Android Studio (without Android Studio)
132
140
133
-
1. Download command-tools from <https://developer.android.com/studio#command-tools>, for example: https://dl.google.com/android/repository/commandlinetools-win-9477386_latest.zip
134
-
2. Install Android devtools (for example in windows)
5. Generate the relevant xcode project using one of the following commands:
156
-
- for ios arm64:
163
+
5. Generate the relevant XCode project using one of the following commands:
164
+
- for iOS arm64:
157
165
```axmol build -p ios -a arm64 -c```
158
-
- for ios simulator x86_64:
166
+
- for iOS simulator x86_64:
159
167
```axmol build -p ios -a x64 -c```
160
-
- for tvos arm64:
168
+
- for tvOS arm64:
161
169
```axmol build -p tvos -a arm64 -c```
162
-
- for tvos simulator x86_64:
170
+
- for tvOS simulator x86_64:
163
171
```axmol build -p tvos -a x64 -c```
164
-
- for macos x86_64(Intel)
172
+
- for macOS x86_64(Intel)
165
173
```axmol build -p osx -c```
166
-
- for macos arm64(M1)
174
+
- for macOS arm64(M1)
167
175
```axmol build -p osx -a arm64 -c```
168
176
169
-
6. After cmake finishes generating, you can open the xcode project at ```build_${plat}_${arch}``` folder and run cpp-tests or other test targets, for osx x64 should be `build_x64`
170
-
7. Notes
171
-
-**The code signing is required to run the ios/tvos app on your device, just change the bundle identifier until the auto manage signing is solved**
172
-
-**axmol only provides arm64, x86_64 prebuilt libraries for ios/tvos**
177
+
6. After CMake finishes generating, you can open the XCode project at `build_${plat}_${arch}` folder and run cpp-tests or other test targets. For OSC x64 should be `build_x64`.
178
+
7. Notes:
179
+
-**Code signing is required to run the iOS / tvOS app on your device. Just change the bundle identifier until the auto manage signing is solved.**
180
+
-**Axmol only provides arm64, x86_64 prebuilt libraries for iOS / tvOS.**
173
181
174
182
### Linux (VSCode)
175
183
176
-
1.run`pwsh ./setup.ps1`
177
-
2. Open axmol source folder with vscode
178
-
3. Install C++, CMake extensions for vscode
179
-
4.vscode will auto prompt you to choose toolset for building, just select gcc match with your system installed default gcc
184
+
1.Run`pwsh ./setup.ps1`.
185
+
2. Open axmol source folder with VSCode.
186
+
3. Install C++, CMake extensions for VSCode.
187
+
4.VSCode will auto prompt you to choose the toolset for building. Select the gcc matching with your system installed default gcc:
180
188
```sh
181
189
# check gcc version
182
190
gcc -v
183
191
```
184
192
i.e. `gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)`
185
-
5. vscode will run cmake config automatically, after done, click `build`in taskbar, you can also choose specific target
186
-
to build and run
187
-
188
-
189
-
Notes: if you needs debug by vscode, remember ensure choose `CMake: [Debug]`in vscode taskbar
193
+
5. VSCode will run CMake config automatically. After done, click `build`in taskbar. You can also choose specific target
194
+
to build and run.
190
195
196
+
Notes: if you need debug in VSCode, remember to choose `CMake: [Debug]`in the WSCode taskbar.
0 commit comments