|
| 1 | +cmake_minimum_required(VERSION 2.8.4) |
| 2 | +project(ccf-xmpp) |
| 3 | +include(ExternalProject) |
| 4 | +#### EXTERNALS #### |
| 5 | + |
| 6 | +#safec |
| 7 | +ExternalProject_Add( |
| 8 | + libsafec |
| 9 | + BUILD_IN_SOURCE 1 |
| 10 | + URL http://sourceforge.net/projects/safeclib/files/libsafec-10052013.tar.gz/download |
| 11 | + PATCH_COMMAND "" |
| 12 | + CONFIGURE_COMMAND ./configure |
| 13 | + BUILD_COMMAND make |
| 14 | + INSTALL_COMMAND "" |
| 15 | + LOG_DOWNLOAD ON |
| 16 | + LOG_CONFIGURE ON |
| 17 | + LOG_BUILD ON |
| 18 | +) |
| 19 | + |
| 20 | + |
| 21 | +ExternalProject_Get_Property(libsafec source_dir) |
| 22 | +include_directories( |
| 23 | + ${source_dir}/include |
| 24 | +) |
| 25 | +add_library(safec UNKNOWN IMPORTED) |
| 26 | +set_property(TARGET safec PROPERTY IMPORTED_LOCATION ${source_dir}/src/.libs/libsafec-1.0.so) |
| 27 | +add_dependencies(safec libsafec) |
| 28 | + |
| 29 | +#rapidxml |
| 30 | +ExternalProject_Add( |
| 31 | + rapidxml |
| 32 | + URL https://github.com/dwarburt/RapidXML/archive/v0.1.tar.gz |
| 33 | + PATCH_COMMAND patch < ${CMAKE_SOURCE_DIR}/patches/rapidxml-no-ending.patch && patch < ${CMAKE_SOURCE_DIR}/patches/rapidxml-partial-parse.patch && patch < ${CMAKE_SOURCE_DIR}/patches/rapidxml-non-template-flags.patch |
| 34 | + CONFIGURE_COMMAND "" |
| 35 | + BUILD_COMMAND "" |
| 36 | + INSTALL_COMMAND "" |
| 37 | + LOG_DOWNLOAD ON |
| 38 | +) |
| 39 | +ExternalProject_Get_Property(rapidxml source_dir) |
| 40 | +include_directories( |
| 41 | + ${source_dir} |
| 42 | +) |
| 43 | + |
| 44 | +#googlemock |
| 45 | +ExternalProject_Add( |
| 46 | + googlemock |
| 47 | + URL http://googlemock.googlecode.com/files/gmock-1.7.0.zip |
| 48 | + INSTALL_COMMAND "" |
| 49 | + LOG_DOWNLOAD ON |
| 50 | + LOG_CONFIGURE ON |
| 51 | + LOG_BUILD ON |
| 52 | +) |
| 53 | +ExternalProject_Get_Property(googlemock source_dir) |
| 54 | +include_directories( |
| 55 | + ${source_dir}/include |
| 56 | + ${source_dir}/gtest/include |
| 57 | +) |
| 58 | +ExternalProject_Get_Property(googlemock binary_dir) |
| 59 | +add_library(gmock UNKNOWN IMPORTED) |
| 60 | +set_property(TARGET gmock PROPERTY IMPORTED_LOCATION ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock.a) |
| 61 | +add_dependencies(gmock googlemock) |
| 62 | + |
| 63 | + |
| 64 | +#openssl |
| 65 | +#find_package(OpenSSL REQUIRED) |
| 66 | +#include_directories(${OpenSSL_INCLUDE_DIRS}) |
| 67 | + |
| 68 | + |
| 69 | +#asio |
| 70 | +ExternalProject_Add( |
| 71 | + asio_cpp |
| 72 | + URL https://github.com/chriskohlhoff/asio/archive/master.zip |
| 73 | + PATCH_COMMAND "" |
| 74 | + CONFIGURE_COMMAND "" |
| 75 | + BUILD_COMMAND "" |
| 76 | + INSTALL_COMMAND "" |
| 77 | + LOG_DOWNLOAD ON |
| 78 | + LOG_CONFIGURE ON |
| 79 | + LOG_BUILD ON |
| 80 | +) |
| 81 | +ExternalProject_Get_Property(asio_cpp source_dir) |
| 82 | +include_directories( |
| 83 | + ${source_dir}/asio/include |
| 84 | +) |
| 85 | +ExternalProject_Get_Property(asio_cpp binary_dir) |
| 86 | + |
| 87 | + |
| 88 | +#libstrophe |
| 89 | +ExternalProject_Add( |
| 90 | + libstrophe |
| 91 | + # In the orignal build environment where this was tested master.zip had symbolic links that |
| 92 | + # would not process. Using URL is fine where this is not an issue. |
| 93 | + #URL https://github.com/strophe/libstrophe/archive/master.zip |
| 94 | + DOWNLOAD_COMMAND wget https://github.com/strophe/libstrophe/archive/master.zip COMMAND unzip master.zip -x libstrophe-master/README |
| 95 | + PATCH_COMMAND "" |
| 96 | + SOURCE_DIR libstrophe-prefix/src/libstrophe-master |
| 97 | + BUILD_IN_SOURCE 1 |
| 98 | + CONFIGURE_COMMAND pwd COMMAND ./bootstrap.sh COMMAND ./configure |
| 99 | + BUILD_COMMAND make |
| 100 | + INSTALL_COMMAND "" |
| 101 | + LOG_DOWNLOAD ON |
| 102 | + LOG_CONFIGURE ON |
| 103 | + LOG_BUILD ON |
| 104 | +) |
| 105 | +ExternalProject_Get_Property(libstrophe source_dir) |
| 106 | +include_directories( |
| 107 | + ${source_dir}/ |
| 108 | +) |
| 109 | +ExternalProject_Get_Property(libstrophe binary_dir) |
| 110 | +add_library(strophe UNKNOWN IMPORTED) |
| 111 | +set_property(TARGET strophe PROPERTY IMPORTED_LOCATION ${binary_dir}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}strophe.so) |
| 112 | +add_dependencies(strophe libstrophe) |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | +set(CMAKE_EXE_LINKER_FLAGS "-flto") |
| 117 | + |
| 118 | + |
| 119 | +#### XMPP #### |
| 120 | + |
| 121 | +#add_subdirectory(src/xmpp) |
| 122 | +set(ccfxmpp_sources |
| 123 | + src/common/bufferencrypt.cpp |
| 124 | + src/common/buffers.cpp |
| 125 | + src/common/compatibility.cpp |
| 126 | + src/common/errorabstraction.cpp |
| 127 | + src/common/rand_helper.cpp |
| 128 | + src/common/str_helpers.cpp |
| 129 | + src/common/logstream.cpp |
| 130 | + src/xml/portabledom.cpp |
| 131 | + src/connect/proxy.cpp |
| 132 | + src/connect/connecterror.cpp |
| 133 | + src/connect/curlconnect.cpp |
| 134 | + src/connect/tcpclient.cpp |
| 135 | + src/bosh/httpclient.cpp |
| 136 | + src/bosh/boshclient.cpp |
| 137 | + src/xmpp/jabberid.cpp |
| 138 | + src/xmpp/sasl.cpp |
| 139 | + src/xmpp/xmppclient.cpp |
| 140 | + src/xmpp/xmppstrophe.cpp |
| 141 | + src/xmpp/xmppconfig.cpp |
| 142 | + src/xmpp/xmppextension.cpp |
| 143 | + src/xmpp/xmppregister.cpp |
| 144 | + src/xmpp/xmppstream.cpp |
| 145 | + src/xmpp/xmppping.cpp |
| 146 | + src/xmpp/xmpppubsub.cpp |
| 147 | + src/xmpp/xmppservicedisc.cpp |
| 148 | +) |
| 149 | + |
| 150 | +add_definitions(-D_GNU_SOURCE |
| 151 | + -std=c++11 |
| 152 | + -fdata-sections |
| 153 | + -ffunction-sections |
| 154 | + -flto |
| 155 | + -fno-rtti |
| 156 | + -DENABLE_LIBSTROPHE |
| 157 | + -DLOGSTREAM_ENABLE_ALL_LOGGING |
| 158 | + #-fvisibility=hidden |
| 159 | + -DCCF_XMPP_EXPORTS |
| 160 | + -Os |
| 161 | + -Wl,--gc-sections |
| 162 | + -Wl,--strip-all |
| 163 | + -Wall |
| 164 | + -Wno-unknown-pragmas |
| 165 | + -Werror) |
| 166 | + |
| 167 | +include_directories(src src/platform/linux) |
| 168 | +add_library(ccfxmpp SHARED ${ccfxmpp_sources}) |
| 169 | +add_dependencies(ccfxmpp safec rapidxml) |
| 170 | +target_link_libraries(ccfxmpp |
| 171 | + safec |
| 172 | + strophe |
| 173 | +) |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | +# XMPP Tests |
| 178 | + |
| 179 | + |
| 180 | +set(ccfxmpp_test_sources |
| 181 | + test/unittest_base.cpp |
| 182 | + test/common_tests.cpp |
| 183 | + test/curl_tests.cpp |
| 184 | + test/bosh_tests.cpp |
| 185 | + test/xmpp_tests.cpp |
| 186 | + test/xmpp_dummy_server.cpp |
| 187 | + test/xmpp_compliance_tests.cpp |
| 188 | + test/tcp_tests.cpp |
| 189 | + test/ping_tests.cpp |
| 190 | + test/pubsub_tests.cpp |
| 191 | + test/register_tests.cpp |
| 192 | + test/servicedisc_tests.cpp |
| 193 | + test/portabledom_tests.cpp |
| 194 | +) |
| 195 | +include_directories(src src/platform/linux) |
| 196 | +add_executable(ccfxmpp_tests ${ccfxmpp_test_sources}) |
| 197 | +add_dependencies(ccfxmpp_tests ccfxmpp rapidxml safec gmock) |
| 198 | +target_link_libraries(ccfxmpp_tests |
| 199 | + ccfxmpp |
| 200 | + strophe |
| 201 | + gmock |
| 202 | + curl |
| 203 | + ssl |
| 204 | + pthread |
| 205 | + crypto |
| 206 | + safec |
| 207 | +) |
| 208 | + |
| 209 | +#add_custom_command(TARGET ccfxmpp POST_BUILD |
| 210 | +# COMMAND strip $<TARGET_FILE:ccfxmpp> |
| 211 | +#) |
| 212 | + |
| 213 | + |
0 commit comments