koffi 0.9.10 → 0.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +111 -0
- package/package.json +6 -5
- package/src/index.js +19 -0
- package/build/koffi.node +0 -0
package/CMakeLists.txt
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# This program is free software: you can redistribute it and/or modify
|
|
2
|
+
# it under the terms of the GNU Affero General Public License as published by
|
|
3
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
4
|
+
# (at your option) any later version.
|
|
5
|
+
#
|
|
6
|
+
# This program is distributed in the hope that it will be useful,
|
|
7
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
8
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
9
|
+
# GNU Affero General Public License for more details.
|
|
10
|
+
#
|
|
11
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
12
|
+
# along with this program. If not, see https://www.gnu.org/licenses/.
|
|
13
|
+
|
|
14
|
+
cmake_minimum_required(VERSION 3.11)
|
|
15
|
+
project(koffi C CXX ASM)
|
|
16
|
+
|
|
17
|
+
find_package(CNoke)
|
|
18
|
+
|
|
19
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
20
|
+
if(MSVC)
|
|
21
|
+
enable_language(ASM_MASM)
|
|
22
|
+
endif()
|
|
23
|
+
|
|
24
|
+
# ---- Koffi ----
|
|
25
|
+
|
|
26
|
+
set(KOFFI_SRC
|
|
27
|
+
src/call_arm32.cc
|
|
28
|
+
src/call_arm64.cc
|
|
29
|
+
src/call_x64_sysv.cc
|
|
30
|
+
src/call_x64_win.cc
|
|
31
|
+
src/call_x86.cc
|
|
32
|
+
src/ffi.cc
|
|
33
|
+
src/util.cc
|
|
34
|
+
vendor/libcc/libcc.cc
|
|
35
|
+
)
|
|
36
|
+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
37
|
+
if(WIN32)
|
|
38
|
+
list(APPEND KOFFI_SRC src/call_x64_win_fwd.asm)
|
|
39
|
+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
|
|
40
|
+
list(APPEND KOFFI_SRC src/call_arm64_fwd.S)
|
|
41
|
+
else()
|
|
42
|
+
list(APPEND KOFFI_SRC src/call_x64_sysv_fwd.S)
|
|
43
|
+
endif()
|
|
44
|
+
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
45
|
+
if(WIN32)
|
|
46
|
+
list(APPEND KOFFI_SRC src/call_x86_fwd.asm)
|
|
47
|
+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[3456]86|x86|AMD64")
|
|
48
|
+
list(APPEND KOFFI_SRC src/call_x86_fwd.S)
|
|
49
|
+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv[678]l")
|
|
50
|
+
list(APPEND KOFFI_SRC src/call_arm32_fwd.S)
|
|
51
|
+
endif()
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
add_node_addon(NAME koffi SOURCES ${KOFFI_SRC})
|
|
55
|
+
target_include_directories(koffi PRIVATE . vendor/node-addon-api)
|
|
56
|
+
|
|
57
|
+
target_compile_definitions(koffi PRIVATE FELIX_TARGET=koffi NAPI_DISABLE_CPP_EXCEPTIONS)
|
|
58
|
+
if(WIN32)
|
|
59
|
+
target_compile_definitions(koffi PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
|
|
60
|
+
target_link_libraries(koffi PRIVATE ws2_32)
|
|
61
|
+
endif()
|
|
62
|
+
if(MSVC)
|
|
63
|
+
target_compile_options(koffi PRIVATE /wd4200)
|
|
64
|
+
else()
|
|
65
|
+
target_compile_options(koffi PRIVATE -fno-exceptions -Wno-missing-field-initializers
|
|
66
|
+
-fno-strict-aliasing)
|
|
67
|
+
endif()
|
|
68
|
+
|
|
69
|
+
# ---- Raylib ----
|
|
70
|
+
|
|
71
|
+
add_library(raylib SHARED
|
|
72
|
+
vendor/raylib/src/rcore.c
|
|
73
|
+
vendor/raylib/src/rshapes.c
|
|
74
|
+
vendor/raylib/src/rtextures.c
|
|
75
|
+
vendor/raylib/src/rtext.c
|
|
76
|
+
vendor/raylib/src/rmodels.c
|
|
77
|
+
vendor/raylib/src/utils.c
|
|
78
|
+
vendor/raylib/src/rglfw.c
|
|
79
|
+
vendor/raylib/src/raudio.c
|
|
80
|
+
)
|
|
81
|
+
set_target_properties(raylib PROPERTIES PREFIX "")
|
|
82
|
+
target_include_directories(raylib PRIVATE vendor/raylib/src/external/glfw/include)
|
|
83
|
+
target_compile_definitions(raylib PRIVATE PLATFORM_DESKTOP GRAPHICS_API_OPENGL_21
|
|
84
|
+
BUILD_LIBTYPE_SHARED NDEBUG)
|
|
85
|
+
|
|
86
|
+
if(WIN32)
|
|
87
|
+
target_compile_definitions(raylib PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
|
|
88
|
+
target_link_libraries(raylib PRIVATE winmm)
|
|
89
|
+
endif()
|
|
90
|
+
if(MSVC)
|
|
91
|
+
target_compile_options(raylib PRIVATE /wd4244 /wd4305)
|
|
92
|
+
else()
|
|
93
|
+
target_compile_options(raylib PRIVATE -Wno-sign-compare -Wno-old-style-declaration
|
|
94
|
+
-Wno-unused-function -Wno-missing-field-initializers
|
|
95
|
+
-Wno-unused-value -Wno-implicit-fallthrough -Wno-stringop-overflow
|
|
96
|
+
-Wno-unused-result)
|
|
97
|
+
endif()
|
|
98
|
+
|
|
99
|
+
# ---- SQLite ----
|
|
100
|
+
|
|
101
|
+
add_library(sqlite3 SHARED vendor/sqlite3/sqlite3.c)
|
|
102
|
+
set_target_properties(sqlite3 PROPERTIES PREFIX "")
|
|
103
|
+
|
|
104
|
+
if(WIN32)
|
|
105
|
+
target_compile_definitions(sqlite3 PRIVATE SQLITE_API=__declspec\(dllexport\))
|
|
106
|
+
endif()
|
|
107
|
+
|
|
108
|
+
# ---- Misc ----
|
|
109
|
+
|
|
110
|
+
add_library(misc SHARED test/tests/misc.c)
|
|
111
|
+
set_target_properties(misc PROPERTIES PREFIX "")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koffi",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.14",
|
|
4
4
|
"description": "Fast and simple FFI (foreign function interface) for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foreign",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"url": "https://github.com/Koromix/luigi.git"
|
|
17
17
|
},
|
|
18
18
|
"author": "Niels Martignène <niels.martignene@protonmail.com>",
|
|
19
|
-
"main": "
|
|
19
|
+
"main": "src/index.js",
|
|
20
20
|
"scripts": {
|
|
21
|
-
"install": "cnoke
|
|
21
|
+
"install": "cnoke",
|
|
22
22
|
"test": "node test/test.js"
|
|
23
23
|
},
|
|
24
24
|
"license": "AGPL-3.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"cnoke": "^0.9.
|
|
26
|
+
"cnoke": "^0.9.24"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"chalk": "^4.1.2",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"test/test.js",
|
|
38
38
|
"vendor",
|
|
39
39
|
"LICENSE.txt",
|
|
40
|
-
"README.md"
|
|
40
|
+
"README.md",
|
|
41
|
+
"CMakeLists.txt"
|
|
41
42
|
]
|
|
42
43
|
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// This program is free software: you can redistribute it and/or modify
|
|
4
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
5
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
// (at your option) any later version.
|
|
7
|
+
//
|
|
8
|
+
// This program is distributed in the hope that it will be useful,
|
|
9
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
// GNU Affero General Public License for more details.
|
|
12
|
+
//
|
|
13
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
14
|
+
// along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
let filename = __dirname + '/../build/koffi.node';
|
|
19
|
+
module.exports = require(filename);
|
package/build/koffi.node
DELETED
|
Binary file
|