Skip to content

Commit

Permalink
update CMakeLists.txt for install brynet header
Browse files Browse the repository at this point in the history
  • Loading branch information
IronsDu committed Dec 10, 2019
1 parent 49df60a commit 8522002
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ before_script:
- export CC_FOR_BUILD=$CC
- export CXX_FOR_BUILD=$CXX
script:
- cmake .
- cmake . -Dbrynet_BUILD_EXAMPLES=ON -Dbrynet_BUILD_TESTS=ON
# make
- bash ./scripts/travis-compiler.sh
- sonar-scanner -X
Expand Down
69 changes: 20 additions & 49 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,52 +34,23 @@ elseif(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif()

file(GLOB BRYNET_UTILS_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/base/*.h)
install (FILES ${BRYNET_UTILS_PUBLIC_HEADERS} DESTINATION "include/brynet/base")
file(GLOB BRYNET_UTILS_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/base/*.hpp)
install (FILES ${BRYNET_UTILS_PUBLIC_HEADERS} DESTINATION "include/brynet/base")

file(GLOB BRYNET_UTILS_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/base/crypto/*.h)
install (FILES ${BRYNET_UTILS_PUBLIC_HEADERS} DESTINATION "include/brynet/base/crypto")
file(GLOB BRYNET_UTILS_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/base/crypto/*.hpp)
install (FILES ${BRYNET_UTILS_PUBLIC_HEADERS} DESTINATION "include/brynet/base/crypto")

file(GLOB BRYNET_UTILS_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/base/endian/*.h)
install (FILES ${BRYNET_UTILS_PUBLIC_HEADERS} DESTINATION "include/brynet/base/endian")
file(GLOB BRYNET_UTILS_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/base/endian/*.hpp)
install (FILES ${BRYNET_UTILS_PUBLIC_HEADERS} DESTINATION "include/brynet/base/endian")

file(GLOB BRYNET_NET_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/*.h)
install (FILES ${BRYNET_NET_PUBLIC_HEADERS} DESTINATION "include/brynet/net")
file(GLOB BRYNET_NET_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/*.hpp)
install (FILES ${BRYNET_NET_PUBLIC_HEADERS} DESTINATION "include/brynet/net")

file(GLOB BRYNET_HTTP_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/detail/*.h)
install (FILES ${BRYNET_HTTP_PUBLIC_HEADERS} DESTINATION "include/brynet/net/detail")
file(GLOB BRYNET_HTTP_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/detail/*.hpp)
install (FILES ${BRYNET_HTTP_PUBLIC_HEADERS} DESTINATION "include/brynet/net/detail")

file(GLOB BRYNET_HTTP_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/http/*.h)
install (FILES ${BRYNET_HTTP_PUBLIC_HEADERS} DESTINATION "include/brynet/net/http")
file(GLOB BRYNET_HTTP_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/http/*.hpp)
install (FILES ${BRYNET_HTTP_PUBLIC_HEADERS} DESTINATION "include/brynet/net/http")

file(GLOB BRYNET_PORT_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/port/*.h)
install (FILES ${BRYNET_PORT_PUBLIC_HEADERS} DESTINATION "include/brynet/net/port")
file(GLOB BRYNET_PORT_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/port/*.hpp)
install (FILES ${BRYNET_PORT_PUBLIC_HEADERS} DESTINATION "include/brynet/net/port")

file(GLOB BRYNET_PORT_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/wrapper/*.h)
install (FILES ${BRYNET_PORT_PUBLIC_HEADERS} DESTINATION "include/brynet/net/wrapper")
file(GLOB BRYNET_PORT_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/brynet/net/wrapper/*.hpp)
install (FILES ${BRYNET_PORT_PUBLIC_HEADERS} DESTINATION "include/brynet/net/wrapper")

add_subdirectory(examples)

if(WIN32)
if (MSVC_VERSION VERSION_GREATER 1900)
add_subdirectory(tests)
endif()
elseif(UNIX)
add_subdirectory(tests)
endif()
SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
install(DIRECTORY include/brynet
DESTINATION "${INCLUDE_INSTALL_DIR}")

option(brynet_BUILD_EXAMPLES "Build examples" OFF)
option(brynet_BUILD_TESTS "Build test" OFF)

if (brynet_BUILD_EXAMPLES)
add_subdirectory(examples)
endif(brynet_BUILD_EXAMPLES)

if (brynet_BUILD_TESTS)
if(WIN32)
if (MSVC_VERSION VERSION_GREATER 1900)
#add_subdirectory(tests)
endif()
elseif(UNIX)
#add_subdirectory(tests)
endif()
endif(brynet_BUILD_TESTS)
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ Linux/MacOS : [![Build Status](https://travis-ci.org/IronsDu/brynet.svg?branch=m
* GCC 4.8+ (32/64-bit)
* Clang (Supported C++ 11)

## Macro
* BRYNET_VERSION
* BRYNET_USE_OPENSSL


## Build Example
1. `cmake .`
1. `cmake . -Dbrynet_BUILD_EXAMPLES=ON -Dbrynet_BUILD_TESTS=ON`
2. If you use Windows, please open brynet.sln then build. If on Linux or MacOS, only enter `make`.

## Install
## Only Install
1. `cmake .`
2. `sudo make install`

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ before_build:
- cd %APPVEYOR_BUILD_FOLDER%
- git submodule update --init --recursive
- echo Running cmake...
- cmake -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% . -G "Visual Studio %VS_VERSION%"
- cmake -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% . -Dbrynet_BUILD_EXAMPLES=ON -Dbrynet_BUILD_TESTS=ON -G "Visual Studio %VS_VERSION%"

build:
project: brynet.sln
Expand Down
4 changes: 2 additions & 2 deletions tests/test_wait_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TEST_CASE("WaitGroup are computed", "[waitgroup]") {

wg->add(2);

std::atomic<int> upvalue = ATOMIC_VAR_INIT(1);
std::atomic<int> upvalue = ATOMIC_VAR_INIT(0);
auto a = std::thread([&]() {
upvalue++;
wg->done();
Expand All @@ -23,7 +23,7 @@ TEST_CASE("WaitGroup are computed", "[waitgroup]") {
});
wg->wait();

//REQUIRE(upvalue == 2);
REQUIRE(upvalue == 2);
wg->wait();
if (a.joinable())
{
Expand Down

0 comments on commit 8522002

Please sign in to comment.