Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
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
opendht
Commits
844d3713
Commit
844d3713
authored
9 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
add initial cmake support
parent
cdcaebbc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+83
-0
83 additions, 0 deletions
CMakeLists.txt
cmake/FindMsgpack.cmake
+48
-0
48 additions, 0 deletions
cmake/FindMsgpack.cmake
tools/CMakeLists.txt
+8
-0
8 additions, 0 deletions
tools/CMakeLists.txt
with
139 additions
and
0 deletions
CMakeLists.txt
0 → 100644
+
83
−
0
View file @
844d3713
cmake_minimum_required
(
VERSION 2.8.6
)
project
(
opendht
)
list
(
APPEND CMAKE_MODULE_PATH
"
${
PROJECT_SOURCE_DIR
}
/cmake"
)
set
(
prefix
${
CMAKE_INSTALL_PREFIX
}
)
set
(
exec_prefix
"
\$
{prefix}"
)
set
(
libdir
"
\$
{exec_prefix}/lib"
)
set
(
includedir
"
\$
{prefix}/include"
)
option
(
OPENDHT_PYTHON
"Build Python bindings"
OFF
)
option
(
OPENDHT_TOOLS
"Build DHT tools"
ON
)
option
(
OPENDHT_DEBUG
"Build with debug flags"
OFF
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor
${
CMAKE_CXX_FLAGS
}
"
)
find_package
(
GnuTLS REQUIRED
)
find_package
(
Msgpack REQUIRED
)
list
(
APPEND opendht_SOURCES
src/infohash.cpp
src/crypto.cpp
src/default_types.cpp
src/value.cpp
src/dht.cpp
src/securedht.cpp
src/dhtrunner.cpp
)
list
(
APPEND opendht_HEADERS
include/opendht/rng.h
include/opendht/crypto.h
include/opendht/infohash.h
include/opendht/default_types.h
include/opendht/value.h
include/opendht/dht.h
include/opendht/securedht.h
include/opendht.h
)
configure_file
(
opendht.pc.in
opendht.pc
@ONLY
)
include_directories
(
./
include/
include/opendht/
${
CMAKE_CURRENT_BINARY_DIR
}
/include/
)
if
(
OPENDHT_DEBUG
)
set
(
CMAKE_BUILD_TYPE Debug
)
else
()
set
(
CMAKE_BUILD_TYPE Release
)
endif
()
add_library
(
opendht SHARED
${
opendht_SOURCES
}
${
opendht_HEADERS
}
)
set_target_properties
(
opendht PROPERTIES IMPORT_SUFFIX
"_import.lib"
)
#set_target_properties (opendht PROPERTIES SOVERSION 1 VERSION 1.0.0)
add_library
(
opendht-static STATIC
${
opendht_SOURCES
}
${
opendht_HEADERS
}
)
set_target_properties
(
opendht-static PROPERTIES OUTPUT_NAME
"opendht"
)
if
(
NOT DEFINED CMAKE_INSTALL_LIBDIR
)
set
(
CMAKE_INSTALL_LIBDIR lib
)
endif
()
if
(
OPENDHT_TOOLS
)
add_subdirectory
(
tools
)
endif
()
install
(
TARGETS opendht opendht-static DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
install
(
DIRECTORY include DESTINATION
${
CMAKE_INSTALL_PREFIX
}
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/opendht.pc DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
/pkgconfig
)
This diff is collapsed.
Click to expand it.
cmake/FindMsgpack.cmake
0 → 100644
+
48
−
0
View file @
844d3713
# - Try to find msgpack
# Once done this will define
# MSGPACK_FOUND - System has msgpack
# MSGPACK_INCLUDE_DIRS - The msgpack include directories
# MSGPACK_LIBRARIES - The libraries needed to use msgpack
if
(
NOT MSGPACK_USE_BUNDLED
)
find_package
(
PkgConfig
)
if
(
PKG_CONFIG_FOUND
)
pkg_check_modules
(
PC_MSGPACK QUIET msgpack
)
endif
()
else
()
set
(
PC_MSGPACK_INCLUDEDIR
)
set
(
PC_MSGPACK_INCLUDE_DIRS
)
set
(
PC_MSGPACK_LIBDIR
)
set
(
PC_MSGPACK_LIBRARY_DIRS
)
set
(
LIMIT_SEARCH NO_DEFAULT_PATH
)
endif
()
set
(
MSGPACK_DEFINITIONS
${
PC_MSGPACK_CFLAGS_OTHER
}
)
find_path
(
MSGPACK_INCLUDE_DIR msgpack.h
HINTS
${
PC_MSGPACK_INCLUDEDIR
}
${
PC_MSGPACK_INCLUDE_DIRS
}
${
LIMIT_SEARCH
}
)
# If we're asked to use static linkage, add libmsgpack.a as a preferred library name.
if
(
MSGPACK_USE_STATIC
)
list
(
APPEND MSGPACK_NAMES
"
${
CMAKE_STATIC_LIBRARY_PREFIX
}
msgpack
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
"
)
endif
()
list
(
APPEND MSGPACK_NAMES msgpack
)
find_library
(
MSGPACK_LIBRARY NAMES
${
MSGPACK_NAMES
}
HINTS
${
PC_MSGPACK_LIBDIR
}
${
PC_MSGPACK_LIBRARY_DIRS
}
${
LIMIT_SEARCH
}
)
mark_as_advanced
(
MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY
)
set
(
MSGPACK_LIBRARIES
${
MSGPACK_LIBRARY
}
)
set
(
MSGPACK_INCLUDE_DIRS
${
MSGPACK_INCLUDE_DIR
}
)
include
(
FindPackageHandleStandardArgs
)
# handle the QUIETLY and REQUIRED arguments and set MSGPACK_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args
(
Msgpack DEFAULT_MSG
MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR
)
This diff is collapsed.
Click to expand it.
tools/CMakeLists.txt
0 → 100644
+
8
−
0
View file @
844d3713
add_executable
(
dhtnode dhtnode.cpp tools_common.h
)
add_executable
(
dhtscanner dhtscanner.cpp tools_common.h
)
add_executable
(
dhtchat dhtchat.cpp tools_common.h
)
target_link_libraries
(
dhtnode LINK_PUBLIC opendht gnutls
)
target_link_libraries
(
dhtscanner LINK_PUBLIC opendht gnutls
)
target_link_libraries
(
dhtchat LINK_PUBLIC opendht gnutls
)
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