Skip to content

Commit

Permalink
Merge pull request #64 from altmp/rc
Browse files Browse the repository at this point in the history
Merge rc to release

Former-commit-id: e7057a0
  • Loading branch information
LeonMrBonnie authored Oct 1, 2021
2 parents 7392961 + a1d4a31 commit ed4e4e2
Show file tree
Hide file tree
Showing 298 changed files with 14,819 additions and 221 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & deploy
name: Build & deploy server
on:
push:
branches-ignore:
Expand Down Expand Up @@ -30,6 +30,7 @@ jobs:
- name: Build
shell: cmd
run: |
cd server
mkdir build
pushd build
cmake -G"Visual Studio 16" -A x64 -DJS_MODULE_VERSION=%VERSION% ..
Expand All @@ -44,7 +45,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: js-module-windows
path: ./dist/
path: ./server/dist/

build-linux:
name: Build linux release
Expand All @@ -66,6 +67,7 @@ jobs:
- name: Build
run: |
cd server
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-8 g++-8
Expand All @@ -82,7 +84,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: js-module-linux
path: ./dist/
path: ./server/dist/

deploy-cdn:
name: Deploy release to alt:V CDN
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/test-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test client changes
on:
push:
paths:
- "client/**"
pull_request:
paths:
- "client/**"

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Fetch Submodules
shell: bash
run: |
git submodule init
git submodule update
- name: Generate
shell: bash
run: |
cd client
cmake . -BBUILD
- name: Build
shell: bash
run: |
cd client
cmake --build BUILD --config $BUILD_TYPE
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Test changes
on: [pull_request]
name: Test server changes
on:
push:
paths:
- "server/**"
pull_request:
paths:
- "server/**"

jobs:
test-windows:
Expand All @@ -15,6 +21,7 @@ jobs:
- name: Build
shell: cmd
run: |
cd server
mkdir build
pushd build
cmake -G"Visual Studio 16" -A x64 ..
Expand All @@ -35,6 +42,7 @@ jobs:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-8 g++-8
cd server
mkdir build-linux && cd build-linux
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-8 ..
cmake --build . --config Release
7 changes: 2 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "src/helpers"]
path = src/helpers
url = https://github.com/altmp/v8-helpers.git
[submodule "src/cpp-sdk"]
path = src/cpp-sdk
[submodule "shared/deps/cpp-sdk"]
path = shared/deps/cpp-sdk
url = https://github.com/altmp/cpp-sdk.git
33 changes: 33 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"configurations": [
{
"name": "Win32 Static",
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"ALT_CLIENT_API",
"ALT_CLIENT",
"ALT_SERVER_API",
"ALT_SERVER",
"JS_MODULE_VERSION"
],
"windowsSdkVersion": "10.0.19041.0",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"configurationProvider": "ms-vscode.cmake-tools",
"includePath": [
"client/src",
"client/BUILD/_deps/altv-js-deps-src/include",
"server/src",
"server/deps",
"server/deps/nodejs/include",
"server/deps/nodejs/deps/v8/include",
"server/deps/nodejs/deps/uv/include",
"shared/",
"shared/deps"
]
}
],
"version": 4
}
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Attach",
"type": "cppvsdbg",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
81 changes: 81 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"files.associations": {
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"filesystem": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xmemory0": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"deque": "cpp",
"queue": "cpp",
"sstream": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"set": "cpp",
"bit": "cpp",
"charconv": "cpp",
"clocale": "cpp",
"format": "cpp",
"forward_list": "cpp",
"optional": "cpp",
"stop_token": "cpp"
}
}
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build client",
"type": "shell",
"command": "cd client && build-debug.bat",
"problemMatcher": ["$msCompile"],
"group": {
"kind": "build",
"isDefault": true
},
},
{
"label": "Build server",
"type": "shell",
"command": "cd server && ./build",
"windows": {
"command": "cd server && build.bat"
},
"problemMatcher": ["$msCompile"],
"group": {
"kind": "build",
"isDefault": true
},
}
]
}
41 changes: 16 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
# altv-js-module
JS module for alt:V Multiplayer. Powered by NodeJS & v8
# alt:V JS module

## Troubleshooting
**Problem**: I want to build a native Node.js addon with
[node-gyp](https://github.com/nodejs/node-gyp) but the alt:V server can not load
it and responds with following error:
```
./altv-server: symbol lookup error: /usr/share/addon/binding.node: undefined symbol: node_module_register
```
**Solution**: Add a C++ file to your project with following content and include
it the ```sources``` in your ```binding.gyp``` file.
```cpp
#include <node.h>
#include <dlfcn.h>
Repository containing the JS module for [alt:V multiplayer](https://altv.mp/).

extern "C" NODE_EXTERN void node_module_register(void* mod) {
auto base_ptr = dlopen("libnode.so.72", RTLD_NOW | RTLD_GLOBAL);
if (base_ptr == nullptr) {
return;
}
auto register_func = reinterpret_cast<decltype(&node_module_register)>(dlsym(base_ptr, "node_module_register"));
if (register_func == nullptr) {
return;
}
register_func(mod);
}
## Structure

| Directory | Description |
| ------------------ | ------------------------------------------------------- |
| [/client](/client) | Clientside JS module powered by V8 |
| [/server](/server) | Serverside JS module powered by Node.js |
| [/shared](/shared) | Shared code for the clientside & serverside module |
| [/docs](/docs) | Documentation for the internal workings of the module |

## Contributions

All contributions are greatly appreciated.
If there are any questions or you would like to discuss a feature,
contact the *module maintainer*.
11 changes: 11 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Build files
BUILD/
deps/v8/
dist/

# Editors
.vs/
.vscode/settings.json

# Extra
tools/extra.bat
Loading

0 comments on commit ed4e4e2

Please sign in to comment.