-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor CMakeLists.txt. Add custom target for headers installation (#94
) * Improved readability of the build process. * Removed unnecessary libraries to link. * Added target to install headers. * Added checks to validate installation of dependencies.
- Loading branch information
Showing
6 changed files
with
220 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2023 Orange | ||
# | ||
# 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. | ||
|
||
# Try to find Jansson library | ||
# | ||
# The following variables are set: | ||
# JANSSON_FOUND - System has Jansson | ||
# JANSSON_LIBRARIES - The libraries needed to use Jansson | ||
# JANSSON_INCLUDE_DIR - The Jansson include directory | ||
|
||
find_path(JANSSON_INCLUDE_DIR jansson.h) | ||
|
||
find_library(JANSSON_LIBRARIES NAMES jansson) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Jansson DEFAULT_MSG | ||
JANSSON_LIBRARIES | ||
JANSSON_INCLUDE_DIR) | ||
|
||
mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2023 Orange | ||
# | ||
# 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. | ||
|
||
# Try to find libbpf library | ||
# | ||
# The following variables are set: | ||
# LIBBPF_FOUND - libbpf has been found | ||
# LIBBPF_LIBRARIES - The libraries needed to use libbpf | ||
# LIBBPF_INCLUDE_DIR - The libbpf include directory | ||
|
||
find_path(LIBBPF_INCLUDE_DIR NAMES bpf/libbpf.h | ||
PATHS | ||
${CMAKE_CURRENT_SOURCE_DIR}/install/usr/include | ||
NO_DEFAULT_PATH) | ||
|
||
find_library(LIBBPF_LIBRARIES NAMES libbpf.a | ||
PATHS | ||
${CMAKE_CURRENT_SOURCE_DIR}/install/usr/lib64 | ||
NO_DEFAULT_PATH) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(LibBpf "Could NOT find libbpf; did you run the build_libbpf.sh script?" | ||
LIBBPF_LIBRARIES | ||
LIBBPF_INCLUDE_DIR) | ||
|
||
mark_as_advanced(LIBBPF_INCLUDE_DIR LIBBPF_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# - Try to find libelf | ||
# Once done this will define | ||
# | ||
# LIBELF_FOUND - system has libelf | ||
# LIBELF_INCLUDE_DIRS - the libelf include directory | ||
# LIBELF_LIBRARIES - Link these to use libelf | ||
# LIBELF_DEFINITIONS - Compiler switches required for using libelf | ||
# | ||
# Copyright (c) 2008 Bernhard Walle <[email protected]> | ||
# | ||
# Redistribution and use is allowed according to the terms of the New | ||
# BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
# | ||
|
||
|
||
if (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS) | ||
set (LibElf_FIND_QUIETLY TRUE) | ||
endif (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS) | ||
|
||
find_path (LIBELF_INCLUDE_DIRS | ||
NAMES | ||
libelf.h | ||
PATHS | ||
/usr/include | ||
/usr/include/libelf | ||
/usr/local/include | ||
/usr/local/include/libelf | ||
/opt/local/include | ||
/opt/local/include/libelf | ||
/sw/include | ||
/sw/include/libelf | ||
ENV CPATH) | ||
|
||
find_library (LIBELF_LIBRARIES | ||
NAMES | ||
elf | ||
PATHS | ||
/usr/lib | ||
/usr/local/lib | ||
/opt/local/lib | ||
/sw/lib | ||
ENV LIBRARY_PATH | ||
ENV LD_LIBRARY_PATH) | ||
|
||
include (FindPackageHandleStandardArgs) | ||
|
||
|
||
# handle the QUIETLY and REQUIRED arguments and set LIBELF_FOUND to TRUE if all listed variables are TRUE | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibElf DEFAULT_MSG | ||
LIBELF_LIBRARIES | ||
LIBELF_INCLUDE_DIRS) | ||
|
||
SET(CMAKE_REQUIRED_LIBRARIES elf) | ||
INCLUDE(CheckCSourceCompiles) | ||
CHECK_C_SOURCE_COMPILES("#include <libelf.h> | ||
int main() { | ||
Elf *e = (Elf*)0; | ||
size_t sz; | ||
elf_getshdrstrndx(e, &sz); | ||
return 0; | ||
}" ELF_GETSHDRSTRNDX) | ||
|
||
mark_as_advanced(LIBELF_INCLUDE_DIRS LIBELF_LIBRARIES ELF_GETSHDRSTRNDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2017 Xilinx, Inc. | ||
# | ||
# 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. | ||
|
||
# FindLibGmp | ||
# ----------- | ||
# | ||
# Try to find LibGmp the GNU Multiple Precision Arithmetic Library (only for C language) | ||
# | ||
# Once done this will define | ||
# | ||
# :: | ||
# | ||
# LIBGMP_FOUND - System has LibGmp | ||
# LIBGMP_INCLUDE_DIR - The LibGmp include directory | ||
# LIBGMP_LIBRARIES - The libraries needed to use LibGmp | ||
# LIBGMP_DEFINITIONS - Compiler switches required for using LibGmp | ||
find_package(PkgConfig QUIET) | ||
find_package(Threads) | ||
PKG_CHECK_MODULES(PC_LIBGMP QUIET gmp) | ||
set(LIBGMP_DEFINITIONS ${PC_LIBGMP_CFLAGS_OTHER}) | ||
|
||
|
||
find_path(LIBGMP_INCLUDE_DIR NAMES gmp.h | ||
HINTS | ||
${PC_LIBGMP_INCLUDEDIR} | ||
${PC_LIBGMP_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(LIBGMP_LIBRARIES NAMES gmp libgmp | ||
HINTS | ||
${PC_LIBGMP_LIBDIR} | ||
${PC_LIBGMP_LIBRARY_DIRS} | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(LibGmp | ||
REQUIRED_VARS LIBGMP_LIBRARIES LIBGMP_INCLUDE_DIR | ||
) | ||
mark_as_advanced(LIBGMP_INCLUDE_DIR LIBGMP_LIBRARIES) |