Repository navigation
Expand file tree
/
Copy pathMakefileCapi
More file actions
36 lines (34 loc) · 2.7 KB
/
Copy pathMakefileCapi
File metadata and controls
36 lines (34 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#
# Copyright (c) 2022 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
cpp:
bazel build --jobs=${JOBS} ${CAPI_FLAGS} //src:ovms_shared '@drogon//:drogon_cmake' '@aws-sdk-cpp//:aws-sdk-cpp_cmake' '@jsoncpp//:jsoncpp' '@libgit2_engine//:libgit2_cmake'
EXTRA_STATIC_LIBS="$$(bazel cquery ${CAPI_FLAGS} --output=files '@drogon//:drogon_cmake + @aws-sdk-cpp//:aws-sdk-cpp_cmake + @jsoncpp//:jsoncpp' 2>/dev/null | grep '\.a$$' | sort -u | sed 's|^|/ovms/|')" ; \
LIBGIT2_DIR="$$(bazel cquery ${CAPI_FLAGS} --output=files '@libgit2_engine//:libgit2_cmake' 2>/dev/null | grep '\.so$$' | sed 's|^|/ovms/|' | xargs -n1 dirname | sort -u | head -1)" ; \
g++ src/main_capi.cpp -I/ovms/src/ -L/ovms/bazel-bin/src/ -L/azure-sdk-install/lib \
-Wl,-rpath-link,/azure-sdk-install/lib -lovms_shared -fPIC --std=c++17 \
-Wl,--start-group $$EXTRA_STATIC_LIBS -Wl,--end-group \
-L"$$LIBGIT2_DIR" -lgit2 -Wl,-rpath-link,"$$LIBGIT2_DIR" -lssl -lcrypto -lcurl -luuid -lz \
-o /ovms/bazel-bin/src/capi_cpp_example ; \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/ovms/bazel-bin/src/:/azure-sdk-install/lib:$$LIBGIT2_DIR /ovms/bazel-bin/src/capi_cpp_example
c:
bazel build --jobs=${JOBS} ${CAPI_FLAGS} //src:ovms_shared '@drogon//:drogon_cmake' '@aws-sdk-cpp//:aws-sdk-cpp_cmake' '@jsoncpp//:jsoncpp' '@libgit2_engine//:libgit2_cmake'
EXTRA_STATIC_LIBS="$$(bazel cquery ${CAPI_FLAGS} --output=files '@drogon//:drogon_cmake + @aws-sdk-cpp//:aws-sdk-cpp_cmake + @jsoncpp//:jsoncpp' 2>/dev/null | grep '\.a$$' | sort -u | sed 's|^|/ovms/|')" ; \
LIBGIT2_DIR="$$(bazel cquery ${CAPI_FLAGS} --output=files '@libgit2_engine//:libgit2_cmake' 2>/dev/null | grep '\.so$$' | sed 's|^|/ovms/|' | xargs -n1 dirname | sort -u | head -1)" ; \
gcc -c src/main_capi.c -o /ovms/bazel-bin/src/main_capi.o -std=c99 ; \
g++ -o /ovms/bazel-bin/src/capi_c_example /ovms/bazel-bin/src/main_capi.o -lovms_shared -L/ovms/bazel-bin/src/ -L/azure-sdk-install/lib -Wl,-rpath-link,/azure-sdk-install/lib \
-Wl,--start-group $$EXTRA_STATIC_LIBS -Wl,--end-group \
-L"$$LIBGIT2_DIR" -lgit2 -Wl,-rpath-link,"$$LIBGIT2_DIR" -lssl -lcrypto -lcurl -luuid -lz ; \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/ovms/bazel-bin/src/:/azure-sdk-install/lib:$$LIBGIT2_DIR /ovms/bazel-bin/src/capi_c_example