Skip to content

Commit 9bf11e6

Browse files
authored
Merge pull request #146 from altmp/dev
Merge dev into rc
2 parents 8936a3a + bf845f8 commit 9bf11e6

File tree

3,198 files changed

+1153015
-20825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,198 files changed

+1153015
-20825
lines changed

.github/workflows/build-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
cd ..
102102
mkdir -p dist/modules/js-module
103103
cp ./build-linux/libjs-module.so dist/modules/js-module
104-
cp ./deps/nodejs/lib/libnode.so.83 dist/modules/js-module
104+
cp ./deps/nodejs/lib/libnode.so.102 dist/modules/js-module
105105
env:
106106
VERSION: ${{ steps.version.outputs.VERSION }}
107107

.github/workflows/test-client.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ on:
33
push:
44
paths:
55
- "client/**"
6+
- "shared/**"
67
pull_request:
78
paths:
89
- "client/**"
10+
- "shared/**"
911

1012
env:
1113
BUILD_TYPE: Release
@@ -16,7 +18,10 @@ jobs:
1618
runs-on: windows-2019
1719

1820
steps:
19-
- uses: actions/checkout@v2
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
with:
24+
submodules: recursive
2025

2126
- name: Create LFS file list
2227
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
@@ -41,7 +46,7 @@ jobs:
4146
shell: bash
4247
run: |
4348
cd client
44-
cmake . -BBUILD
49+
cmake . -BBUILD -DDYNAMIC_BUILD=1
4550
4651
- name: Build
4752
shell: bash

.github/workflows/test-server.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ on:
33
push:
44
paths:
55
- "server/**"
6+
- "shared/**"
67
pull_request:
78
paths:
89
- "server/**"
10+
- "shared/**"
911

1012
jobs:
1113
test-server-windows:

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated
2+
*.gen
3+
4+
node_modules/

.vscode/launch.json

-14
This file was deleted.

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
"format": "cpp",
7777
"forward_list": "cpp",
7878
"optional": "cpp",
79-
"stop_token": "cpp"
79+
"stop_token": "cpp",
80+
"*.gen": "cpp"
8081
},
8182
"editor.defaultFormatter": "xaver.clang-format",
8283
"editor.formatOnSave": true

.vscode/tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{
1717
"label": "Build server",
1818
"type": "shell",
19-
"command": "cd server && ./build",
19+
"command": "cd server && ./build.sh",
2020
"windows": {
2121
"command": "cd server && build.bat"
2222
},

bindings.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference types="@altv/types-shared"/>
2+
/// <reference types="@altv/types-natives"/>
3+
import * as altShared from "alt-shared";
4+
import * as altNatives from "natives";
5+
6+
declare global {
7+
export const alt: typeof altShared;
8+
export const native: typeof altNatives;
9+
}

client/CMakeLists.txt

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required (VERSION 3.19)
2-
include(cmake/GitUtils.cmake)
32
include(FetchContent)
43
include(cmake/DepsDownload.cmake)
4+
include(../shared/cmake/GenerateBindings.cmake)
55

66
project(altv-client-js)
77

@@ -10,8 +10,7 @@ set(ALTV_JS_DEPS_DIR ${PROJECT_SOURCE_DIR}/deps)
1010
# Fetch deps
1111
# v8
1212
message("alt:V JS - Fetching v8 deps, can take a while")
13-
14-
DownloadDeps(${ALTV_JS_DEPS_DIR})
13+
DownloadDeps()
1514

1615
# cpp-sdk
1716
if(NOT ALTV_JS_CPP_SDK)
@@ -42,6 +41,9 @@ endmacro()
4241
GroupSources(${PROJECT_SOURCE_DIR}/src "Source Files")
4342
GroupSources("../shared" "Shared Files")
4443

44+
make_includable("src/bootstrap.js" "src/bootstrap.js.gen")
45+
GenerateBindings()
46+
4547
include_directories(
4648
${ALTV_JS_CPP_SDK}
4749
${ALTV_JS_DEPS_DIR}/v8/include
@@ -86,6 +88,8 @@ if(WIN32 AND MSVC)
8688
endif()
8789

8890
if(DYNAMIC_BUILD)
91+
include(${ALTV_JS_CPP_SDK}/cpp-sdk/CMakeLists.txt)
92+
8993
## SHARED
9094
add_library(
9195
${PROJECT_NAME} SHARED
@@ -102,6 +106,8 @@ if(DYNAMIC_BUILD)
102106
target_link_libraries(${PROJECT_NAME} PRIVATE
103107
${ALTV_JS_LINKS}
104108
)
109+
110+
add_dependencies(${PROJECT_NAME} alt-sdk)
105111
else()
106112
## STATIC
107113
add_library(
@@ -118,6 +124,8 @@ else()
118124
target_link_libraries(${PROJECT_NAME}-static PRIVATE
119125
${ALTV_JS_LINKS}
120126
)
127+
128+
add_dependencies(${PROJECT_NAME}-static alt-sdk)
121129
endif()
122130

123131
if(ALTV_JS_DEINIT_CPPSDK)

client/cmake/DepsDownload.cmake

+22-41
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,36 @@
1+
include(../shared/cmake/DepsHelpers.cmake)
12

23
# Set this to false, when using a custom v8 build for testing
34
set(__deps_check_enabled true)
45

5-
function(DownloadDeps basePath)
6-
set(__deps_release_lib "${basePath}/v8/lib/Release/v8_monolith.lib")
7-
set(__deps_debug_lib "${basePath}/v8/lib/Debug/v8_monolith.lib")
8-
set(__deps_headers "${basePath}/v8/include/headers.zip")
9-
set(__deps_update_file "${basePath}/v8/update.json")
6+
function(DownloadDeps)
7+
set(__base_path "${PROJECT_SOURCE_DIR}/deps/v8")
8+
9+
GetBranchAndOS(__deps_branch __deps_os_path_name)
10+
set(__deps_url_base_path "https://cdn.altv.mp/deps/v8/dev") # TODO: Use actual branch?
1011

1112
if(__deps_check_enabled)
12-
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/update.json" ${__deps_update_file})
13-
file(READ ${__deps_update_file} __deps_update_json)
14-
string(JSON __deps_hashes GET ${__deps_update_json} hashList)
15-
file(REMOVE ${__deps_update_file})
16-
17-
if(EXISTS ${__deps_release_lib})
18-
file(SHA1 ${__deps_release_lib} __deps_release_checksum)
19-
else()
20-
set(__deps_release_checksum 0)
21-
endif()
22-
string(JSON __deps_release_checksum_cdn GET ${__deps_hashes} v8_monolith.lib)
23-
if(NOT ${__deps_release_checksum} STREQUAL ${__deps_release_checksum_cdn})
24-
message("Downloading release binary...")
25-
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/v8_monolith.lib" ${__deps_release_lib})
26-
endif()
13+
message("Checking release binaries...")
14+
15+
GetCDNInfo("${__deps_url_base_path}/${__deps_os_path_name}/Release" __deps_release_hashes __deps_current_version)
16+
17+
DownloadFile("v8_monolith.lib" "${__base_path}/lib/Release" "${__deps_os_path_name}/Release" ${__deps_release_hashes})
2718

2819
# Only download debug binary in Debug builds
2920
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
30-
if(EXISTS ${__deps_debug_lib})
31-
file(SHA1 ${__deps_debug_lib} __deps_debug_checksum)
32-
else()
33-
set(__deps_debug_checksum 0)
34-
endif()
35-
string(JSON __deps_debug_checksum_cdn GET ${__deps_hashes} v8_monolithd.lib)
36-
if(NOT ${__deps_debug_checksum} STREQUAL ${__deps_debug_checksum_cdn})
37-
message("Downloading debug binary...")
38-
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/v8_monolithd.lib" ${__deps_debug_lib})
39-
endif()
40-
endif()
21+
message("Checking debug binaries...")
22+
23+
GetCDNInfo("${__deps_url_base_path}/${__deps_os_path_name}/Debug" __deps_debug_hashes __deps_current_version)
4124

42-
if(EXISTS ${__deps_headers})
43-
file(SHA1 ${__deps_headers} __deps_headers_checksum)
44-
else()
45-
set(__deps_headers_checksum 0)
25+
DownloadFile("v8_monolith.lib" "${__base_path}/lib/Debug" "${__deps_os_path_name}/Debug" ${__deps_debug_hashes})
4626
endif()
47-
string(JSON __deps_headers_checksum_cdn GET ${__deps_hashes} headers.zip)
48-
if(NOT ${__deps_headers_checksum} STREQUAL ${__deps_headers_checksum_cdn})
49-
message("Downloading headers...")
50-
file(DOWNLOAD "https://cdn.altv.mp/deps/v8/dev/headers.zip" ${__deps_headers})
51-
message("Extracting headers...")
52-
file(ARCHIVE_EXTRACT INPUT ${__deps_headers} DESTINATION "${basePath}")
27+
28+
GetCDNInfo("${__deps_url_base_path}" __deps_headers_hashes __deps_current_version)
29+
DownloadFile("headers.zip" "${__base_path}/include" "" ${__deps_headers_hashes})
30+
file(ARCHIVE_EXTRACT INPUT "${__base_path}/include/headers.zip" DESTINATION "${__base_path}/..")
31+
32+
if(__deps_current_version)
33+
message("V8 deps version: ${__deps_current_version}")
5334
endif()
5435
endif()
5536
endfunction()

0 commit comments

Comments
 (0)