mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Remove cmake build system
This commit is contained in:
parent
974b8fb8bf
commit
1ec70337cf
|
@ -1,67 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
|
||||||
|
|
||||||
option(SHARED_TOXCORE "Build Core as a shared library")
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
option(SHARED_LIBSODIUM "Links libsodium as a shared library")
|
|
||||||
else()
|
|
||||||
option(USE_NACL "Use NaCl library instead of libsodium")
|
|
||||||
option(NO_WIDECHAR "Do not use wide char, even if supported")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#OS X specific
|
|
||||||
if(APPLE)
|
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib)
|
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /opt/local/include)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/opt/local/include" )
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/opt/local/lib")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
find_package(Cursesw REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(USE_NACL)
|
|
||||||
find_package(NaCl REQUIRED)
|
|
||||||
|
|
||||||
include_directories(${NACL_INCLUDE_DIR})
|
|
||||||
add_definitions(-DVANILLA_NACL)
|
|
||||||
|
|
||||||
set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES})
|
|
||||||
else()
|
|
||||||
find_package(SODIUM REQUIRED)
|
|
||||||
|
|
||||||
include_directories(${SODIUM_INCLUDE_DIR})
|
|
||||||
|
|
||||||
set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
|
|
||||||
if(NOT WIN32)
|
|
||||||
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
|
|
||||||
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
macro(linkCoreLibraries exe_name)
|
|
||||||
add_dependencies(${exe_name} toxcore)
|
|
||||||
target_link_libraries(${exe_name} toxcore
|
|
||||||
${LINK_CRYPTO_LIBRARY})
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(${exe_name} ws2_32)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
cmake_policy(SET CMP0011 NEW)
|
|
||||||
|
|
||||||
add_subdirectory(toxcore)
|
|
||||||
add_subdirectory(testing)
|
|
||||||
add_subdirectory(other)
|
|
||||||
add_subdirectory(docs)
|
|
||||||
if(UNIX)
|
|
||||||
add_subdirectory(auto_tests)
|
|
||||||
endif()
|
|
12
Makefile.am
12
Makefile.am
|
@ -11,20 +11,16 @@ CLEANFILES = $(top_srcdir)/libtoxcore.pc
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
$(top_srcdir)/libtoxcore.pc.in \
|
$(top_srcdir)/libtoxcore.pc.in \
|
||||||
$(top_srcdir)/cmake/FindCheck.cmake \
|
$(top_srcdir)/docs/install.rst \
|
||||||
$(top_srcdir)/cmake/FindLIBCONFIG.cmake \
|
|
||||||
$(top_srcdir)/cmake/FindSphinx.cmake \
|
|
||||||
$(top_srcdir)/cmake/FindSODIUM.cmake \
|
|
||||||
$(top_srcdir)/cmake/FindNaCl.cmake \
|
|
||||||
$(top_srcdir)/cmake/FindCursesw.cmake \
|
|
||||||
$(top_srcdir)/docs/CMakeLists.txt \
|
|
||||||
$(top_srcdir)/docs/commands.rst \
|
$(top_srcdir)/docs/commands.rst \
|
||||||
$(top_srcdir)/docs/conf.py.in \
|
$(top_srcdir)/docs/conf.py.in \
|
||||||
$(top_srcdir)/docs/index.rst \
|
$(top_srcdir)/docs/index.rst \
|
||||||
$(top_srcdir)/docs/install.rst \
|
$(top_srcdir)/docs/install.rst \
|
||||||
$(top_srcdir)/docs/start_guide.de.rst \
|
$(top_srcdir)/docs/start_guide.de.rst \
|
||||||
$(top_srcdir)/docs/start_guide.rst \
|
$(top_srcdir)/docs/start_guide.rst \
|
||||||
$(top_srcdir)/CMakeLists.txt \
|
$(top_srcdir)/docs/updates/Crypto.md \
|
||||||
|
$(top_srcdir)/docs/updates/Spam-Prevention.md \
|
||||||
|
$(top_srcdir)/docs/updates/Symmetric-NAT-Transversal.md \
|
||||||
$(top_srcdir)/tools/README \
|
$(top_srcdir)/tools/README \
|
||||||
$(top_srcdir)/tools/astylerc \
|
$(top_srcdir)/tools/astylerc \
|
||||||
$(top_srcdir)/tools/pre-commit
|
$(top_srcdir)/tools/pre-commit
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
cmake_policy(SET CMP0011 NEW)
|
|
||||||
|
|
||||||
include_directories(${CHECK_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
find_package(Check REQUIRED)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/messenger_test.cmake)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/crypto_test.cmake)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/friends_test.cmake)
|
|
||||||
|
|
||||||
include( CTest )
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
add_test(messenger messenger_test)
|
|
||||||
add_test(crypto crypto_test)
|
|
||||||
# TODO enable once test is fixed
|
|
||||||
#add_test(friends friends_test)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
test COMMAND ${CMAKE_CTEST_COMMAND} -V
|
|
||||||
DEPENDS messenger_test crypto_test
|
|
||||||
)
|
|
|
@ -30,10 +30,5 @@ crypto_test_LDADD = $(LIBSODIUM_LDFLAGS) \
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/auto_tests/CMakeLists.txt \
|
EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c
|
||||||
$(top_srcdir)/auto_tests/run_tests \
|
|
||||||
$(top_srcdir)/auto_tests/cmake/messenger_test.cmake \
|
|
||||||
$(top_srcdir)/auto_tests/cmake/crypto_test.cmake \
|
|
||||||
$(top_srcdir)/auto_tests/cmake/friends_test.cmake \
|
|
||||||
$(top_srcdir)/auto_tests/friends_test.c
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(crypto_test C)
|
|
||||||
set(exe_name crypto_test)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
crypto_test.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
||||||
add_dependencies(${exe_name} Check)
|
|
||||||
target_link_libraries(${exe_name} check)
|
|
|
@ -1,10 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(friends_test C)
|
|
||||||
set(exe_name friends_test)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
friends_test.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
||||||
add_dependencies(${exe_name} Check)
|
|
||||||
target_link_libraries(${exe_name} check)
|
|
|
@ -1,10 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(messenger_test C)
|
|
||||||
set(exe_name messenger_test)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
messenger_test.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
||||||
add_dependencies(${exe_name} Check)
|
|
||||||
target_link_libraries(${exe_name} check)
|
|
|
@ -1,46 +0,0 @@
|
||||||
# - Try to find the CHECK libraries
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# CHECK_FOUND - system has check
|
|
||||||
# CHECK_INCLUDE_DIR - the check include directory
|
|
||||||
# CHECK_LIBRARIES - check library
|
|
||||||
#
|
|
||||||
# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
|
|
||||||
# Copyright (c) 2007 Bjoern Ricks <b.ricks@fh-osnabrueck.de>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the New
|
|
||||||
# BSD license.
|
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
|
|
||||||
|
|
||||||
INCLUDE( FindPkgConfig )
|
|
||||||
|
|
||||||
# Take care about check.pc settings
|
|
||||||
PKG_SEARCH_MODULE( CHECK check )
|
|
||||||
|
|
||||||
# Look for CHECK include dir and libraries
|
|
||||||
IF( NOT CHECK_FOUND )
|
|
||||||
|
|
||||||
FIND_PATH( CHECK_INCLUDE_DIR check.h )
|
|
||||||
|
|
||||||
FIND_LIBRARY( CHECK_LIBRARIES NAMES check )
|
|
||||||
|
|
||||||
IF ( CHECK_INCLUDE_DIR AND CHECK_LIBRARIES )
|
|
||||||
SET( CHECK_FOUND 1 )
|
|
||||||
IF ( NOT Check_FIND_QUIETLY )
|
|
||||||
MESSAGE ( STATUS "Found CHECK: ${CHECK_LIBRARIES}" )
|
|
||||||
ENDIF ( NOT Check_FIND_QUIETLY )
|
|
||||||
ELSE ( CHECK_INCLUDE_DIR AND CHECK_LIBRARIES )
|
|
||||||
IF ( Check_FIND_REQUIRED )
|
|
||||||
MESSAGE( FATAL_ERROR "Could NOT find CHECK" )
|
|
||||||
ELSE ( Check_FIND_REQUIRED )
|
|
||||||
IF ( NOT Check_FIND_QUIETLY )
|
|
||||||
MESSAGE( STATUS "Could NOT find CHECK" )
|
|
||||||
ENDIF ( NOT Check_FIND_QUIETLY )
|
|
||||||
ENDIF ( Check_FIND_REQUIRED )
|
|
||||||
ENDIF ( CHECK_INCLUDE_DIR AND CHECK_LIBRARIES )
|
|
||||||
ENDIF( NOT CHECK_FOUND )
|
|
||||||
|
|
||||||
# Hide advanced variables from CMake GUIs
|
|
||||||
MARK_AS_ADVANCED( CHECK_INCLUDE_DIR CHECK_LIBRARIES )
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
# - Find the curses include file and library
|
|
||||||
#
|
|
||||||
# CURSES_INCLUDE_DIR - the Curses include directory
|
|
||||||
# CURSES_LIBRARIES - The libraries needed to use Curses
|
|
||||||
# CURSES_HAVE_WIDE_CHAR - true if wide char is available
|
|
||||||
# NO_WIDECHAR - Input variable, if set, disable wide char
|
|
||||||
# ------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
find_library(CURSES_LIBRARY "curses")
|
|
||||||
find_library(CURSESW_LIBRARY "cursesw")
|
|
||||||
|
|
||||||
find_library(NCURSES_LIBRARY "ncurses")
|
|
||||||
find_library(NCURSESW_LIBRARY "ncursesw")
|
|
||||||
|
|
||||||
if(NOT NO_WIDECHAR AND (CURSESW_LIBRARY OR NCURSESW_LIBRARY))
|
|
||||||
message(STATUS "Found wide character support")
|
|
||||||
set(CURSES_HAVE_WIDE_CHAR TRUE)
|
|
||||||
if(NCURSESW_LIBRARY)
|
|
||||||
set(CURSES_LIBRARIES ${NCURSESW_LIBRARY})
|
|
||||||
else()
|
|
||||||
set(CURSES_LIBRARIES ${CURSESW_LIBRARY})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "Could not found wide character support")
|
|
||||||
if(NCURSES_LIBRARY)
|
|
||||||
set(CURSES_LIBRARIES ${NCURSES_LIBRARY})
|
|
||||||
else()
|
|
||||||
set(CURSES_LIBRARIES ${CURSES_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# We use curses.h not ncurses.h so let's not care about that for now
|
|
||||||
|
|
||||||
if(CURSES_HAVE_WIDE_CHAR)
|
|
||||||
find_path(CURSES_INCLUDE_PATH curses.h PATH_SUFFIXES ncursesw)
|
|
||||||
else()
|
|
||||||
find_path(CURSES_INCLUDE_PATH curses.h PATH_SUFFIXES ncurses)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(Cursesw DEFAULT_MSG CURSES_INCLUDE_DIR CURSES_LIBRARIES)
|
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Find LIBCONFIG
|
|
||||||
#
|
|
||||||
# LIBCONFIG_INCLUDE_DIR
|
|
||||||
# LIBCONFIG_LIBRARY
|
|
||||||
# LIBCONFIG_FOUND
|
|
||||||
#
|
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
find_package(PkgConfig QUIET)
|
|
||||||
pkg_check_modules(_LIBCONFIG QUIET libconfig)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
FIND_PATH(LIBCONFIG_INCLUDE_DIR NAMES libconfig.h HINTS ${_LIBCONFIG_INCLUDEDIR})
|
|
||||||
|
|
||||||
FIND_LIBRARY(LIBCONFIG_LIBRARY NAMES config)
|
|
||||||
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCONFIG DEFAULT_MSG LIBCONFIG_LIBRARY LIBCONFIG_INCLUDE_DIR)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(LIBCONFIG_INCLUDE_DIR LIBCONFIG_LIBRARY)
|
|
|
@ -1,17 +0,0 @@
|
||||||
find_path(NACL_INCLUDE_DIR crypto_box.h
|
|
||||||
$ENV{NACL_INCLUDE_DIR} /usr/include/nacl/
|
|
||||||
DOC "Directory which contain NaCl headers")
|
|
||||||
|
|
||||||
find_path(NACL_LIBRARY_DIR libnacl.a
|
|
||||||
$ENV{NACL_LIBRARY_DIR} /usr/lib/nacl
|
|
||||||
DOC "Directory which contain libnacl.a, cpucycles.o, and randombytes.o")
|
|
||||||
|
|
||||||
if(NACL_LIBRARY_DIR)
|
|
||||||
set(NACL_LIBRARIES
|
|
||||||
"${NACL_LIBRARY_DIR}/cpucycles.o"
|
|
||||||
"${NACL_LIBRARY_DIR}/libnacl.a"
|
|
||||||
"${NACL_LIBRARY_DIR}/randombytes.o")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(NaCl DEFAULT_MSG NACL_INCLUDE_DIR NACL_LIBRARY_DIR NACL_LIBRARIES)
|
|
|
@ -1,75 +0,0 @@
|
||||||
# - Try to find SODIUM
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# SODIUM_ROOT_DIR - Set this variable to the root installation of CMocka
|
|
||||||
#
|
|
||||||
# Read-Only variables:
|
|
||||||
# SODIUM_FOUND - system has SODIUM
|
|
||||||
# SODIUM_INCLUDE_DIR - the SODIUM include directory
|
|
||||||
# SODIUM_LIBRARIES - Link these to use SODIUM
|
|
||||||
# SODIUM_DEFINITIONS - Compiler switches required for using SODIUM
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
#
|
|
||||||
|
|
||||||
set(_SODIUM_ROOT_HINTS
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_SODIUM_ROOT_PATHS
|
|
||||||
"$ENV{PROGRAMFILES}/sodium"
|
|
||||||
"${CMAKE_SOURCE_DIR}/sodium"
|
|
||||||
)
|
|
||||||
|
|
||||||
find_path(SODIUM_ROOT_DIR
|
|
||||||
NAMES
|
|
||||||
include/sodium.h
|
|
||||||
HINTS
|
|
||||||
${_SODIUM_ROOT_HINTS}
|
|
||||||
PATHS
|
|
||||||
${_SODIUM_ROOT_PATHS}
|
|
||||||
)
|
|
||||||
mark_as_advanced(SODIUM_ROOT_DIR)
|
|
||||||
|
|
||||||
find_path(SODIUM_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
sodium.h
|
|
||||||
PATHS
|
|
||||||
${SODIUM_ROOT_DIR}/include
|
|
||||||
)
|
|
||||||
|
|
||||||
if(SHARED_LIBSODIUM)
|
|
||||||
set(WIN32_LIBSODIUM_FILENAME libsodium.dll.a)
|
|
||||||
else()
|
|
||||||
set(WIN32_LIBSODIUM_FILENAME libsodium.a)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_library(SODIUM_LIBRARY
|
|
||||||
NAMES
|
|
||||||
sodium
|
|
||||||
${WIN32_LIBSODIUM_FILENAME}
|
|
||||||
PATHS
|
|
||||||
${SODIUM_ROOT_DIR}/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
if (SODIUM_LIBRARY)
|
|
||||||
set(SODIUM_LIBRARIES
|
|
||||||
${SODIUM_LIBRARIES}
|
|
||||||
${SODIUM_LIBRARY}
|
|
||||||
)
|
|
||||||
endif (SODIUM_LIBRARY)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# show the SODIUM_INCLUDE_DIR and SODIUM_LIBRARIES variables only in the advanced view
|
|
||||||
mark_as_advanced(SODIUM_INCLUDE_DIR SODIUM_LIBRARIES)
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
find_program(SPHINX_EXECUTABLE NAMES sphinx-build
|
|
||||||
HINTS
|
|
||||||
$ENV{SPHINX_DIR}
|
|
||||||
PATH_SUFFIXES bin
|
|
||||||
DOC "Sphinx documentation generator"
|
|
||||||
)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
find_package_handle_standard_args(Sphinx DEFAULT_MSG
|
|
||||||
SPHINX_EXECUTABLE
|
|
||||||
)
|
|
||||||
|
|
||||||
mark_as_advanced(
|
|
||||||
SPHINX_EXECUTABLE
|
|
||||||
)
|
|
|
@ -1,78 +0,0 @@
|
||||||
# A Macro to simplify creating a pkg-config file
|
|
||||||
|
|
||||||
# install_pkg_config_file(<package-name>
|
|
||||||
# [VERSION <version>]
|
|
||||||
# [DESCRIPTION <description>]
|
|
||||||
# [CFLAGS <cflag> ...]
|
|
||||||
# [LIBS <lflag> ...]
|
|
||||||
# [REQUIRES <required-package-name> ...])
|
|
||||||
#
|
|
||||||
# Create and install a pkg-config .pc file to CMAKE_INSTALL_PREFIX/lib/pkgconfig
|
|
||||||
# assuming the following install layout:
|
|
||||||
# libraries: CMAKE_INSTALL_PREFIX/lib
|
|
||||||
# headers : CMAKE_INSTALL_PREFIX/include
|
|
||||||
#
|
|
||||||
# example:
|
|
||||||
# add_library(mylib mylib.c)
|
|
||||||
# install_pkg_config_file(mylib
|
|
||||||
# DESCRIPTION My Library
|
|
||||||
# CFLAGS
|
|
||||||
# LIBS -lmylib
|
|
||||||
# REQUIRES glib-2.0 lcm
|
|
||||||
# VERSION 0.0.1)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
function(install_pkg_config_file)
|
|
||||||
list(GET ARGV 0 pc_name)
|
|
||||||
# TODO error check
|
|
||||||
|
|
||||||
set(pc_version 0.0.1)
|
|
||||||
set(pc_description ${pc_name})
|
|
||||||
set(pc_requires "")
|
|
||||||
set(pc_libs "")
|
|
||||||
set(pc_cflags "")
|
|
||||||
set(pc_fname "${CMAKE_BINARY_DIR}/lib/pkgconfig/${pc_name}.pc")
|
|
||||||
|
|
||||||
set(modewords LIBS CFLAGS REQUIRES VERSION DESCRIPTION)
|
|
||||||
set(curmode "")
|
|
||||||
|
|
||||||
# parse function arguments and populate pkg-config parameters
|
|
||||||
list(REMOVE_AT ARGV 0)
|
|
||||||
foreach(word ${ARGV})
|
|
||||||
list(FIND modewords ${word} mode_index)
|
|
||||||
if(${mode_index} GREATER -1)
|
|
||||||
set(curmode ${word})
|
|
||||||
elseif(curmode STREQUAL LIBS)
|
|
||||||
set(pc_libs "${pc_libs} ${word}")
|
|
||||||
elseif(curmode STREQUAL CFLAGS)
|
|
||||||
set(pc_cflags "${pc_cflags} ${word}")
|
|
||||||
elseif(curmode STREQUAL REQUIRES)
|
|
||||||
set(pc_requires "${pc_requires} ${word}")
|
|
||||||
elseif(curmode STREQUAL VERSION)
|
|
||||||
set(pc_version ${word})
|
|
||||||
set(curmode "")
|
|
||||||
elseif(curmode STREQUAL DESCRIPTION)
|
|
||||||
set(pc_description "${word}")
|
|
||||||
set(curmode "")
|
|
||||||
else(${mode_index} GREATER -1)
|
|
||||||
message("WARNING incorrect use of install_pkg_config_file (${word})")
|
|
||||||
break()
|
|
||||||
endif(${mode_index} GREATER -1)
|
|
||||||
endforeach(word)
|
|
||||||
|
|
||||||
# write the .pc file out
|
|
||||||
file(WRITE ${pc_fname}
|
|
||||||
"prefix=${CMAKE_INSTALL_PREFIX}\n"
|
|
||||||
"libdir=\${prefix}/lib\n"
|
|
||||||
"includedir=\${prefix}/include\n"
|
|
||||||
"\n"
|
|
||||||
"Name: ${pc_name}\n"
|
|
||||||
"Description: ${pc_description}\n"
|
|
||||||
"Requires: ${pc_requires}\n"
|
|
||||||
"Version: ${pc_version}\n"
|
|
||||||
"Libs: -L\${libdir} ${pc_libs}\n"
|
|
||||||
"Cflags: -I\${includedir} ${pc_cflags}\n")
|
|
||||||
|
|
||||||
# mark the .pc file for installation to the lib/pkgconfig directory
|
|
||||||
install(FILES ${pc_fname} DESTINATION lib/pkgconfig)
|
|
||||||
endfunction(install_pkg_config_file)
|
|
|
@ -1,38 +0,0 @@
|
||||||
find_package(Sphinx QUIET)
|
|
||||||
|
|
||||||
if(NOT DEFINED SPHINX_THEME)
|
|
||||||
set(SPHINX_THEME default)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED SPHINX_THEME_DIR)
|
|
||||||
set(SPHINX_THEME_DIR)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# configured documentation tools and intermediate build results
|
|
||||||
set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")
|
|
||||||
|
|
||||||
# Sphinx cache with pickled ReST documents
|
|
||||||
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
|
|
||||||
|
|
||||||
# HTML output directory
|
|
||||||
set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
|
|
||||||
"${BINARY_BUILD_DIR}/conf.py"
|
|
||||||
@ONLY)
|
|
||||||
|
|
||||||
if(SPHINX_FOUND)
|
|
||||||
add_custom_target(docs
|
|
||||||
${SPHINX_EXECUTABLE}
|
|
||||||
-b html
|
|
||||||
-c "${BINARY_BUILD_DIR}"
|
|
||||||
-d "${SPHINX_CACHE_DIR}"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
"${SPHINX_HTML_DIR}"
|
|
||||||
COMMENT "Building HTML documentation with Sphinx")
|
|
||||||
else()
|
|
||||||
add_custom_target(docs
|
|
||||||
echo "Please install python-sphinx to build the docs or read the docs online: https://projecttox.readthedocs.org/en/latest"
|
|
||||||
- COMMENT "No sphinx executable found")
|
|
||||||
endif()
|
|
|
@ -1,23 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
|
|
||||||
cmake_policy(SET CMP0011 NEW)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
file(MAKE_DIRECTORY "$ENV{APPDATA}/.config/tox")
|
|
||||||
file(INSTALL DHTservers DESTINATION "$ENV{APPDATA}/.config/tox")
|
|
||||||
else()
|
|
||||||
set(HOME "$ENV{HOME}")
|
|
||||||
if(APPLE)
|
|
||||||
file(MAKE_DIRECTORY ${HOME}/Library/Application\ Support/.config/tox)
|
|
||||||
file(INSTALL DHTservers DESTINATION ${HOME}/Library/Application\ Support/.config/tox)
|
|
||||||
else()
|
|
||||||
file(MAKE_DIRECTORY ${HOME}/.config/tox)
|
|
||||||
file(INSTALL DHTservers DESTINATION ${HOME}/.config/tox)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_bootstrap.cmake)
|
|
||||||
|
|
||||||
if(LINUX)
|
|
||||||
add_subdirectory(bootstrap_serverdaemon)
|
|
||||||
endif()
|
|
|
@ -14,7 +14,5 @@ DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \
|
||||||
$(LIBSODIUM_LIBS) \
|
$(LIBSODIUM_LIBS) \
|
||||||
$(WINSOCK2_LIBS)
|
$(WINSOCK2_LIBS)
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/other/cmake/DHT_bootstrap.cmake \
|
EXTRA_DIST += $(top_srcdir)/other/DHTservers \
|
||||||
$(top_srcdir)/other/CMakeLists.txt \
|
|
||||||
$(top_srcdir)/other/DHTservers \
|
|
||||||
$(top_srcdir)/other/tox.png
|
$(top_srcdir)/other/tox.png
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(DHT_bootstrap_daemon C)
|
|
||||||
|
|
||||||
set(exe_name DHT_bootstrap_daemon)
|
|
||||||
|
|
||||||
find_package(LIBCONFIG REQUIRED)
|
|
||||||
|
|
||||||
include_directories(${LIBCONFIG_INCLUDE_DIR})
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
DHT_bootstrap_daemon.c)
|
|
||||||
|
|
||||||
target_link_libraries(${exe_name}
|
|
||||||
${LIBCONFIG_LIBRARY})
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
|
|
||||||
find_package(LibConfig REQUIRED)
|
|
|
@ -20,8 +20,4 @@ endif
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
$(top_srcdir)/other/bootstrap_serverdaemon/server.cfg \
|
$(top_srcdir)/other/bootstrap_serverdaemon/server.cfg \
|
||||||
$(top_srcdir)/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.sh \
|
$(top_srcdir)/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.sh
|
||||||
$(top_srcdir)/other/bootstrap_serverdaemon/cmake/Modules \
|
|
||||||
$(top_srcdir)/other/bootstrap_serverdaemon/cmake/Modules/FindLibConfig.cmake \
|
|
||||||
$(top_srcdir)/other/bootstrap_serverdaemon/cmake/Modules/FindLibConfig.cmake \
|
|
||||||
$(top_srcdir)/other/bootstrap_serverdaemon/CMakeLists.txt
|
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
#Ref: https://github.com/schnorr/pajeng/blob/master/cmake/FindLibConfig.cmake
|
|
||||||
#
|
|
||||||
# This module defines
|
|
||||||
# LIBCONFIG_INCLUDE_DIR, where to find cppunit include files, etc.
|
|
||||||
# LIBCONFIG_LIBRARIES, the libraries to link against to use CppUnit.
|
|
||||||
# LIBCONFIG_STATIC_LIBRARIY_PATH
|
|
||||||
# LIBCONFIG_FOUND, If false, do not try to use CppUnit.
|
|
||||||
|
|
||||||
# also defined, but not for general use are
|
|
||||||
# LIBCONFIG_LIBRARY, where to find the CUnit library.
|
|
||||||
|
|
||||||
#MESSAGE("Searching for libconfig library")
|
|
||||||
|
|
||||||
FIND_PATH(LIBCONFIG_INCLUDE_DIR libconfig.h
|
|
||||||
/usr/local/include
|
|
||||||
/usr/include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH(LIBCONFIGPP_INCLUDE_DIR libconfig.h++
|
|
||||||
/usr/local/include
|
|
||||||
/usr/include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(LIBCONFIG_LIBRARY config
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(LIBCONFIGPP_LIBRARY config++
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(LIBCONFIG_STATIC_LIBRARY "libconfig${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(LIBCONFIGPP_STATIC_LIBRARY "libconfig++${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
IF(LIBCONFIG_INCLUDE_DIR)
|
|
||||||
IF(LIBCONFIG_LIBRARY)
|
|
||||||
SET(LIBCONFIG_FOUND TRUE)
|
|
||||||
SET(LIBCONFIG_LIBRARIES ${LIBCONFIG_LIBRARY})
|
|
||||||
SET(LIBCONFIG_STATIC_LIBRARY_PATH ${LIBCONFIG_STATIC_LIBRARY})
|
|
||||||
ENDIF(LIBCONFIG_LIBRARY)
|
|
||||||
ENDIF(LIBCONFIG_INCLUDE_DIR)
|
|
||||||
|
|
||||||
IF(LIBCONFIGPP_INCLUDE_DIR)
|
|
||||||
IF(LIBCONFIGPP_LIBRARY)
|
|
||||||
SET(LIBCONFIGPP_FOUND TRUE)
|
|
||||||
SET(LIBCONFIGPP_LIBRARIES ${LIBCONFIGPP_LIBRARY})
|
|
||||||
SET(LIBCONFIGPP_STATIC_LIBRARY_PATH ${LIBCONFIGPP_STATIC_LIBRARY})
|
|
||||||
ENDIF(LIBCONFIGPP_LIBRARY)
|
|
||||||
ENDIF(LIBCONFIGPP_INCLUDE_DIR)
|
|
||||||
|
|
||||||
IF (LIBCONFIG_FOUND)
|
|
||||||
IF (NOT LibConfig_FIND_QUIETLY)
|
|
||||||
MESSAGE(STATUS "Found LibConfig++: ${LIBCONFIGPP_LIBRARIES}" )
|
|
||||||
MESSAGE(STATUS "Found LibConfig: ${LIBCONFIG_LIBRARIES}")
|
|
||||||
MESSAGE(STATUS "static LibConfig path: ${LIBCONFIG_STATIC_LIBRARY_PATH}")
|
|
||||||
ENDIF (NOT LibConfig_FIND_QUIETLY)
|
|
||||||
ELSE (LIBCONFIG_FOUND)
|
|
||||||
IF (LibConfig_FIND_REQUIRED)
|
|
||||||
MESSAGE(SEND_ERROR "Could NOT find LibConfig")
|
|
||||||
ENDIF (LibConfig_FIND_REQUIRED)
|
|
||||||
ENDIF (LIBCONFIG_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(LIBCONFIG_INCLUDE_DIR LIBCONFIG_LIBRARIES)
|
|
|
@ -1,10 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(DHT_bootstrap C)
|
|
||||||
|
|
||||||
set(exe_name DHT_bootstrap)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
DHT_bootstrap.c
|
|
||||||
../testing/misc_tools.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,15 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
|
|
||||||
cmake_policy(SET CMP0011 NEW)
|
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_test.cmake)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testclient.cmake)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testserver.cmake)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Messenger_test.cmake)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/crypto_speed_test.cmake)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
#Do nothing
|
|
||||||
else()
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nTox.cmake)
|
|
||||||
endif()
|
|
|
@ -87,11 +87,3 @@ crypto_speed_test_LDADD = \
|
||||||
$(LIBSODIUM_LIBS) \
|
$(LIBSODIUM_LIBS) \
|
||||||
$(WINSOCK2_LIBS)
|
$(WINSOCK2_LIBS)
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/testing/cmake/Messenger_test.cmake \
|
|
||||||
$(top_srcdir)/testing/cmake/DHT_test.cmake \
|
|
||||||
$(top_srcdir)/testing/cmake/Lossless_UDP_testclient.cmake \
|
|
||||||
$(top_srcdir)/testing/cmake/Lossless_UDP_testserver.cmake \
|
|
||||||
$(top_srcdir)/testing/cmake/nTox.cmake \
|
|
||||||
$(top_srcdir)/testing/cmake/crypto_speed_test.cmake \
|
|
||||||
$(top_srcdir)/testing/CMakeLists.txt
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(DHT_test C)
|
|
||||||
|
|
||||||
set(exe_name DHT_test)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
DHT_test.c
|
|
||||||
misc_tools.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,9 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(Lossless_UDP_testclient C)
|
|
||||||
|
|
||||||
set(exe_name Lossless_UDP_testclient)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
Lossless_UDP_testclient.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,9 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(Lossless_UDP_testserver C)
|
|
||||||
|
|
||||||
set(exe_name Lossless_UDP_testserver)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
Lossless_UDP_testserver.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,9 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(Messenger_test C)
|
|
||||||
|
|
||||||
set(exe_name Messenger_test)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
Messenger_test.c misc_tools.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,9 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(crypto_speed_test C)
|
|
||||||
|
|
||||||
set(exe_name crypto_speed_test)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
crypto_speed_test.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,12 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(nTox C)
|
|
||||||
|
|
||||||
set(exe_name nTox)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
nTox.c misc_tools.c)
|
|
||||||
|
|
||||||
target_link_libraries(${exe_name}
|
|
||||||
ncurses)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,45 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(toxcore C)
|
|
||||||
|
|
||||||
set(core_sources
|
|
||||||
DHT.c
|
|
||||||
network.c
|
|
||||||
Lossless_UDP.c
|
|
||||||
net_crypto.c
|
|
||||||
friend_requests.c
|
|
||||||
LAN_discovery.c
|
|
||||||
Messenger.c
|
|
||||||
util.c
|
|
||||||
ping.c
|
|
||||||
tox.c)
|
|
||||||
|
|
||||||
set(core_headers
|
|
||||||
DHT.h
|
|
||||||
network.h
|
|
||||||
Lossless_UDP.h
|
|
||||||
net_crypto.h
|
|
||||||
friend_requests.h
|
|
||||||
LAN_discovery.h
|
|
||||||
Messenger.h
|
|
||||||
util.h
|
|
||||||
ping.h)
|
|
||||||
|
|
||||||
add_library(toxcore SHARED ${core_sources})
|
|
||||||
add_library(toxcore_static ${core_sources})
|
|
||||||
set_target_properties(toxcore_static PROPERTIES OUTPUT_NAME toxcore)
|
|
||||||
|
|
||||||
target_link_libraries(toxcore ${LINK_CRYPTO_LIBRARY})
|
|
||||||
|
|
||||||
install(TARGETS toxcore toxcore_static DESTINATION lib)
|
|
||||||
install(FILES ${core_headers} DESTINATION include)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(toxcore ws2_32)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
execute_process(COMMAND git rev-list HEAD --count OUTPUT_VARIABLE COMMIT)
|
|
||||||
|
|
||||||
# Write pkgconfig-file:
|
|
||||||
include(InstallPkgConfigFile)
|
|
||||||
install_pkg_config_file(toxcore CFLAGS LIBS -ltoxcore REQUIRES VERSION 0.1.1_r${COMMIT})
|
|
||||||
|
|
|
@ -38,5 +38,3 @@ libtoxcore_la_LDFLAGS = -version-info $(LIBTOXCORE_VERSION) \
|
||||||
|
|
||||||
libtoxcore_la_LIBS = $(LIBSODIUM_LIBS) \
|
libtoxcore_la_LIBS = $(LIBSODIUM_LIBS) \
|
||||||
$(WINSOCK2_LIBS)
|
$(WINSOCK2_LIBS)
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/toxcore/CMakeLists.txt
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user