Skip to content

Commit

Permalink
Add Node.js compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Jul 16, 2024
1 parent d48d500 commit f8d624c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(sqlite3_native C)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

include(bare)
include(napi)

if(NOT TARGET sqlite3)
add_subdirectory(vendor/sqlite3 EXCLUDE_FROM_ALL)
Expand All @@ -23,3 +24,25 @@ target_link_libraries(
PRIVATE
sqlite3
)

add_napi_module(sqlite3_native_node)

bare_include_directories(compat NAPI)

target_include_directories(
${sqlite3_native_node}
PRIVATE
${compat}
)

target_sources(
${sqlite3_native_node}
PRIVATE
binding.c
)

target_link_libraries(
${sqlite3_native_node}
PUBLIC
sqlite3
)
2 changes: 1 addition & 1 deletion binding.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require.addon()
module.exports = require('load-addon')(__dirname)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"bare": ">=1.4.0"
},
"dependencies": {
"load-addon": "^1.0.0",
"ready-resource": "^1.0.3"
},
"devDependencies": {
Expand Down

0 comments on commit f8d624c

Please sign in to comment.