Skip to content

Commit 04fa5f6

Browse files
committed
Merge pull request cpp-netlib#184 from glynos/restructure_dirs
Restructure dirs
2 parents 5b571ad + c08ccd8 commit 04fa5f6

File tree

365 files changed

+2822
-21004
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+2822
-21004
lines changed

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "deps/gtest"]
2+
path = deps/gtest
3+
url = git://github.com/cpp-netlib/gtest
4+
[submodule "uri"]
5+
path = uri
6+
url = git://github.com/cpp-netlib/uri

CMakeLists.txt

+35-30
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ find_package( OpenSSL )
3333
find_package( Threads )
3434
set(CMAKE_VERBOSE_MAKEFILE true)
3535

36-
if (CMAKE_BUILD_TYPE MATCHES Debug)
37-
add_definitions(-DNETWORK_DEBUG)
36+
if(CMAKE_BUILD_TYPE MATCHES Debug)
37+
add_definitions(-DNETWORK_DEBUG)
3838
endif()
3939

40+
41+
4042
if (OPENSSL_FOUND)
41-
add_definitions(-DNETWORK_ENABLE_HTTPS)
43+
add_definitions(-DNETWORK_ENABLE_HTTPS)
4244
endif()
4345

4446
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
@@ -68,48 +70,51 @@ endif()
6870
message("C++ Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
6971
message("C++ Flags: ${CMAKE_CXX_FLAGS} link flags: ${CMAKE_CXX_LINK_FLAGS}")
7072
if (Boost_FOUND)
71-
if (MSVC)
72-
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
73-
endif(MSVC)
74-
if (WIN32)
75-
add_definitions(-D_WIN32_WINNT=0x0501)
76-
endif(WIN32)
77-
include_directories(${Boost_INCLUDE_DIRS})
78-
if(CPP-NETLIB_BUILD_TESTS)
79-
enable_testing()
80-
endif()
81-
#add_subdirectory(libs/network/src)
82-
if(CPP-NETLIB_BUILD_TESTS)
83-
enable_testing()
84-
#add_subdirectory(libs/network/test)
85-
if (NOT MSVC)
86-
#add_subdirectory(libs/mime/test)
87-
endif(NOT MSVC)
88-
endif()
89-
if(CPP-NETLIB_BUILD_EXAMPLES)
90-
#add_subdirectory(libs/network/example)
91-
endif()
73+
if (MSVC)
74+
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
75+
endif(MSVC)
76+
if (WIN32)
77+
add_definitions(-D_WIN32_WINNT=0x0501)
78+
endif(WIN32)
79+
include_directories(${Boost_INCLUDE_DIRS})
9280
endif(Boost_FOUND)
9381

94-
if(CPP-NETLIB_BUILD_TESTS)
95-
enable_testing()
96-
endif()
97-
98-
message(STATUS "CPP-NETLIB Options selected:")
82+
message(STATUS "CPP-NETLIB options selected:")
9983
message(STATUS " CPP-NETLIB_BUILD_SHARED_LIBS: ${CPP-NETLIB_BUILD_SHARED_LIBS}\t(Build cpp-netlib as shared libraries: OFF, ON)")
10084
message(STATUS " CPP-NETLIB_BUILD_TESTS: ${CPP-NETLIB_BUILD_TESTS}\t(Build the unit tests: ON, OFF)")
10185
message(STATUS " CPP-NETLIB_BUILD_EXAMPLES: ${CPP-NETLIB_BUILD_EXAMPLES}\t(Build the examples using cpp-netlib: ON, OFF)")
10286
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)")
10387
message(STATUS " CPP-NETLIB_DISABLE_LOGGING: ${CPP-NETLIB_DISABLE_LOGGING}\t(Disable logging definitely, no logging code will be generated or compiled: ON, OFF)")
88+
message(STATUS "CMake build options selected:")
10489

10590
############################################################################
10691
#
10792
# The code following this point is for the new directory structure
10893
#
10994

95+
if(CPP-NETLIB_BUILD_TESTS)
96+
enable_testing()
97+
if(MSVC11)
98+
add_definitions(-D_VARIADIC_MAX=10)
99+
endif(MSVC11)
100+
if(MSVC)
101+
set(gtest_force_shared_crt ON CACHE BOOL "Override gtest option.")
102+
endif(MSVC)
103+
add_subdirectory(deps/gtest)
104+
set(GTEST_ROOT ${CPP-NETLIB_SOURCE_DIR}/deps/gtest)
105+
set(GTEST_FOUND ON)
106+
set(GTEST_INCLUDE_DIRS ${GTEST_ROOT}/include)
107+
set(GTEST_LIBRARIES gtest)
108+
set(GTEST_MAIN_LIBRARIES gtest_main)
109+
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
110+
endif()
111+
110112
add_subdirectory(uri)
111113
add_subdirectory(message)
112114
add_subdirectory(logging)
113115
add_subdirectory(concurrency)
114116
add_subdirectory(http)
115-
add_subdirectory(mime)
117+
#add_subdirectory(mime)
118+
if(CPP-NETLIB_BUILD_EXAMPLES)
119+
add_subdirectory(contrib/http_examples)
120+
endif()

README.rst

+24-41
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,44 @@ You can find official release packages of the library at::
3333
Building and Installing
3434
-----------------------
3535

36+
Configuring the submodules
37+
~~~~~~~~~~~~~~~~~~~~~~~~~~
38+
39+
The project contains submodules for some dependencies and some
40+
libraries. Once you have cloned cpp-netlib, you must update the
41+
submodules:
42+
43+
::
44+
45+
$ cd ~/cpp-netlib
46+
$ git submodule update
47+
3648
Building with CMake
3749
~~~~~~~~~~~~~~~~~~~
3850

3951
To build the libraries and run the tests with CMake, you will need to
40-
have CMake version 2.8 or higher installed appropriately in your
52+
have CMake version 2.8.10 or higher installed appropriately in your
4153
system.
4254

4355
::
4456

4557
$ cmake --version
46-
cmake version 2.8.1
58+
cmake version 2.8.10
4759

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

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

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

60-
$ cd ~/cpp-netlib
73+
$ cd ~/cpp-netlib-build
6174
$ make
6275
$ make test
6376

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

6881
.. _`developers mailing list`: [email protected]
6982

70-
Building with Boost.Build
71-
~~~~~~~~~~~~~~~~~~~~~~~~~
72-
73-
If you don't already have Boost.Build set up on your system, follow the steps
74-
indicated in the Boost Getting Started Guide [#]_ -- you will particularly want
75-
to copy the ``bjam`` executable to a directory that is already in your ``PATH``
76-
so that you don't have to go hunting for it all the time. A good place to put it
77-
is in ``/usr/local/bin``.
78-
79-
.. [#] http://www.boost.org/doc/libs/release/more/getting_started/
80-
81-
Building and running the tests can be as simple as doing the following::
82-
83-
$ cd ~/cpp-netlib
84-
$ bjam
85-
86-
Doing this will already build all the tests and run them as they are built. In
87-
case you encounter any problems and would like to report it to the developers,
88-
please do the following::
89-
90-
$ cd ~/cpp-netlib
91-
$ bjam 2>&1 >build-test.log
92-
93-
And then attach the ``build-test.log`` file to the email you will send to the
94-
cpp-netlib `developers mailing list`_.
95-
96-
.. _`developers mailing list`: [email protected]
97-
9883
Running Tests
9984
-------------
10085

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

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

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

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

147130
Contact and Support
148131
-------------------

libs/network/example/CMakeLists.txt renamed to contrib/http_examples/CMakeLists.txt

+54-48
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,42 @@
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6-
include_directories(${CPP-NETLIB_SOURCE_DIR}/include)
7-
include_directories(${CPP-NETLIB_SOURCE_DIR})
6+
include_directories(
7+
${CPP-NETLIB_SOURCE_DIR}/uri/src
8+
${CPP-NETLIB_SOURCE_DIR}/message/src
9+
${CPP-NETLIB_SOURCE_DIR}/logging/src
10+
${CPP-NETLIB_SOURCE_DIR}/http/src
11+
${CPP-NETLIB_SOURCE_DIR})
812
if (OPENSSL_FOUND)
913
include_directories(${OPENSSL_INCLUDE_DIR})
1014
endif (OPENSSL_FOUND)
1115

12-
add_executable(uri_builder uri_builder.cpp)
16+
if( NOT CPP-NETLIB_DISABLE_LOGGING )
17+
set( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
18+
endif()
19+
1320
add_executable(simple_wget simple_wget.cpp)
1421
add_executable(atom_reader atom/atom.cpp atom/main.cpp)
1522
add_executable(rss_reader rss/rss.cpp rss/main.cpp)
16-
add_executable(twitter_search twitter/search.cpp)
17-
add_executable(hello_world_server http/hello_world_server.cpp)
23+
#add_executable(twitter_search twitter/search.cpp)
24+
#add_executable(hello_world_server http/hello_world_server.cpp)
1825
add_executable(hello_world_client http/hello_world_client.cpp)
1926
#if (UNIX)
2027
# add_executable(fileserver http/fileserver.cpp)
2128
#endif (UNIX)
2229
set(BOOST_CLIENT_LIBS
23-
${Boost_DATE_TIME_LIBRARY}
24-
${Boost_SYSTEM_LIBRARY}
25-
${Boost_FILESYSTEM_LIBRARY}
26-
${Boost_PROGRAM_OPTIONS_LIBRARY}
27-
${Boost_REGEX_LIBRARY}
28-
)
30+
${Boost_DATE_TIME_LIBRARY}
31+
${Boost_SYSTEM_LIBRARY}
32+
${Boost_FILESYSTEM_LIBRARY}
33+
${Boost_PROGRAM_OPTIONS_LIBRARY}
34+
${Boost_REGEX_LIBRARY}
35+
)
2936
set(BOOST_SERVER_LIBS
30-
${Boost_DATE_TIME_LIBRARY}
31-
${Boost_SYSTEM_LIBRARY}
32-
${Boost_FILESYSTEM_LIBRARY}
33-
${Boost_PROGRAM_OPTIONS_LIBRARY}
34-
)
35-
36-
target_link_libraries(uri_builder
37-
${BOOST_CLIENT_LIBS}
38-
${CMAKE_THREAD_LIBS_INIT}
39-
cppnetlib-uri)
37+
${Boost_DATE_TIME_LIBRARY}
38+
${Boost_SYSTEM_LIBRARY}
39+
${Boost_FILESYSTEM_LIBRARY}
40+
${Boost_PROGRAM_OPTIONS_LIBRARY}
41+
)
4042

4143
target_link_libraries(simple_wget
4244
${BOOST_CLIENT_LIBS}
@@ -49,7 +51,8 @@ target_link_libraries(simple_wget
4951
cppnetlib-http-message
5052
cppnetlib-constants
5153
cppnetlib-http-client
52-
cppnetlib-http-client-connections)
54+
cppnetlib-http-client-connections
55+
${CPP-NETLIB_LOGGING_LIB})
5356

5457
target_link_libraries(atom_reader
5558
${BOOST_CLIENT_LIBS}
@@ -62,7 +65,8 @@ target_link_libraries(atom_reader
6265
cppnetlib-http-message-wrappers
6366
cppnetlib-constants
6467
cppnetlib-http-client
65-
cppnetlib-http-client-connections)
68+
cppnetlib-http-client-connections
69+
${CPP-NETLIB_LOGGING_LIB})
6670

6771
target_link_libraries(rss_reader
6872
${BOOST_CLIENT_LIBS}
@@ -74,26 +78,29 @@ target_link_libraries(rss_reader
7478
cppnetlib-http-message
7579
cppnetlib-constants
7680
cppnetlib-http-client
77-
cppnetlib-http-client-connections)
81+
cppnetlib-http-client-connections
82+
${CPP-NETLIB_LOGGING_LIB})
7883

79-
target_link_libraries(twitter_search
80-
${BOOST_CLIENT_LIBS}
81-
${CMAKE_THREAD_LIBS_INIT}
82-
cppnetlib-uri
83-
cppnetlib-message
84-
cppnetlib-message-directives
85-
cppnetlib-message-wrappers
86-
cppnetlib-http-message-wrappers
87-
cppnetlib-http-message
88-
cppnetlib-constants
89-
cppnetlib-http-client
90-
cppnetlib-http-client-connections)
84+
#target_link_libraries(twitter_search
85+
# ${BOOST_CLIENT_LIBS}
86+
# ${CMAKE_THREAD_LIBS_INIT}
87+
# cppnetlib-uri
88+
# cppnetlib-message
89+
# cppnetlib-message-directives
90+
# cppnetlib-message-wrappers
91+
# cppnetlib-http-message-wrappers
92+
# cppnetlib-http-message
93+
# cppnetlib-constants
94+
# cppnetlib-http-client
95+
# cppnetlib-http-client-connections
96+
# ${CPP-NETLIB_LOGGING_LIB})
9197

92-
target_link_libraries(hello_world_server
93-
${BOOST_SERVER_LIBS}
94-
${CMAKE_THREAD_LIBS_INIT}
95-
cppnetlib-http-server-parsers
96-
cppnetlib-http-server)
98+
#target_link_libraries(hello_world_server
99+
# ${BOOST_SERVER_LIBS}
100+
# ${CMAKE_THREAD_LIBS_INIT}
101+
# cppnetlib-http-server-parsers
102+
# cppnetlib-http-server
103+
# ${CPP-NETLIB_LOGGING_LIB})
97104

98105
target_link_libraries(hello_world_client
99106
${BOOST_CLIENT_LIBS}
@@ -106,15 +113,15 @@ target_link_libraries(hello_world_client
106113
cppnetlib-http-message
107114
cppnetlib-constants
108115
cppnetlib-http-client
109-
cppnetlib-http-client-connections)
116+
cppnetlib-http-client-connections
117+
${CPP-NETLIB_LOGGING_LIB})
110118

111119
if (OPENSSL_FOUND)
112-
target_link_libraries(uri_builder ${OPENSSL_LIBRARIES})
113120
target_link_libraries(simple_wget ${OPENSSL_LIBRARIES})
114121
target_link_libraries(atom_reader ${OPENSSL_LIBRARIES})
115122
target_link_libraries(rss_reader ${OPENSSL_LIBRARIES})
116-
target_link_libraries(twitter_search ${OPENSSL_LIBRARIES})
117-
target_link_libraries(hello_world_server ${OPENSSL_LIBRARIES})
123+
#target_link_libraries(twitter_search ${OPENSSL_LIBRARIES})
124+
#target_link_libraries(hello_world_server ${OPENSSL_LIBRARIES})
118125
target_link_libraries(hello_world_client ${OPENSSL_LIBRARIES})
119126
endif (OPENSSL_FOUND)
120127

@@ -126,12 +133,11 @@ endif (OPENSSL_FOUND)
126133
# cppnetlib-server-parsers)
127134
#endif (UNIX)
128135

129-
set_target_properties(uri_builder PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
130136
set_target_properties(simple_wget PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
131137
set_target_properties(atom_reader PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
132138
set_target_properties(rss_reader PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
133-
set_target_properties(twitter_search PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
134-
set_target_properties(hello_world_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
139+
#set_target_properties(twitter_search PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
140+
#set_target_properties(hello_world_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
135141
set_target_properties(hello_world_client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
136142
#if (UNIX)
137143
# set_target_properties(fileserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)