Skip to content

Commit b00b159

Browse files
committed
Initial commit with full functionality
0 parents  commit b00b159

File tree

216 files changed

+18028
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+18028
-0
lines changed

.gitignore

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
*.obj
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Compiled Dynamic libraries
12+
*.so
13+
*.dylib
14+
*.dll
15+
16+
# Fortran module files
17+
*.mod
18+
19+
# Compiled Static libraries
20+
*.lai
21+
*.la
22+
*.a
23+
*.lib
24+
25+
# Executables
26+
*.exe
27+
*.out
28+
*.app
29+
30+
# random stuff
31+
bin/
32+
.vagrant
33+
.DS_Store
34+
third-party/gtest-*
35+
third-party/gmock-*
36+
gtest-*.zip
37+
gmock-*.zip
38+
coverage/
39+
lcov-report.info
40+
generated/
41+
scripts/venv
42+
*.pyc
43+
*.egg-info
44+
45+
build/
46+
scripts/build/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "googletest"]
2+
path = googletest
3+
url = [email protected]:google/googletest.git

CMakeLists.txt

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
cmake_minimum_required(VERSION 3.5.2)
2+
3+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
4+
5+
project(sysadmin)
6+
7+
if (NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE)
8+
set(CMAKE_BUILD_TYPE
9+
Debug CACHE STRING
10+
"default build type" FORCE)
11+
endif()
12+
13+
set(BUILD_SHARED_LIBS OFF)
14+
15+
set(DECIBEL_TESTS ON)
16+
add_subdirectory(decibel-cpp)
17+
include_directories(decibel-cpp/include)
18+
19+
add_subdirectory(sysadmin-api)
20+
21+
include_directories(src)
22+
add_subdirectory(src)
23+
24+
set(CONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR}/configs)
25+
26+
add_custom_target(configs)
27+
add_custom_command(
28+
TARGET configs
29+
COMMAND rm -rf ${CONFIG_DIR} && cp -r ${CMAKE_CURRENT_SOURCE_DIR}/configs ${CONFIG_DIR}
30+
)
31+
32+
if (NOT DEFINED BUILD_TESTS OR BUILD_TESTS)
33+
add_subdirectory(googletest)
34+
add_subdirectory(test)
35+
endif()
36+

README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
sysadmin
2+
========
3+
4+
Like system administrators in big companies, `sysadmin` configures things
5+
6+
Development
7+
===========
8+
9+
Generally speaking, build as follows:
10+
11+
```
12+
mkdir build
13+
cd build
14+
cmake ..
15+
make check
16+
make
17+
```
18+
19+
`make check` runs only sysadmin's tests. If you wish to run the decibel-cpp tests, run
20+
`make decibel-check`.
21+
22+
If this is your first time, you might have some dependencies which need to be installed
23+
first. The included `third-party-build.sh` will download, build, then install those
24+
dependencies. You will definitely need gcc, g++, and make at the very least in order
25+
to build those dependencies.
26+
27+
Dependencies
28+
============
29+
30+
sysadmin's dependencies are codified in its CMakeLists.txt files, but the key ones are
31+
as follows:
32+
- decibel-cpp, which is included with sysadmin and built when sysadmin is built. It
33+
is a C++ wrapper around libuv, and additional abstractions built with folly
34+
- [libuv](https://github.com/libuv/libuv) is a C event loop library
35+
- [boost](http://www.boost.org/) is boost
36+
- [folly](https://github.com/facebook/folly) is a C++ library, primarily used for
37+
its excellent futures code
38+
- [protobufs](https://developers.google.com/protocol-buffers/), specifically proto 2,
39+
provides the API to sysadmin
40+
- [yaml-cpp](https://github.com/jbeder/yaml-cpp) provides YAML config file support
41+
42+
More docs are to come

cmake/Ccache.cmake

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
macro(enable_ccache)
3+
find_program(CCACHE_FOUND ccache)
4+
if(CCACHE_FOUND)
5+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
6+
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
7+
else(CCACHE_FOUND)
8+
message("CCache not found")
9+
endif(CCACHE_FOUND)
10+
endmacro(enable_ccache)

cmake/CppLint.cmake

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# enable_cpplint as a PRE_BUILD step to a target, or, if the given name doesn't
2+
# exist as a target, adds a `cpplint-` prefix and creates a standalone target that
3+
# is always considered out of date (and as such, always rebuilt).
4+
macro(enable_cpplint)
5+
find_program(CPPLINT "cpplint")
6+
7+
if(CPPLINT)
8+
set(target_name ${ARGV0})
9+
set(linty_files ${ARGN})
10+
list(REMOVE_AT linty_files 0)
11+
12+
if(TARGET ${target_name})
13+
add_custom_command(TARGET ${target_name}
14+
PRE_BUILD
15+
COMMAND ${CPPLINT} ${linty_files}
16+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
17+
COMMENT "Linting ${target_name}")
18+
else()
19+
# Check if we already added this target to avoid an error. This
20+
# could happen if, for example, we lint some common files that are
21+
# included in another component via a cmake Include.
22+
if(NOT TARGET "cpplint-${target_name}")
23+
add_custom_target("cpplint-${target_name}" ALL
24+
COMMAND ${CPPLINT} ${linty_files}
25+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
26+
COMMENT "Linting ${target_name}")
27+
endif()
28+
endif()
29+
else(CPPLINT)
30+
message(WARNING "cpplint not found, linting not enabled")
31+
endif(CPPLINT)
32+
endmacro(enable_cpplint)

cmake/FindAmqpCpp.cmake

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Locate amqp-cpp
2+
#
3+
# This module defines
4+
# AMQPCPP_FOUND, if false, do not try to link to amqp-cpp
5+
# AMQPCPP_LIBRARY, where to find amqp-cpp
6+
# AMQPCPP_INCLUDE_DIR, where to find yaml.h
7+
#
8+
# By default, the dynamic libraries of amqp-cpp will be found. To find the static ones instead,
9+
# you must set the AMQPCPP_STATIC_LIBRARY variable to TRUE before calling find_package(YamlCpp ...).
10+
#
11+
# If amqp-cpp is not installed in a standard path, you can use the AMQPCPP_DIR CMake variable
12+
# to tell CMake where amqp-cpp is.
13+
14+
# attempt to find static library first if this is set
15+
if(AMQPCPP_STATIC_LIBRARY)
16+
set(AMQPCPP_STATIC libamqpcpp.a)
17+
endif()
18+
19+
# find the amqp-cpp include directory
20+
find_path(AMQPCPP_INCLUDE_DIR amqpcpp.h
21+
PATH_SUFFIXES include
22+
PATHS
23+
~/Library/Frameworks/amqp-cpp/include/
24+
/Library/Frameworks/amqp-cpp/include/
25+
/usr/local/include/
26+
/usr/include/
27+
${AMQPCPP_DIR}/include/)
28+
29+
# find the amqp-cpp library
30+
find_library(AMQPCPP_LIBRARY
31+
NAMES ${AMQPCPP_STATIC} amqpcpp
32+
PATH_SUFFIXES lib64 lib
33+
PATHS ~/Library/Frameworks
34+
/Library/Frameworks
35+
/usr/local
36+
/usr
37+
${AMQPCPP_DIR}/lib)
38+
39+
# handle the QUIETLY and REQUIRED arguments and set AMQPCPP_FOUND to TRUE if all listed variables are TRUE
40+
include(FindPackageHandleStandardArgs)
41+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(AMQPCPP DEFAULT_MSG AMQPCPP_INCLUDE_DIR AMQPCPP_LIBRARY)
42+
mark_as_advanced(AMQPCPP_INCLUDE_DIR AMQPCPP_LIBRARY)

cmake/FindDecibelCpp.cmake

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
2+
3+
include(FindPackageHandleStandardArgs)
4+
5+
find_library(DECIBEL_CPP_LIBRARY decibel)
6+
find_path(DECIBEL_CPP_INCLUDE_DIR "decibel/Protobuf.h")
7+
8+
set(DECIBEL_CPP_LIBRARIES ${DECIBEL_CPP_LIBRARY})
9+
10+
find_package_handle_standard_args(DecibelCpp
11+
REQUIRED_ARGS DECIBEL_CPP_INCLUDE_DIR DECIBEL_CPP_LIBRARIES)

cmake/FindDoubleConversion.cmake

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Finds libdouble-conversion.
2+
#
3+
# This module defines:
4+
# DOUBLE_CONVERSION_INCLUDE_DIR
5+
# DOUBLE_CONVERSION_LIBRARY
6+
#
7+
8+
find_path(DOUBLE_CONVERSION_INCLUDE_DIR
9+
NAMES
10+
double-conversion.h
11+
PATHS
12+
/usr/include/double-conversion
13+
/usr/local/include/double-conversion)
14+
find_library(DOUBLE_CONVERSION_LIBRARY NAMES double-conversion)
15+
16+
include(FindPackageHandleStandardArgs)
17+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
18+
DOUBLE_CONVERSION DEFAULT_MSG
19+
DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR)
20+
21+
if (NOT DOUBLE_CONVERSION_FOUND)
22+
message(STATUS "Using third-party bundled double-conversion")
23+
else()
24+
message(STATUS "Found double-conversion: ${DOUBLE_CONVERSION_LIBRARY}")
25+
endif (NOT DOUBLE_CONVERSION_FOUND)
26+
27+
mark_as_advanced(DOUBLE_CONVERSION_INCLUDE_DIR DOUBLE_CONVERSION_LIBRARY)

cmake/FindFolly.cmake

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2014, Facebook, Inc.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree. An additional grant
6+
# of patent rights can be found in the PATENTS file in the same directory.
7+
#
8+
# - Try to find folly
9+
# This will define
10+
# FOLLY_FOUND
11+
# FOLLY_INCLUDE_DIR
12+
# FOLLY_LIBRARIES
13+
14+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7 FATAL_ERROR)
15+
16+
INCLUDE(FindPackageHandleStandardArgs)
17+
18+
FIND_LIBRARY(FOLLY_LIBRARY folly)
19+
FIND_PATH(FOLLY_INCLUDE_DIR "folly/String.h")
20+
21+
SET(FOLLY_LIBRARIES ${FOLLY_LIBRARY})
22+
23+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Folly
24+
REQUIRED_ARGS FOLLY_INCLUDE_DIR FOLLY_LIBRARIES)

0 commit comments

Comments
 (0)