Skip to content

Commit

Permalink
add cmake install
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuo committed May 24, 2011
1 parent c837f7c commit 4685322
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 2.6)

project(muduo CXX)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

set(CXX_FLAGS
-g
# -DVALGRIND
Expand Down Expand Up @@ -31,6 +35,13 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O2 -finline-limit=1000 -DNDEBUG")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

find_package( Boost )
if(NOT Boost_FOUND)
message(FATAL_ERROR "Can not find Boost!")
endif()

include_directories(${Boost_INCLUDE_DIRS})

include_directories(${PROJECT_SOURCE_DIR})

add_subdirectory(muduo/base)
Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ set -x
SOURCE_DIR=`pwd`
BUILD_DIR=${BUILD_DIR:-../build}
BUILD_TYPE=${BUILD_TYPE:-debug}
INSTALL_DIR=${INSTALL_DIR:-../${BUILD_TYPE}-install}

mkdir -p $BUILD_DIR/$BUILD_TYPE \
&& cd $BUILD_DIR/$BUILD_TYPE \
&& cmake --graphviz=dep.dot -DCMAKE_BUILD_TYPE=$BUILD_TYPE $SOURCE_DIR \
&& cmake --graphviz=dep.dot -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $SOURCE_DIR \
&& make $*

cd $SOURCE_DIR && doxygen
Expand Down
4 changes: 4 additions & 0 deletions muduo/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ set(base_SRCS
add_library(muduo_base ${base_SRCS})
target_link_libraries(muduo_base pthread)

install(TARGETS muduo_base DESTINATION lib)
file(GLOB HEADERS "*.h")
install(FILES ${HEADERS} DESTINATION include/muduo/base)

add_subdirectory(tests)
16 changes: 16 additions & 0 deletions muduo/net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ set(net_SRCS
add_library(muduo_net ${net_SRCS})
target_link_libraries(muduo_net muduo_base)

install(TARGETS muduo_net DESTINATION lib)
set(HEADERS
Buffer.h
Callbacks.h
Endian.h
EventLoop.h
EventLoopThread.h
InetAddress.h
SocketsOps.h
TcpClient.h
TcpConnection.h
TcpServer.h
TimerId.h
)
install(FILES ${HEADERS} DESTINATION include/muduo/net)

add_subdirectory(http)
add_subdirectory(inspect)
add_subdirectory(tests)
Expand Down
8 changes: 8 additions & 0 deletions muduo/net/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ set(http_SRCS
add_library(muduo_http ${http_SRCS})
target_link_libraries(muduo_http muduo_net)

install(TARGETS muduo_http DESTINATION lib)
set(HEADERS
HttpRequest.h
HttpResponse.h
HttpServer.h
)
install(FILES ${HEADERS} DESTINATION include/muduo/net/http)

add_executable(httpserver_test tests/HttpServer_test.cc)
target_link_libraries(httpserver_test muduo_http)

Expand Down
4 changes: 4 additions & 0 deletions muduo/net/inspect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ set(inspect_SRCS
add_library(muduo_inspect ${inspect_SRCS})
target_link_libraries(muduo_inspect muduo_http)

install(TARGETS muduo_inspect DESTINATION lib)
file(GLOB HEADERS "*.h")
install(FILES ${HEADERS} DESTINATION include/muduo/net/inspect)

add_executable(inspector_test tests/Inspector_test.cc)
target_link_libraries(inspector_test muduo_inspect)

0 comments on commit 4685322

Please sign in to comment.