Unverified Commit 50b8e999 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #191 from brpc/cmake_support

make lib include bin into $PWD/output & make all example be able to be compiled by default
parents 0a08308b 022859a1
......@@ -131,9 +131,9 @@ set(DYNAMIC_LIB
)
# for *.so
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib)
# for *.a
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib)
# list all source files
set(BUTIL_SOURCES
......@@ -310,6 +310,20 @@ if(BUILD_UNIT_TESTS)
add_subdirectory(test)
endif()
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/idl_options.pb.h
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/output/include)
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/brpc/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/output/include/brpc/
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)
file(COPY ${CMAKE_SOURCE_DIR}/src/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/output/include/
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/
DESTINATION include
FILES_MATCHING
......
cmake_minimum_required(VERSION 2.8.10)
project(asynchronous_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(backup_request_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(cancel_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(cascade_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(dynamic_partition_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(echo_c++_hulu_pbrpc C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(echo_c++_sofa_pbrpc C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(echo_c++_ubrpc_compack C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
set(PROTOC_GEN_MCPACK_PATH "" CACHE STRING "the path to protoc_gen_mcpack")
if("${PROTOC_GEN_MCPACK_PATH}" STREQUAL "")
message(FATAL_ERROR "Please set PROTOC_GEN_MCPACK_PATH variable(-DPROTOC_GEN_MCPACK_PATH=<value>).")
endif()
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
......@@ -79,7 +77,7 @@ set(DYNAMIC_LIB
)
execute_process(
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR} --plugin=protoc-gen-mcpack=${PROTOC_GEN_MCPACK_PATH}/protoc-gen-mcpack --mcpack_out=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/echo.proto
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR} --plugin=protoc-gen-mcpack=${OUTPUT_PATH}/bin/protoc-gen-mcpack --mcpack_out=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/echo.proto
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
......
cmake_minimum_required(VERSION 2.8.10)
project(http_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER http.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(memcache_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(multi_threaded_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(multi_threaded_echo_fns_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(multi_threaded_mcpack_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
set(PROTOC_GEN_MCPACK_PATH "" CACHE STRING "the path to protoc_gen_mcpack")
if("${PROTOC_GEN_MCPACK_PATH}" STREQUAL "")
message(FATAL_ERROR "Please set PROTOC_GEN_MCPACK_PATH variable(-DPROTOC_GEN_MCPACK_PATH=<value>).")
endif()
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
......@@ -84,7 +82,7 @@ set(DYNAMIC_LIB
)
execute_process(
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR} --plugin=protoc-gen-mcpack=${PROTOC_GEN_MCPACK_PATH}/protoc-gen-mcpack --mcpack_out=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/echo.proto
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR} --plugin=protoc-gen-mcpack=${OUTPUT_PATH}/bin/protoc-gen-mcpack --mcpack_out=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/echo.proto
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
......
cmake_minimum_required(VERSION 2.8.10)
project(nshead_extension_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(nshead_pb_extension_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(parallel_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(partition_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(redis_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
# Install dependencies:
# With apt:
# sudo apt-get install libreadline-dev
......@@ -16,6 +11,13 @@ project(redis_c++ C CXX)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
......
cmake_minimum_required(VERSION 2.8.10)
project(selective_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(session_data_and_thread_local C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
cmake_minimum_required(VERSION 2.8.10)
project(streaming_echo_c++ C CXX)
# if you want to specify the path of brpc header and lib,
# set the following two variables.
#set(CMAKE_INCLUDE_PATH /path/to/include)
#set(CMAKE_LIBRARY_PATH /path/to/lib)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
execute_process(
COMMAND bash -c "find ${CMAKE_SOURCE_DIR}/../.. -type d -name \"include\" | xargs dirname | tr -d '\n'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set(CMAKE_PREFIX_PATH ${OUTPUT_PATH})
include(FindThreads)
include(FindProtobuf)
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
......
......@@ -25,6 +25,9 @@ if(WITH_GLOG)
target_link_libraries(brpc ${GLOG_LIB})
endif()
# for protoc-gen-mcpack
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/output/bin)
set(protoc_gen_mcpack_SOURCES
${CMAKE_SOURCE_DIR}/src/mcpack2pb/generator.cpp
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment