-
Notifications
You must be signed in to change notification settings - Fork 735
Standard install paths #58
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
Conversation
If you want the travis test to succeed, use |
Hi, I didn't get the meaning of your first post. Is 'install path' means the install path of boost? |
I mean, normally, install with cmake (or make) is made to deploy your libraries to /usr/local/lib by default but you can also change the path with CMAKE_INSTALL_PREFIX. It is used to "install" your libraries and programs in standard folders to make them available for everyone. That is the standard way to do in lot of projects for packaging, development. I don't know what is the goal of the actual implementation but I think this not conventional. I downloaded lots of libraries, built them and installed them, it was always the same : cmake ../ or ./configure As for boost libraries, I don't see the point in installing them as they are not part of your library. You need them, you don't provide them. If a program is compiled with your library it has to use the same cmake commands as yours to link against boost. |
As written in the previous post, |
I was about to submit the same pull request. When will this be merged? Currently I use this lib like this:
#include <sio_client.h>
int main() {
sio::client{}.connect("wss://echo.websocket.org/");
return 0;
}
cmake_minimum_required(VERSION 3.10)
project(socket_demo)
include(ExternalProject)
include(GNUInstallDirs)
set(EXTERNAL_PROJECTS_PREFIX ${CMAKE_BINARY_DIR}/external-projects)
set(EXTERNAL_PROJECTS_INSTALL_PREFIX ${EXTERNAL_PROJECTS_PREFIX}/installed)
include(ProcessorCount)
ProcessorCount(CPU_COUNT)
if(CPU_COUNT EQUAL 0)
set(CPU_COUNT 1)
endif()
math(EXPR CPU_COUNT "${CPU_COUNT} / 2 + 1")
ExternalProject_Add(external_rapid_json
PREFIX "${EXTERNAL_PROJECTS_PREFIX}"
URL "https://github.com/Tencent/rapidjson/archive/73063f5002612c6bf64fe24f851cd5cc0d83eef9.zip"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_PROJECTS_INSTALL_PREFIX}
-DRAPIDJSON_BUILD_DOC=OFF
-DRAPIDJSON_BUILD_EXAMPLES=OFF
-DRAPIDJSON_BUILD_TESTS=OFF
)
set_target_properties(external_rapid_json PROPERTIES EXCLUDE_FROM_ALL TRUE)
ExternalProject_Add(external_boost
PREFIX "${EXTERNAL_PROJECTS_PREFIX}"
URL "https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz"
URL_HASH SHA256=8aa4e330c870ef50a896634c931adf468b21f8a69b77007e45c444151229f665
UPDATE_COMMAND ""
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ./bootstrap.sh --without-libraries=python --prefix=${EXTERNAL_PROJECTS_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
BUILD_COMMAND ./b2 link=static cxxflags=-fPIC --prefix=${EXTERNAL_PROJECTS_INSTALL_PREFIX} -j ${CPU_COUNT} install
INSTALL_COMMAND ""
)
set_target_properties(external_boost PROPERTIES EXCLUDE_FROM_ALL TRUE)
ExternalProject_Add(external_websocketpp
PREFIX "${EXTERNAL_PROJECTS_PREFIX}"
URL "https://github.com/zaphoyd/websocketpp/archive/0.8.1.tar.gz"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_PROJECTS_INSTALL_PREFIX}
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTS=OFF
)
set_target_properties(external_websocketpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
add_dependencies(external_websocketpp external_boost)
ExternalProject_Add(external_socket_io_client
PREFIX "${EXTERNAL_PROJECTS_PREFIX}"
URL "https://github.com/macq-vraman/socket.io-client-cpp/archive/7176b4649def7d2a7d43a518988892fcb8beb1d5.zip"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_PROJECTS_INSTALL_PREFIX}
-DBUILD_SHARED_LIBS=OFF
-DBoost_USE_STATIC_LIBS=ON
)
set_target_properties(external_socket_io_client PROPERTIES EXCLUDE_FROM_ALL TRUE)
add_dependencies(external_socket_io_client external_rapid_json)
add_dependencies(external_socket_io_client external_websocketpp)
link_directories(${EXTERNAL_PROJECTS_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
add_executable(${PROJECT_NAME} main.cpp)
target_include_directories(${PROJECT_NAME}
PRIVATE $<BUILD_INTERFACE:${EXTERNAL_PROJECTS_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}>)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME}
PRIVATE Threads::Threads sioclient boost_system)
add_dependencies(${PROJECT_NAME} external_socket_io_client) # comment to prevent build on each build |
Merged as d353647. |
* upstream/master: docs: update compatibility table for Socket.IO v4 docs: fix title format (socketio#297) feat: allow resource path to be set in connection URI (socketio#134) fix: resolve client_impl::ping LOG call syntax in debug builds fix: resolve socketio#254: handle closing sockets upon on_fail events fix: lower the minimum CMake supported version feat: implement socketio#45: add support for logging configuration feat: add support for Socket.IO v3 refactor: use correct Engine.IO protocol revision refactor: use standard install paths (socketio#58) ci: migrate to GitHub Actions chore: update .gitignore with cmake output refactor: remove Boost dependency (socketio#176)
* tag '2.0.0': refactor: use correct Engine.IO protocol revision refactor: use standard install paths (socketio#58) ci: migrate to GitHub Actions chore: update .gitignore with cmake output refactor: remove Boost dependency (socketio#176)
For now, the install path is hardcoded inside the project folder. I don't know why exactly but it is not really useful for deployment.
I propose to use the standard way to do, allowing us also to use CMAKE_INSTALL_PREFIX to deploy properly the library and its headers.