Skip to content

Restructure dirs #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 9, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "deps/gtest"]
path = deps/gtest
url = git://github.com/cpp-netlib/gtest
[submodule "uri"]
path = uri
url = git://github.com/cpp-netlib/uri
65 changes: 35 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ find_package( OpenSSL )
find_package( Threads )
set(CMAKE_VERBOSE_MAKEFILE true)

if (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DNETWORK_DEBUG)
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DNETWORK_DEBUG)
endif()



if (OPENSSL_FOUND)
add_definitions(-DNETWORK_ENABLE_HTTPS)
add_definitions(-DNETWORK_ENABLE_HTTPS)
endif()

if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
Expand Down Expand Up @@ -68,48 +70,51 @@ endif()
message("C++ Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
message("C++ Flags: ${CMAKE_CXX_FLAGS} link flags: ${CMAKE_CXX_LINK_FLAGS}")
if (Boost_FOUND)
if (MSVC)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
endif(MSVC)
if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0501)
endif(WIN32)
include_directories(${Boost_INCLUDE_DIRS})
if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
endif()
#add_subdirectory(libs/network/src)
if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
#add_subdirectory(libs/network/test)
if (NOT MSVC)
#add_subdirectory(libs/mime/test)
endif(NOT MSVC)
endif()
if(CPP-NETLIB_BUILD_EXAMPLES)
#add_subdirectory(libs/network/example)
endif()
if (MSVC)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
endif(MSVC)
if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0501)
endif(WIN32)
include_directories(${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)

if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
endif()

message(STATUS "CPP-NETLIB Options selected:")
message(STATUS "CPP-NETLIB options selected:")
message(STATUS " CPP-NETLIB_BUILD_SHARED_LIBS: ${CPP-NETLIB_BUILD_SHARED_LIBS}\t(Build cpp-netlib as shared libraries: OFF, ON)")
message(STATUS " CPP-NETLIB_BUILD_TESTS: ${CPP-NETLIB_BUILD_TESTS}\t(Build the unit tests: ON, OFF)")
message(STATUS " CPP-NETLIB_BUILD_EXAMPLES: ${CPP-NETLIB_BUILD_EXAMPLES}\t(Build the examples using cpp-netlib: ON, OFF)")
message(STATUS " CPP-NETLIB_ALWAYS_LOGGING: ${CPP-NETLIB_ALWAYS_LOGGING}\t(Allow cpp-netlib to log debug messages even in non-debug mode: ON, OFF)")
message(STATUS " CPP-NETLIB_DISABLE_LOGGING: ${CPP-NETLIB_DISABLE_LOGGING}\t(Disable logging definitely, no logging code will be generated or compiled: ON, OFF)")
message(STATUS "CMake build options selected:")

############################################################################
#
# The code following this point is for the new directory structure
#

if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
if(MSVC11)
add_definitions(-D_VARIADIC_MAX=10)
endif(MSVC11)
if(MSVC)
set(gtest_force_shared_crt ON CACHE BOOL "Override gtest option.")
endif(MSVC)
add_subdirectory(deps/gtest)
set(GTEST_ROOT ${CPP-NETLIB_SOURCE_DIR}/deps/gtest)
set(GTEST_FOUND ON)
set(GTEST_INCLUDE_DIRS ${GTEST_ROOT}/include)
set(GTEST_LIBRARIES gtest)
set(GTEST_MAIN_LIBRARIES gtest_main)
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
endif()

add_subdirectory(uri)
add_subdirectory(message)
add_subdirectory(logging)
add_subdirectory(concurrency)
add_subdirectory(http)
add_subdirectory(mime)
#add_subdirectory(mime)
if(CPP-NETLIB_BUILD_EXAMPLES)
add_subdirectory(contrib/http_examples)
endif()
65 changes: 24 additions & 41 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,44 @@ You can find official release packages of the library at::
Building and Installing
-----------------------

Configuring the submodules
~~~~~~~~~~~~~~~~~~~~~~~~~~

The project contains submodules for some dependencies and some
libraries. Once you have cloned cpp-netlib, you must update the
submodules:

::

$ cd ~/cpp-netlib
$ git submodule update

Building with CMake
~~~~~~~~~~~~~~~~~~~

To build the libraries and run the tests with CMake, you will need to
have CMake version 2.8 or higher installed appropriately in your
have CMake version 2.8.10 or higher installed appropriately in your
system.

::

$ cmake --version
cmake version 2.8.1
cmake version 2.8.10

Inside the cpp-netlib directory, you can issue the following statements to
configure and generate the Makefiles, and build the tests::

$ cd ~/cpp-netlib # we're assuming it's where cpp-netlib is
$ cmake -DCMAKE_BUILD_TYPE=Debug \
$ cmake ~/cpp-netlib-build \ # cmake is built out of source
> -DCMAKE_BUILD_TYPE=Debug \
> -DCMAKE_C_COMPILER=clang \
> -DCMAKE_CXX_COMPILER=clang++ \
> .

Once CMake is done with generating the Makefiles and configuring the project,
you can now build the tests and run them::

$ cd ~/cpp-netlib
$ cd ~/cpp-netlib-build
$ make
$ make test

Expand All @@ -67,42 +80,14 @@ list`_.

.. _`developers mailing list`: cpp-netlib@googlegroups.com

Building with Boost.Build
~~~~~~~~~~~~~~~~~~~~~~~~~

If you don't already have Boost.Build set up on your system, follow the steps
indicated in the Boost Getting Started Guide [#]_ -- you will particularly want
to copy the ``bjam`` executable to a directory that is already in your ``PATH``
so that you don't have to go hunting for it all the time. A good place to put it
is in ``/usr/local/bin``.

.. [#] http://www.boost.org/doc/libs/release/more/getting_started/

Building and running the tests can be as simple as doing the following::

$ cd ~/cpp-netlib
$ bjam

Doing this will already build all the tests and run them as they are built. In
case you encounter any problems and would like to report it to the developers,
please do the following::

$ cd ~/cpp-netlib
$ bjam 2>&1 >build-test.log

And then attach the ``build-test.log`` file to the email you will send to the
cpp-netlib `developers mailing list`_.

.. _`developers mailing list`: cpp-netlib@googlegroups.com

Running Tests
-------------

If you want to run the tests that come with cpp-netlib, there are a few things
you will need. These are:

* A compiler (GCC 4.x, Clang 2.8, MSVC 2008)
* A build tool (CMake [#]_ recommended, Boost.Build also an option)
* A compiler (GCC 4.7.x, Clang 2.8, MSVC 2012)
* CMake [#]_
* OpenSSL headers (optional)

.. note:: This assumes that you have cpp-netlib at the top-level of
Expand Down Expand Up @@ -136,13 +121,11 @@ would be greatly appreciated. Copious amounts of comments will be called out,
but code that is not self-explanatory typically at least requires a rationale
documentation in comments explaining "why" the code is written that way.

The main "upstream" repository is the one hosted by the original maintainer of
the project (Dean Michael Berris) at http://github.com/mikhailberis/cpp-netlib.
The "official" release repository is maintained at
http://github.com/cpp-netlib/cpp-netlib -- which is a fork of the upstream
repository. It is recommended that forks be made against the upstream repostory
and pull requests be submitted against the upstream repository so that patches
and other implementations can be curated by the original maintainer.
The main "upstream" repository and official release repository is
maintained at http://github.com/cpp-netlib/cpp-netlib. It is
recommended that forks and pull requests be submitted to the upstream
repository so that patches and other implementations can be curated by
the project administrators.

Contact and Support
-------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,42 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

include_directories(${CPP-NETLIB_SOURCE_DIR}/include)
include_directories(${CPP-NETLIB_SOURCE_DIR})
include_directories(
${CPP-NETLIB_SOURCE_DIR}/uri/src
${CPP-NETLIB_SOURCE_DIR}/message/src
${CPP-NETLIB_SOURCE_DIR}/logging/src
${CPP-NETLIB_SOURCE_DIR}/http/src
${CPP-NETLIB_SOURCE_DIR})
if (OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
endif (OPENSSL_FOUND)

add_executable(uri_builder uri_builder.cpp)
if( NOT CPP-NETLIB_DISABLE_LOGGING )
set( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
endif()

add_executable(simple_wget simple_wget.cpp)
add_executable(atom_reader atom/atom.cpp atom/main.cpp)
add_executable(rss_reader rss/rss.cpp rss/main.cpp)
add_executable(twitter_search twitter/search.cpp)
add_executable(hello_world_server http/hello_world_server.cpp)
#add_executable(twitter_search twitter/search.cpp)
#add_executable(hello_world_server http/hello_world_server.cpp)
add_executable(hello_world_client http/hello_world_client.cpp)
#if (UNIX)
# add_executable(fileserver http/fileserver.cpp)
#endif (UNIX)
set(BOOST_CLIENT_LIBS
${Boost_DATE_TIME_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_REGEX_LIBRARY}
)
${Boost_DATE_TIME_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_REGEX_LIBRARY}
)
set(BOOST_SERVER_LIBS
${Boost_DATE_TIME_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
)

target_link_libraries(uri_builder
${BOOST_CLIENT_LIBS}
${CMAKE_THREAD_LIBS_INIT}
cppnetlib-uri)
${Boost_DATE_TIME_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
)

target_link_libraries(simple_wget
${BOOST_CLIENT_LIBS}
Expand All @@ -49,7 +51,8 @@ target_link_libraries(simple_wget
cppnetlib-http-message
cppnetlib-constants
cppnetlib-http-client
cppnetlib-http-client-connections)
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})

target_link_libraries(atom_reader
${BOOST_CLIENT_LIBS}
Expand All @@ -62,7 +65,8 @@ target_link_libraries(atom_reader
cppnetlib-http-message-wrappers
cppnetlib-constants
cppnetlib-http-client
cppnetlib-http-client-connections)
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})

target_link_libraries(rss_reader
${BOOST_CLIENT_LIBS}
Expand All @@ -74,26 +78,29 @@ target_link_libraries(rss_reader
cppnetlib-http-message
cppnetlib-constants
cppnetlib-http-client
cppnetlib-http-client-connections)
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})

target_link_libraries(twitter_search
${BOOST_CLIENT_LIBS}
${CMAKE_THREAD_LIBS_INIT}
cppnetlib-uri
cppnetlib-message
cppnetlib-message-directives
cppnetlib-message-wrappers
cppnetlib-http-message-wrappers
cppnetlib-http-message
cppnetlib-constants
cppnetlib-http-client
cppnetlib-http-client-connections)
#target_link_libraries(twitter_search
# ${BOOST_CLIENT_LIBS}
# ${CMAKE_THREAD_LIBS_INIT}
# cppnetlib-uri
# cppnetlib-message
# cppnetlib-message-directives
# cppnetlib-message-wrappers
# cppnetlib-http-message-wrappers
# cppnetlib-http-message
# cppnetlib-constants
# cppnetlib-http-client
# cppnetlib-http-client-connections
# ${CPP-NETLIB_LOGGING_LIB})

target_link_libraries(hello_world_server
${BOOST_SERVER_LIBS}
${CMAKE_THREAD_LIBS_INIT}
cppnetlib-http-server-parsers
cppnetlib-http-server)
#target_link_libraries(hello_world_server
# ${BOOST_SERVER_LIBS}
# ${CMAKE_THREAD_LIBS_INIT}
# cppnetlib-http-server-parsers
# cppnetlib-http-server
# ${CPP-NETLIB_LOGGING_LIB})

target_link_libraries(hello_world_client
${BOOST_CLIENT_LIBS}
Expand All @@ -106,15 +113,15 @@ target_link_libraries(hello_world_client
cppnetlib-http-message
cppnetlib-constants
cppnetlib-http-client
cppnetlib-http-client-connections)
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})

if (OPENSSL_FOUND)
target_link_libraries(uri_builder ${OPENSSL_LIBRARIES})
target_link_libraries(simple_wget ${OPENSSL_LIBRARIES})
target_link_libraries(atom_reader ${OPENSSL_LIBRARIES})
target_link_libraries(rss_reader ${OPENSSL_LIBRARIES})
target_link_libraries(twitter_search ${OPENSSL_LIBRARIES})
target_link_libraries(hello_world_server ${OPENSSL_LIBRARIES})
#target_link_libraries(twitter_search ${OPENSSL_LIBRARIES})
#target_link_libraries(hello_world_server ${OPENSSL_LIBRARIES})
target_link_libraries(hello_world_client ${OPENSSL_LIBRARIES})
endif (OPENSSL_FOUND)

Expand All @@ -126,12 +133,11 @@ endif (OPENSSL_FOUND)
# cppnetlib-server-parsers)
#endif (UNIX)

set_target_properties(uri_builder PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
set_target_properties(simple_wget PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
set_target_properties(atom_reader PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
set_target_properties(rss_reader PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
set_target_properties(twitter_search PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
set_target_properties(hello_world_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
#set_target_properties(twitter_search PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
#set_target_properties(hello_world_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
set_target_properties(hello_world_client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
#if (UNIX)
# set_target_properties(fileserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading