Commit a148ad3a authored by Sophie Wenzel-Teuber's avatar Sophie Wenzel-Teuber
Browse files

RPM Support

Add dependencies as rpms to Deimos, update CI to use them and let CMake create an rpm of Deimos itself

Changelog
* Add folder dependencies and fill with rpms for all dependencies for CentOS 7 and 8
* Update the CI to install the dependency rpms to a clean CentOS docker image instead of using the superbuild image
* Update server to use Proxygen Version 2021.10.11.00
* Add Phobos start scripts to the test folder to setup a database for testing and development
* Add subtree for Doxygen XML Parser to recreate the Markdown documentation
* Add CPack to Deimos CMakeLists.txt to create an rpm
parent 1ba46322
Pipeline #4086 passed with stages
in 48 minutes and 2 seconds
image: swenzelteuber/superdeimos:centos8
image: centos:8
.snippets:
- &start_phobos
/home/superdeimos/start-db.sh
./test/start_phobos_db.sh
- &configure
export LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib64/phobos
&& export ASAN_OPTIONS=detect_leaks=0
&& mkdir build
&& pushd build
......@@ -15,13 +15,10 @@ image: swenzelteuber/superdeimos:centos8
-DCMAKE_EXPORT_COMPILE_COMMANDS="${CMAKE_EXPORT_COMPILE_COMMANDS}"
-DCMAKE_C_COMPILER=${CC}
-DCMAKE_CXX_COMPILER=${CXX}
-DCMAKE_C_FLAGS="$(pkg-config glib-2.0 --cflags) -isystem ${DEPS_DIR}/phobos/include"
-DCMAKE_CXX_FLAGS="$(pkg-config glib-2.0 --cflags) -isystem ${DEPS_DIR}/phobos/include -isystem ${DEPS_DIR}/spdlog/include"
-DCMAKE_EXE_LINKER_FLAGS="-L ${DEPS_DIR}/phobos/lib"
-DCMAKE_C_FLAGS="$(pkg-config glib-2.0 --cflags)"
-DCMAKE_CXX_FLAGS="$(pkg-config glib-2.0 --cflags)"
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
-DDEIMOS_BUILD_TESTS="${DEIMOS_BUILD_TESTS}"
-DCMAKE_PREFIX_PATH="${DEPS_DIR}/phobos;${DEPS_DIR}/proxygen;${DEPS_DIR}/folly;${DEPS_DIR}/fmt;${DEPS_DIR}/fizz;${DEPS_DIR}/wangle;${DEPS_DIR}/gflags"
-DCMAKE_INSTALL_PREFIX="${DEPS_DIR}"
-DCUSTOM_DOCU_PATH="${DEIMOS_DOC_DIR}"
-DDEIMOS_BUILD_DOCUMENTATION="${DEIMOS_BUILD_DOCUMENTATION}"
-DDEIMOS_AUTHORISATION="${DEIMOS_AUTHORISATION}"
......@@ -37,7 +34,6 @@ image: swenzelteuber/superdeimos:centos8
.cmake_variables:
default_cmake_variables: &default_cmake_variables
DEPS_DIR: /home/superdeimos/build/install
DEIMOS_DOC_DIR: ""
DEIMOS_BUILD_TESTS: "ON"
DEIMOS_AUTHORISATION: "ON"
......@@ -46,7 +42,6 @@ image: swenzelteuber/superdeimos:centos8
CMAKE_BUILD_TYPE: Debug
CC: gcc
CXX: g++
ENV_LIST: /home/superdeimos/centos8_envs.list
.default_job: &default_job
tags:
......@@ -55,12 +50,23 @@ image: swenzelteuber/superdeimos:centos8
<<: *default_cmake_variables
before_script:
- dnf update -y
- dnf install -y
dnf-plugins-core
epel-release
glibc-langpack-en
- dnf config-manager --set-enabled powertools
- dnf install -y
cmake
gcc gcc-c++
rpm-build rpm-devel rpmdevtools rpmlint
cmake
clang clang-tools-extra
libasan libubsan
- pip3 install boto3
- source ${ENV_LIST}
- dnf -y install
spdlog-devel
catch-devel
python3-pip
- dnf -y install ./dependencies/*.el8.x86_64.rpm
- python3 -m pip install boto3
script:
- *start_phobos
- *configure
......@@ -83,10 +89,12 @@ Format:
before_script:
- dnf update -y
- dnf install -y
python3-pip
git
clang
diffutils
- pip3 install yapf
which
- python3 -m pip install yapf
script:
- ./tools/run_format.sh
&& git status
......@@ -112,19 +120,14 @@ Documentation:
variables:
<<: *default_cmake_variables
DEIMOS_BUILD_DOCUMENTATION: "ON"
DEIMOS_DOC_DIR: /home/superdeimos/external/doxygen-xml-parser/src
CC: clang
CXX: clang++
before_script:
- dnf update -y
DEIMOS_DOC_DIR: ../../doc/parser/src
script:
- dnf install -y
cmake
git
doxygen
graphviz
clang
texlive texlive-epstopdf
script:
- *configure
- make -C build/doc
&& git status
......@@ -142,20 +145,49 @@ Authorisation Disabled:
<<: *default_cmake_variables
DEIMOS_AUTHORISATION: "OFF"
# Centos7:
# <<: *default_job
# stage: test
# image: ciaranorourke/deimos:centos7
# variables:
# <<: *default_cmake_variables
# ENV_LIST: /home/superdeimos/centos7_envs.list
# CMAKE_BUILD_TYPE: Release
# before_script:
# - yum update -y
# - yum install -y epel-release
# - yum install -y
# cmake3
# python3
# - pip3 install boto3
# - ln -s /usr/bin/cmake3 /usr/bin/cmake
# - source ${ENV_LIST}
Centos7:
<<: *default_job
stage: test
image: centos:7
variables:
<<: *default_cmake_variables
CMAKE_BUILD_TYPE: Release
before_script:
- yum update -y
- yum install -y centos-release-scl
- yum install -y epel-release
- yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++
- yum install -y
make
rpm-build rpm-devel rpmlint rpmdevtools
cmake3
python3
- yum -y install ./dependencies/*el7.x86_64.rpm
- python3 -m pip install boto3
script:
- export LD_LIBRARY_PATH=/usr/lib64/phobos
- export ASAN_OPTIONS=detect_leaks=0
- mkdir build &&
pushd build &&
scl enable devtoolset-8 'cmake3
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS="${CMAKE_EXPORT_COMPILE_COMMANDS}"
-DCMAKE_C_COMPILER=${CC}
-DCMAKE_CXX_COMPILER=${CXX}
-DCMAKE_C_FLAGS="$(pkg-config glib-2.0 --cflags)"
-DCMAKE_CXX_FLAGS="$(pkg-config glib-2.0 --cflags)"
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
-DDEIMOS_BUILD_TESTS="${DEIMOS_BUILD_TESTS}"
-DCUSTOM_DOCU_PATH="${DEIMOS_DOC_DIR}"
-DDEIMOS_BUILD_DOCUMENTATION="${DEIMOS_BUILD_DOCUMENTATION}"
-DDEIMOS_AUTHORISATION="${DEIMOS_AUTHORISATION}"
-DBOOST_ROOT=/usr/include/boost169
-DBOOST_INCLUDEDIR=/usr/include/boost169
-DBOOST_LIBRARYDIR=/usr/lib64/boost169
..' &&
popd
- *build
- *start_phobos
- *unit_test
- *integration_test
......@@ -79,7 +79,7 @@ find_package(Boost REQUIRED COMPONENTS iostreams)
find_package(proxygen REQUIRED)
find_package(phobos REQUIRED)
find_package(spdlog REQUIRED)
find_package(gflags REQUIRED) # needed for folly-linker
#
# Include optional subdirectories
......@@ -112,3 +112,20 @@ if(DEIMOS_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif(DEIMOS_BUILD_TESTS)
set(CPACK_GENERATOR RPM)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_PACKAGE_NAME deimos)
#set(CPACK_RPM_FILE_NAME deimos-1.0.0.rpm)
set(CPACK_RPM_PACKAGE_VERSION 1.0.0)
set(CPACK_RPM_PACKAGE_REQUIRES "phobos-devel, \
folly, \
proxygen, \
spdlog-devel, \
openssl-devel")
include(CPack)
\ No newline at end of file
......@@ -8,19 +8,11 @@ Most importantly, it can be used as an endpoint for Lustre HSM archiving solutio
## Dependencies Installation Instructions
Deimos has dependencies that require a little patience to build. It may be simpler to invoke a prebuilt Docker image using a Dockerfile such as;
Deimos has dependencies that require a little patience to build.
RPMs for these dependencies for CentOS 7 and 8 can be found [in this repo](/dependencies/) for convenience.
```
FROM ciaranorourke/deimos:centos
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install \
[personal installation preferences]
```
Alternatively, see [SuperDeimos](https://git.ichec.ie/oilgas/ltfs/superdeimos) for instructions on how to create your own build environment.
It is recommended to run the Docker image mentioned above by mounting your local branch of the Deimos project with `docker run -it -v /path/to/local/deimos:/home/superdeimos/external/deimos [name]:[tag]`
These have been built using the superbuild [SuperDeimos](https://git.ichec.ie/performance/storage/superdeimos).
SuperDeimos can also be built into a docker image and used directly by mounting the local Deimos directory with `docker run -it -v /path/to/local/deimos:/home/superdeimos/external/deimos [name]:[tag]`.
To use the Phobos raid1 layout which is compatible with FIFOs, the following environment variables must be set;
......@@ -55,7 +47,7 @@ make -C build
make -C build install
```
A build script executing these commands and also building the dependencies can be found in the project [SuperDeimos](https://git.ichec.ie/oilgas/ltfs/superdeimos).
A build script executing these commands and also building the dependencies can be found in the project [SuperDeimos](https://git.ichec.ie/performance/storage/superdeimos).
### Useful Options
......
# Copyright (c) Facebook, Inc. and its affiliates.
# Find libgflags.
# There's a lot of compatibility cruft going on in here, both
# to deal with changes across the FB consumers of this and also
# to deal with variances in behavior of cmake itself.
#
# Since this file is named FindGflags.cmake the cmake convention
# is for the module to export both GFLAGS_FOUND and Gflags_FOUND.
# The convention expected by consumers is that we export the
# following variables, even though these do not match the cmake
# conventions:
#
# LIBGFLAGS_INCLUDE_DIR - where to find gflags/gflags.h, etc.
# LIBGFLAGS_LIBRARY - List of libraries when using libgflags.
# LIBGFLAGS_FOUND - True if libgflags found.
#
# We need to be able to locate gflags both from an installed
# cmake config file and just from the raw headers and libs, so
# test for the former and then the latter, and then stick
# the results together and export them into the variables
# listed above.
#
# For forwards compatibility, we export the following variables:
#
# gflags_INCLUDE_DIR - where to find gflags/gflags.h, etc.
# gflags_TARGET / GFLAGS_TARGET / gflags_LIBRARIES
# - List of libraries when using libgflags.
# gflags_FOUND - True if libgflags found.
#
IF (LIBGFLAGS_INCLUDE_DIR)
# Already in cache, be silent
SET(Gflags_FIND_QUIETLY TRUE)
ENDIF ()
find_package(gflags CONFIG QUIET)
if (gflags_FOUND)
if (NOT Gflags_FIND_QUIETLY)
message(STATUS "Found gflags from package config ${gflags_CONFIG}")
endif()
# Re-export the config-specified libs with our local names
set(LIBGFLAGS_LIBRARY ${gflags_LIBRARIES})
set(LIBGFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR})
if(NOT EXISTS "${gflags_INCLUDE_DIR}")
# The gflags-devel RPM on recent RedHat-based systems is somewhat broken.
# RedHat symlinks /lib64 to /usr/lib64, and this breaks some of the
# relative path computation performed in gflags-config.cmake. The package
# config file ends up being found via /lib64, but the relative path
# computation it does only works if it was found in /usr/lib64.
# If gflags_INCLUDE_DIR does not actually exist, simply default it to
# /usr/include on these systems.
set(LIBGFLAGS_INCLUDE_DIR "/usr/include")
endif()
set(LIBGFLAGS_FOUND ${gflags_FOUND})
# cmake module compat
set(GFLAGS_FOUND ${gflags_FOUND})
set(Gflags_FOUND ${gflags_FOUND})
else()
FIND_PATH(LIBGFLAGS_INCLUDE_DIR gflags/gflags.h)
FIND_LIBRARY(LIBGFLAGS_LIBRARY_DEBUG NAMES gflagsd gflags_staticd)
FIND_LIBRARY(LIBGFLAGS_LIBRARY_RELEASE NAMES gflags gflags_static)
INCLUDE(SelectLibraryConfigurations)
SELECT_LIBRARY_CONFIGURATIONS(LIBGFLAGS)
# handle the QUIETLY and REQUIRED arguments and set LIBGFLAGS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(gflags DEFAULT_MSG LIBGFLAGS_LIBRARY LIBGFLAGS_INCLUDE_DIR)
# cmake module compat
set(Gflags_FOUND ${GFLAGS_FOUND})
# compat with some existing FindGflags consumers
set(LIBGFLAGS_FOUND ${GFLAGS_FOUND})
# Compat with the gflags CONFIG based detection
set(gflags_FOUND ${GFLAGS_FOUND})
set(gflags_INCLUDE_DIR ${LIBGFLAGS_INCLUDE_DIR})
set(gflags_LIBRARIES ${LIBGFLAGS_LIBRARY})
set(GFLAGS_TARGET ${LIBGFLAGS_LIBRARY})
set(gflags_TARGET ${LIBGFLAGS_LIBRARY})
MARK_AS_ADVANCED(LIBGFLAGS_LIBRARY LIBGFLAGS_INCLUDE_DIR)
endif()
# Compat with the gflags CONFIG based detection
if (LIBGFLAGS_FOUND AND NOT TARGET gflags)
add_library(gflags UNKNOWN IMPORTED)
if(TARGET gflags-shared)
# If the installed gflags CMake package config defines a gflags-shared
# target but not gflags, just make the gflags target that we define
# depend on the gflags-shared target.
target_link_libraries(gflags INTERFACE gflags-shared)
# Export LIBGFLAGS_LIBRARY as the gflags-shared target in this case.
set(LIBGFLAGS_LIBRARY gflags-shared)
else()
set_target_properties(
gflags
PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LIBGFLAGS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBGFLAGS_INCLUDE_DIR}"
)
endif()
endif()
\ No newline at end of file
# Written in 2016 by Henrik Steffen Gaßmann <henrik@gassmann.onl>
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication
# along with this software. If not, see
#
# http://creativecommons.org/publicdomain/zero/1.0/
#
########################################################################
# Tries to find the local libsodium installation.
#
# On Windows the sodium_DIR environment variable is used as a default
# hint which can be overridden by setting the corresponding cmake variable.
#
# Once done the following variables will be defined:
#
# sodium_FOUND
# sodium_INCLUDE_DIR
# sodium_LIBRARY_DEBUG
# sodium_LIBRARY_RELEASE
#
#
# Furthermore an imported "sodium" target is created.
#
if (CMAKE_C_COMPILER_ID STREQUAL "GNU"
OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(_GCC_COMPATIBLE 1)
endif()
# static library option
if (NOT DEFINED sodium_USE_STATIC_LIBS)
option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF)
endif()
if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST))
unset(sodium_LIBRARY CACHE)
unset(sodium_LIBRARY_DEBUG CACHE)
unset(sodium_LIBRARY_RELEASE CACHE)
unset(sodium_DLL_DEBUG CACHE)
unset(sodium_DLL_RELEASE CACHE)
set(sodium_USE_STATIC_LIBS_LAST ${sodium_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable")
endif()
########################################################################
# UNIX
if (UNIX)
# import pkg-config
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(sodium_PKG QUIET libsodium)
endif()
if(sodium_USE_STATIC_LIBS)
foreach(_libname ${sodium_PKG_STATIC_LIBRARIES})
if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a
list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a")
endif()
endforeach()
list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES)
# if pkgconfig for libsodium doesn't provide
# static lib info, then override PKG_STATIC here..
if (NOT sodium_PKG_STATIC_FOUND)
set(sodium_PKG_STATIC_LIBRARIES libsodium.a)
endif()
set(XPREFIX sodium_PKG_STATIC)
else()
if (NOT sodium_PKG_FOUND)
set(sodium_PKG_LIBRARIES sodium)
endif()
set(XPREFIX sodium_PKG)
endif()
find_path(sodium_INCLUDE_DIR sodium.h
HINTS ${${XPREFIX}_INCLUDE_DIRS}
)
find_library(sodium_LIBRARY_DEBUG NAMES ${${XPREFIX}_LIBRARIES}
HINTS ${${XPREFIX}_LIBRARY_DIRS}
)
find_library(sodium_LIBRARY_RELEASE NAMES ${${XPREFIX}_LIBRARIES}
HINTS ${${XPREFIX}_LIBRARY_DIRS}
)
########################################################################
# Windows
elseif (WIN32)
set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory")
mark_as_advanced(sodium_DIR)
find_path(sodium_INCLUDE_DIR sodium.h
HINTS ${sodium_DIR}
PATH_SUFFIXES include
)
if (MSVC)
# detect target architecture
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" [=[
#if defined _M_IX86
#error ARCH_VALUE x86_32
#elif defined _M_X64
#error ARCH_VALUE x86_64
#endif
#error ARCH_VALUE unknown
]=])
try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp"
OUTPUT_VARIABLE _COMPILATION_LOG
)
string(REGEX REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" "\\1" _TARGET_ARCH "${_COMPILATION_LOG}")
# construct library path
if (_TARGET_ARCH STREQUAL "x86_32")
string(APPEND _PLATFORM_PATH "Win32")
elseif(_TARGET_ARCH STREQUAL "x86_64")
string(APPEND _PLATFORM_PATH "x64")
else()
message(FATAL_ERROR "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake.")
endif()
string(APPEND _PLATFORM_PATH "/$$CONFIG$$")
if (MSVC_VERSION LESS 1900)
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60")
else()
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50")
endif()
string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}")
if (sodium_USE_STATIC_LIBS)
string(APPEND _PLATFORM_PATH "/static")
else()
string(APPEND _PLATFORM_PATH "/dynamic")
endif()
string(REPLACE "$$CONFIG$$" "Debug" _DEBUG_PATH_SUFFIX "${_PLATFORM_PATH}")
string(REPLACE "$$CONFIG$$" "Release" _RELEASE_PATH_SUFFIX "${_PLATFORM_PATH}")
find_library(sodium_LIBRARY_DEBUG libsodium.lib
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX}
)
find_library(sodium_LIBRARY_RELEASE libsodium.lib
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}
)
if (NOT sodium_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(sodium_DLL_DEBUG libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX}
)
find_library(sodium_DLL_RELEASE libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}
)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK})
endif()
elseif(_GCC_COMPATIBLE)
if (sodium_USE_STATIC_LIBS)
find_library(sodium_LIBRARY_DEBUG libsodium.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
find_library(sodium_LIBRARY_RELEASE libsodium.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
else()
find_library(sodium_LIBRARY_DEBUG libsodium.dll.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
find_library(sodium_LIBRARY_RELEASE libsodium.dll.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
file(GLOB _DLL
LIST_DIRECTORIES false
RELATIVE "${sodium_DIR}/bin"
"${sodium_DIR}/bin/libsodium*.dll"
)
find_library(sodium_DLL_DEBUG ${_DLL} libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES bin
)
find_library(sodium_DLL_RELEASE ${_DLL} libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES bin
)
endif()
else()
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
endif()
########################################################################
# unsupported
else()
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
endif()
########################################################################
# common stuff
# extract sodium version
if (sodium_INCLUDE_DIR)
set(_VERSION_HEADER "${_INCLUDE_DIR}/sodium/version.h")
if (EXISTS _VERSION_HEADER)
file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT)
string(REGEX REPLACE ".*#[ \t]*define[ \t]*SODIUM_VERSION_STRING[ \t]*\"([^\n]*)\".*" "\\1"
sodium_VERSION "${_VERSION_HEADER_CONTENT}")
set(sodium_VERSION "${sodium_VERSION}" PARENT_SCOPE)
endif()
endif()
# communicate results
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Sodium # The name must be either uppercase or match the filename case.
REQUIRED_VARS
sodium_LIBRARY_RELEASE
sodium_LIBRARY_DEBUG
sodium_INCLUDE_DIR
VERSION_VAR
sodium_VERSION
)
if(Sodium_FOUND)
set(sodium_LIBRARIES
optimized ${sodium_LIBRARY_RELEASE} debug ${sodium_LIBRARY_DEBUG})
endif()
# mark file paths as advanced
mark_as_advanced(sodium_INCLUDE_DIR)
mark_as_advanced(sodium_LIBRARY_DEBUG)
mark_as_advanced(sodium_LIBRARY_RELEASE)
if (WIN32)
mark_as_advanced(sodium_DLL_DEBUG)
mark_as_advanced(sodium_DLL_RELEASE)
endif()
# create imported target
if(sodium_USE_STATIC_LIBS)
set(_LIB_TYPE STATIC)
else()
set(_LIB_TYPE SHARED)
endif()
if(NOT TARGET sodium)
add_library(sodium ${_LIB_TYPE} IMPORTED)
endif()
set_target_properties(sodium PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${sodium_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
)
if (sodium_USE_STATIC_LIBS)
set_target_properties(sodium PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "SODIUM_STATIC"
IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}"
)
else()
if (UNIX)
set_target_properties(sodium PROPERTIES
IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}"
)
elseif (WIN32)
set_target_properties(sodium PROPERTIES
IMPORTED_IMPLIB "${sodium_LIBRARY_RELEASE}"
IMPORTED_IMPLIB_DEBUG "${sodium_LIBRARY_DEBUG}"
)
if (NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND"))
set_target_properties(sodium PROPERTIES
IMPORTED_LOCATION_DEBUG "${sodium_DLL_DEBUG}"
)
endif()
if (NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND"))
set_target_properties(sodium PROPERTIES
IMPORTED_LOCATION_RELWITHDEBINFO "${sodium_DLL_RELEASE}"
IMPORTED_LOCATION_MINSIZEREL "${sodium_DLL_RELEASE}"