Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
e9826ae4
Commit
e9826ae4
authored
11 months ago
by
Adrien Béraud
Committed by
Adrien Béraud
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
cmake: add support for nodejs
Change-Id: Ia6e13fd3bd27077dac41b210a8dfac8d78ae6d2c
parent
544f35eb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
CMakeLists.txt
+72
-0
72 additions, 0 deletions
CMakeLists.txt
Dockerfile
+9
-13
9 additions, 13 deletions
Dockerfile
README.md
+1
-1
1 addition, 1 deletion
README.md
bin/nodejs/.gitignore
+1
-0
1 addition, 0 deletions
bin/nodejs/.gitignore
bin/nodejs/binding.gyp.in
+5
-3
5 additions, 3 deletions
bin/nodejs/binding.gyp.in
with
88 additions
and
17 deletions
CMakeLists.txt
+
72
−
0
View file @
e9826ae4
...
...
@@ -14,6 +14,7 @@ set(PROJECT_LABEL "libjami")
option
(
JAMI_NATPMP
"Build with NAT-PMP"
ON
)
option
(
JAMI_PUPNP
"Build with PUPNP"
ON
)
option
(
JAMI_PLUGIN
"Build with plugin support"
ON
)
option
(
JAMI_NODEJS
"Build the NODEJS binding"
OFF
)
option
(
JAMI_JNI
"Build the JNI binding"
OFF
)
option
(
JAMI_DBUS
"Build the DBUS binding"
OFF
)
option
(
JAMI_VIDEO
"Build with video support"
ON
)
...
...
@@ -36,6 +37,11 @@ endif()
include
(
CTest
)
if
(
JAMI_NODEJS
)
# Required for nodejs binding
set
(
CMAKE_POSITION_INDEPENDENT_CODE ON
)
endif
()
if
(
NOT MSVC
)
################################################################################
# Contrib
...
...
@@ -623,6 +629,72 @@ else()
install
(
TARGETS
${
PROJECT_NAME
}
)
if
(
JAMI_NODEJS
)
# Build nodejs binding
include
(
UseSWIG
)
find_package
(
SWIG 4.2 COMPONENTS javascript REQUIRED
)
file
(
GLOB NODEJS_INTERFACE_FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/nodejs/*.i
)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/nodejs/jami_wrapper.cpp
COMMAND
${
SWIG_EXECUTABLE
}
-v -c++ -javascript -node -o jami_wrapper.cpp nodejs_interface.i
DEPENDS
${
NODEJS_INTERFACE_FILES
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/nodejs
)
# Generate binding.gyp
# We need to pass the link flags to node-gyp
set
(
_gyp_flags
""
)
get_target_property
(
_linked_libs
${
PROJECT_NAME
}
LINK_LIBRARIES
)
foreach
(
LIB IN LISTS _linked_libs
)
if
(
"
${
LIB
}
"
MATCHES
"^PkgConfig::"
)
string
(
REPLACE
"PkgConfig::"
""
PKG_NAME
${
LIB
}
)
string
(
APPEND _gyp_flags
"
${${
PKG_NAME
}
_LDFLAGS
}
"
)
elseif
(
"
${
LIB
}
"
MATCHES
".so$"
)
get_filename_component
(
LIB_DIRECTORY
${
LIB
}
DIRECTORY
)
get_filename_component
(
LIB_NAME_WE
${
LIB
}
NAME_WE
)
string
(
REPLACE
"lib"
""
LIB_NAME_WE
${
LIB_NAME_WE
}
)
string
(
APPEND _gyp_flags
" -L
${
LIB_DIRECTORY
}
-l
${
LIB_NAME_WE
}
"
)
elseif
(
TARGET
${
LIB
}
)
# TODO generate cmake targets automatically
#string(APPEND _gyp_flags " $<TARGET_FILE:${LIB}>")
else
()
string
(
APPEND _gyp_flags
" -l
${
LIB
}
"
)
endif
()
endforeach
()
list
(
REVERSE _gyp_flags
)
list
(
REMOVE_DUPLICATES _gyp_flags
)
list
(
REVERSE _gyp_flags
)
foreach
(
item
${
_gyp_flags
}
)
if
(
NOT
"
${
QUOTED_JSON_LIST
}
"
STREQUAL
""
)
set
(
QUOTED_JSON_LIST
"
${
QUOTED_JSON_LIST
}
,"
)
endif
()
set
(
QUOTED_JSON_LIST
"
${
QUOTED_JSON_LIST
}
\"
${
item
}
\"
"
)
endforeach
()
string
(
REPLACE
";"
","
_gyp_flags_str
${
QUOTED_JSON_LIST
}
)
set
(
JAMI_LINK_LIBRARIES
${
_gyp_flags_str
}
)
set
(
JAMI_LINK_DIRECTORIES
${
CMAKE_CURRENT_BINARY_DIR
}
)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/bin/nodejs/binding.gyp.in
${
CMAKE_SOURCE_DIR
}
/bin/nodejs/binding.gyp
)
# Build nodejs binding
add_custom_target
(
jamid
ALL
COMMAND node-gyp rebuild --target=v18.19.1 --arch=x64
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/nodejs/binding.gyp
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/nodejs/callback.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/nodejs/jami_wrapper.cpp
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/nodejs
)
add_dependencies
(
jamid
${
PROJECT_NAME
}
)
endif
()
if
(
JAMI_JNI
)
# Build jni binding
add_library
(
${
PROJECT_NAME
}
-jni SHARED
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin/jni/jami_wrapper.cpp
)
...
...
This diff is collapsed.
Click to expand it.
Dockerfile
+
9
−
13
View file @
e9826ae4
FROM
ubuntu:22.04
AS
jami-daemon
ARG
DEBIAN_FRONTEND=noninteractive
ARG
c
onfig
_args
ARG
c
make
_args
RUN
apt-get update
&&
apt-get
install
-y
\
autoconf
\
automake
\
...
...
@@ -45,14 +45,16 @@ RUN apt-get update && apt-get install -y \
guile-3.0-dev
\
nasm
\
pkg-config
\
yasm
yasm
\
libcppunit-dev
\
sip-tester
# Install Node
RUN
curl
-fsSL
https://deb.nodesource.com/setup_1
6
.x | bash -
&&
\
RUN
curl
-fsSL
https://deb.nodesource.com/setup_1
8
.x | bash -
&&
\
apt-get
install
-y
nodejs
&&
\
npm
install
-g
node-gyp
# Install latest Swig (4.
1
)
# Install latest Swig (4.
2
)
WORKDIR
/swig
RUN
git clone https://github.com/swig/swig.git
&&
\
cd
swig
&&
\
...
...
@@ -62,17 +64,11 @@ RUN git clone https://github.com/swig/swig.git && \
make
install
WORKDIR
/daemon
COPY
contrib/ contrib/
# Build daemon dependencies
RUN
mkdir
-p
contrib/native
&&
\
cd
contrib/native
&&
\
../bootstrap
&&
\
make
-j
$(
nproc
)
COPY
. .
# Build the daemon
RUN
./autogen.sh
&&
\
./configure
$config_args
&&
\
RUN
mkdir
-p
build
&&
\
cd
build
&&
\
cmake ..
$cmake_args
&&
\
make
-j
$(
nproc
)
This diff is collapsed.
Click to expand it.
README.md
+
1
−
1
View file @
e9826ae4
...
...
@@ -198,7 +198,7 @@ docker build --tag jami-daemon .
# To build with custom build args
```
bash
docker build
--tag
jami-daemon
--build-arg
c
onfig
_args
=
"-
-with-nodejs
"
.
docker build
--tag
jami-daemon
--build-arg
c
make
_args
=
"-
DJAMI_NODEJS=On
"
.
```
Common Issues
...
...
This diff is collapsed.
Click to expand it.
bin/nodejs/.gitignore
+
1
−
0
View file @
e9826ae4
jami_wrapper.cpp
binding.gyp
build/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bin/nodejs/binding.gyp
→
bin/nodejs/binding.gyp
.in
+
5
−
3
View file @
e9826ae4
...
...
@@ -4,10 +4,12 @@
"target_name": "jamid",
"sources": [ "jami_wrapper.cpp" ],
'include_dirs': ['../../src/'],
'libraries': ['-L<(module_root_dir)/../../src/.libs', '-ljami'],
"ldflags": ["-Wl,-Bsymbolic"],
'libraries': ['-L@JAMI_LINK_DIRECTORIES@', '-ljami-core', '-lyaml-cpp', @JAMI_LINK_LIBRARIES@],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions', '-fno-rtti', '-std=gnu++1y' ],
'cflags_cc': [ '-std=gnu++17' ]
'cflags_cc': [ '-std=gnu++17' ]
,
}
]
],
'variables' : { 'openssl_fips': '' }
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment