-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from muflihun/develop
1.0.0 release
- Loading branch information
Showing
37 changed files
with
8,949 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
logs | ||
CMakeFiles | ||
build | ||
CMakeLists.txt.user |
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,63 @@ | ||
language: cpp | ||
compiler: | ||
- clang | ||
dist: trusty | ||
before_install: | ||
- sudo add-apt-repository ppa:kubuntu-ppa/backports -y | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y libssl-dev libgtest-dev php5-cli valgrind | ||
- sudo apt-get install --only-upgrade cmake | ||
- cmake --version | ||
- g++ --version | ||
# Crypto++ (We manually install it because we need Pem Pack as well) | ||
- wget https://raw.githubusercontent.com/muflihun/muflihun.github.io/master/downloads/cryptocpp.tar.gz | ||
- tar xf cryptocpp.tar.gz | ||
- cd cryptopp-CRYPTOPP_5_6_5 | ||
- wget https://raw.githubusercontent.com/muflihun/muflihun.github.io/master/downloads/pem_pack.zip | ||
- unzip pem_pack.zip | ||
- cmake . | ||
- make | ||
- sudo make install | ||
## Ripe | ||
# - RIPE_VERSION=4.0.0 | ||
# - RIPE_VERSION_URL="v$RIPE_VERSION" | ||
# - wget -O ripe-code.zip https://github.com/muflihun/ripe/archive/$RIPE_VERSION_URL.zip | ||
# - unzip ripe-code.zip | ||
# - cd ripe-$RIPE_VERSION | ||
# - cmake . | ||
# - make | ||
# - ls -l | ||
# - sudo make install | ||
# GTest | ||
- wget -O gtest.tar.gz https://github.com/google/googletest/archive/release-1.7.0.tar.gz | ||
- tar xf gtest.tar.gz | ||
- cd googletest-release-1.7.0 | ||
- cmake -DBUILD_SHARED_LIBS=ON . | ||
- make | ||
- sudo cp -a include/gtest /usr/include | ||
- sudo cp -a libgtest_main.so libgtest.so /usr/lib/ | ||
- cd .. | ||
## Easylogging++ | ||
- wget https://github.com/muflihun/easyloggingpp/archive/master.zip | ||
- unzip master.zip | ||
- cd easyloggingpp-master | ||
- cmake . | ||
- make | ||
- sudo make install | ||
## Build | ||
- cd "${TRAVIS_BUILD_DIR}" | ||
- pwd | ||
- php build.php # build mine headers | ||
- mkdir build | ||
- cd build | ||
- pwd | ||
- ls -l | ||
- ls -l .. | ||
- cmake -Dtest_main_header=ON -Dtest_wstring_conversions=OFF .. | ||
- make | ||
|
||
script: "./mine-unit-tests" | ||
branches: | ||
only: | ||
- develop | ||
|
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,5 @@ | ||
# Change Log | ||
|
||
## [1.0.0] - 05-09-2017 | ||
### Added | ||
- Initial release |
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,182 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
|
||
project(Mine) | ||
|
||
option (test_main_header "Test main header (mine.h)" OFF) | ||
option (test_wstring_conversions "Test std::wstring (wchar_t*) conversions for encodings" ON) | ||
|
||
set (MINE_VERSION "1.0.0") | ||
set (MINE_SOVERSION "1.0.0") | ||
|
||
add_definitions (-DMINE_VERSION="${MINE_VERSION}") | ||
|
||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") | ||
|
||
set(MINE_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in") | ||
|
||
include_directories (${CMAKE_BINARY_DIR}) | ||
include_directories (${CMAKE_SOURCE_DIR}) | ||
|
||
install(FILES | ||
package/mine.h | ||
package/mine.cc | ||
DESTINATION "${MINE_INCLUDE_INSTALL_DIR}" | ||
COMPONENT dev | ||
) | ||
|
||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
# We need C++11 | ||
macro(require_cpp11) | ||
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0) | ||
# CMake 3.1 has built-in CXX standard checks. | ||
message("-- Setting C++11") | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED on) | ||
else() | ||
if (CMAKE_CXX_COMPILER_ID MATCHES "GCC") | ||
message ("-- GNU CXX (-std=c++11)") | ||
list(APPEND CMAKE_CXX_FLAGS "-std=c++11") | ||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
message ("-- CLang CXX (-std=c++11)") | ||
list(APPEND CMAKE_CXX_FLAGS "-std=c++11") | ||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
message ("-- GNU CXX (-std=c++11)") | ||
list(APPEND CMAKE_CXX_FLAGS "-std=c++11") | ||
else() | ||
message ("-- Requires C++11. Your compiler does not support it.") | ||
endif() | ||
endif() | ||
endmacro() | ||
|
||
# http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH | ||
if (APPLE) | ||
set(CMAKE_MACOSX_RPATH ON) | ||
set(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) | ||
if("${isSystemDir}" STREQUAL "-1") | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
endif() | ||
endif() | ||
|
||
list (APPEND CMAKE_CXX_FLAGS " -Wall -Wextra -Wunused ") | ||
|
||
require_cpp11() | ||
|
||
# Check for cryptopp (static) | ||
set(CryptoPP_USE_STATIC_LIBS ON) | ||
find_package(CryptoPP REQUIRED) | ||
message ("-- Crypto++ binary: " ${CRYPTOPP_LIBRARY}) | ||
include_directories (${CRYPTOPP_INCLUDE_DIRS}) | ||
|
||
# Check for include files and stdlib properties. | ||
include (CheckIncludeFileCXX) | ||
check_include_file_cxx (attr/xattr.h HAVE_ATTR_XATTR_H) | ||
check_include_file_cxx (sys/xattr.h HAVE_SYS_XATTR_H) | ||
|
||
# Check if xattr functions take extra arguments, as they do on OSX. | ||
# Output error is misleading, so do this test quietly. | ||
include (CheckCXXSourceCompiles) | ||
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) | ||
set (CMAKE_REQUIRED_QUIET True) | ||
check_cxx_source_compiles ("#include <sys/types.h> | ||
#include <sys/xattr.h> | ||
int main() { getxattr(0,0,0,0,0,0); return 1; } | ||
" XATTR_ADD_OPT) | ||
set (CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) | ||
|
||
# Reference all headers, to make certain IDEs happy. | ||
file (GLOB_RECURSE all_headers ${CMAKE_SOURCE_DIR}/*.h) | ||
add_custom_target (all_placeholder SOURCES ${all_headers}) | ||
|
||
#find_package(OPENSSL REQUIRED) | ||
#if (OPENSSL_FOUND) | ||
# include_directories(${OPENSSL_INCLUDE_DIR}) | ||
#endif(OPENSSL_FOUND) | ||
|
||
find_package(ZLIB REQUIRED) | ||
if (ZLIB_FOUND) | ||
include_directories(${ZLIB_INCLUDE_DIRS}) | ||
endif(ZLIB_FOUND) | ||
|
||
########################################## CLI Tool ################################### | ||
|
||
add_executable (mine-cli cli/mine.cc | ||
src/mine-common.cc | ||
src/base64.cc | ||
src/base16.cc | ||
src/aes.cc | ||
src/zlib.cc) | ||
|
||
set_target_properties (mine-cli PROPERTIES | ||
OUTPUT_NAME "mine" | ||
VERSION ${MINE_VERSION} | ||
) | ||
|
||
target_link_libraries(mine-cli | ||
${ZLIB_LIBRARIES} | ||
#${OPENSSL_CRYPTO_LIBRARY} | ||
) | ||
|
||
install (TARGETS mine-cli DESTINATION bin) | ||
|
||
########################################## Unit Testing ################################### | ||
|
||
# Check for Easylogging++ | ||
find_package(EASYLOGGINGPP REQUIRED) | ||
include_directories (${EASYLOGGINGPP_INCLUDE_DIR}) | ||
|
||
find_package (gtest REQUIRED) | ||
|
||
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) | ||
|
||
enable_testing() | ||
|
||
if (test_main_header) | ||
add_executable(mine-unit-tests | ||
test/main.cc | ||
package/mine.cc | ||
${EASYLOGGINGPP_INCLUDE_DIR}/easylogging++.cc | ||
) | ||
|
||
target_compile_definitions (mine-unit-tests PUBLIC | ||
MINE_SINGLE_HEADER_TEST | ||
) | ||
else() | ||
add_executable(mine-unit-tests | ||
test/main.cc | ||
src/mine-common.cc | ||
src/rsa.cc | ||
src/aes.cc | ||
src/base16.cc | ||
src/base64.cc | ||
src/zlib.cc | ||
${EASYLOGGINGPP_INCLUDE_DIR}/easylogging++.cc | ||
) | ||
endif() | ||
|
||
target_link_libraries(mine-unit-tests | ||
${ZLIB_LIBRARIES} | ||
) | ||
|
||
if (test_wstring_conversions) | ||
target_compile_definitions (mine-unit-tests PUBLIC | ||
MINE_WSTRING_CONVERSION | ||
) | ||
endif() | ||
|
||
target_compile_definitions (mine-unit-tests PUBLIC | ||
ELPP_STL_LOGGING | ||
) | ||
|
||
# Standard linking to gtest stuff. | ||
target_link_libraries(mine-unit-tests gtest gtest_main) | ||
|
||
# Extra linking for the project. | ||
target_link_libraries(mine-unit-tests ${CRYPTOPP_LIBRARIES}) | ||
|
||
add_test(NAME mineUnitTests COMMAND mine-unit-tests) |
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.