-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
321 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# All Vagrant configuration is done below. The "2" in Vagrant.configure | ||
# configures the configuration version (we support older styles for | ||
# backwards compatibility). Please don't change it unless you know what | ||
# you're doing. | ||
Vagrant.configure("2") do |config| | ||
# The most common configuration options are documented and commented below. | ||
# For a complete reference, please see the online documentation at | ||
# https://docs.vagrantup.com. | ||
|
||
# Every Vagrant development environment requires a box. You can search for | ||
# boxes at https://vagrantcloud.com/search. | ||
config.vm.box = "bento/ubuntu-20.04" | ||
|
||
# Disable automatic box update checking. If you disable this, then | ||
# boxes will only be checked for updates when the user runs | ||
# `vagrant box outdated`. This is not recommended. | ||
config.vm.box_check_update = false | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine. In the example below, | ||
# accessing "localhost:8080" will access port 80 on the guest machine. | ||
# NOTE: This will enable public access to the opened port | ||
# config.vm.network "forwarded_port", guest: 80, host: 8080 | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine and only allow access | ||
# via 127.0.0.1 to disable public access | ||
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" | ||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
# config.vm.network "private_network", ip: "192.168.33.10" | ||
|
||
# Create a public network, which generally matched to bridged network. | ||
# Bridged networks make the machine appear as another physical device on | ||
# your network. | ||
# config.vm.network "public_network" | ||
|
||
# Share an additional folder to the guest VM. The first argument is | ||
# the path on the host to the actual folder. The second argument is | ||
# the path on the guest to mount the folder. And the optional third | ||
# argument is a set of non-required options. | ||
config.vm.synced_folder ".", "/vagrant" | ||
|
||
# Provider-specific configuration so you can fine-tune various | ||
# backing providers for Vagrant. These expose provider-specific options. | ||
# Example for VirtualBox: | ||
# | ||
config.vm.provider "virtualbox" do |vb| | ||
# # Display the VirtualBox GUI when booting the machine | ||
# vb.gui = true | ||
# | ||
# # Customize the amount of memory on the VM: | ||
vb.memory = "2048" | ||
end | ||
# | ||
# View the documentation for the provider you are using for more | ||
# information on available options. | ||
|
||
# Enable provisioning with a shell script. Additional provisioners such as | ||
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the | ||
# documentation for more information about their specific syntax and use. | ||
config.vm.provision "shell", inline: <<-SHELL | ||
apt-get update | ||
apt-get install -y build-essential cmake libcurl4-openssl-dev pkg-config libboost1.71-all-dev qtbase5-dev | ||
SHELL | ||
end |
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,106 @@ | ||
# CMakeLists.txt | ||
|
||
cmake_minimum_required(VERSION 3.11) | ||
|
||
project(tinyphone LANGUAGES C CXX) | ||
set(PACKAGE "${PROJECT_NAME}") | ||
set(PACKAGE_NAME "${PROJECT_NAME}") | ||
set(PACKAGE_VERSION "1.0.0") | ||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") | ||
set(PACKAGE_BUGREPORT "hi@kinsh.uk") | ||
set(PACKAGE_TARNAME "${PROJECT_NAME}") | ||
set(PACKAGE_URL "") | ||
set(VERSION "${PACKAGE_VERSION}") | ||
|
||
# CMake Policies | ||
|
||
# CMP0074: find_package() uses <PackageName>_ROOT variables. | ||
if(POLICY CMP0074) | ||
cmake_policy(SET CMP0074 NEW) | ||
endif() | ||
|
||
# CMP0075 Include file check macros honor CMAKE_REQUIRED_LIBRARIES | ||
if(POLICY CMP0075) | ||
cmake_policy(SET CMP0075 NEW) | ||
endif() | ||
|
||
|
||
# set(CMAKE_C_COMPILER "/usr/bin/gcc") | ||
# set(CMAKE_CXX_COMPILER "g++") | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_WARN_DEPRECATED FALSE) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") | ||
|
||
if(CMAKE_VERSION VERSION_LESS "3.7.0") | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
endif() | ||
|
||
include(CheckLibraryExists) | ||
include(CheckSymbolExists) | ||
include(CheckCSourceCompiles) | ||
# include(CMakePushCheckState) | ||
# include(GNUInstallDirs) | ||
# include(CMakeDependentOption) | ||
|
||
|
||
set(Boost_USE_STATIC_LIBS ON) | ||
set(Boost_USE_MULTITHREADED ON) | ||
# set(Boost_USE_STATIC_RUNTIME OFF) | ||
find_package(Boost 1.71 REQUIRED COMPONENTS date_time filesystem system) | ||
include_directories(${Boost_INCLUDE_DIRS}) | ||
|
||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(PJSIP libpjproject REQUIRED) | ||
include_directories(${PJSIP_INCLUDE_DIRS}) | ||
|
||
check_symbol_exists("res_ndestroy" "resolv.h" HAVE_RES_NDESTROY) | ||
set(CMAKE_REQUIRED_LIBRARIES resolv) | ||
|
||
find_package(Threads) | ||
|
||
|
||
file(GLOB SOURCES | ||
${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone/*.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone/*.cpp | ||
) | ||
list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone/guicon.cpp) | ||
list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone/splash.cpp) | ||
list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone/guicon.h) | ||
list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone/splash.h) | ||
list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone/winapp.cpp) | ||
|
||
add_executable(tinyphone ${SOURCES} console.cpp) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pjproject/pjlib/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pjproject/pjlib-util/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pjproject/pjmedia/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pjproject/pjnath/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pjproject/pjsip/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/json/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/statsd-cpp/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/crow/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/portaudio/include) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib) | ||
target_include_directories(tinyphone PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../tinyphone) | ||
link_directories(tinyphone ${Boost_LIBRARY_DIRS}) | ||
target_link_libraries(tinyphone ${Boost_LIBRARIES}) | ||
target_link_libraries(tinyphone ${PJSIP_LIBRARIES}) | ||
|
||
find_package(nlohmann_json 3.10.5 REQUIRED) | ||
target_link_libraries(tinyphone nlohmann_json::nlohmann_json) | ||
|
||
add_library(libcryptopp_static STATIC IMPORTED) | ||
set_target_properties(libcryptopp_static PROPERTIES IMPORTED_LOCATION /usr/local/lib/libcryptopp.a) | ||
set_target_properties(libcryptopp_static PROPERTIES INTERFACE_INCLUDE_DIRECTORIES /usr/local/include) | ||
target_link_libraries(tinyphone libcryptopp_static) | ||
target_link_libraries(tinyphone "cryptopp") | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../lib/statsd-cpp ${CMAKE_CURRENT_SOURCE_DIR}/../lib/statsd-cpp/build) | ||
target_link_libraries(tinyphone statsd_static) | ||
|
||
pkg_check_modules(CURL libcurl REQUIRED) | ||
include_directories(${CURL_INCLUDE_DIR}) | ||
target_link_libraries(tinyphone ${CURL_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 @@ | ||
// console.cpp : Defines the entry point for the console application. | ||
|
||
#include <stdio.h> | ||
#include <ctime> | ||
#include <algorithm> | ||
#include <vector> | ||
#include <iostream> | ||
|
||
#include "server.h" | ||
#include "utils.h" | ||
#include "net.h" | ||
#include "consts.h" | ||
#include "config.h" | ||
#include "log.h" | ||
#include "app.hpp" | ||
#include "tpendpoint.h" | ||
|
||
using namespace std; | ||
using namespace pj; | ||
using namespace tp; | ||
|
||
|
||
void Start(){ | ||
tp::StartApp(); | ||
exit(0); | ||
} | ||
|
||
void Stop(){ | ||
tp::StopApp(); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
std::cout << "Hello Tinyphone!\n"; | ||
Start(); | ||
return 0; | ||
} |
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
Oops, something went wrong.