Coder Social home page Coder Social logo

Comments (4)

oktal avatar oktal commented on June 29, 2024

Hello,

Have you tried following the instructions from the README ?

Basically, the classic pattern to compile a project using CMake is to create a build directory inside the project's root directory, then running cmake, then make to compile the library:

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=release
make

Note that you will need Boost as a dependency for this library. You have multiple choices here:

  • Either install Boost through your system's favorite package manager. For example, on Ubuntu, you can run sudo apt install libboost1.65-dev
  • Install directly from sources

If you choose to install boost in a custom location (that CMake can't find by itself), make sure to specify the BOOST_ROOT and/or BOOS_LIBRARY_DIR variables when invoking CMake:

cmake -DCMAKE_BUILD_TYPE=Release -DBOOST_ROOT=/path/to/your/boost ..

If you do not want to bother installing boost and other dependencies, you might want to try building the Disruptor with conan.

You will need to install conan first.

Then, checkout the yet-to-be-merged conan branch:

git checkout cmake-conan

Then, prior to running CMake inside your build directory, run conan to fetch the dependencies:

conan install ..

After that, follow the rest of the procedure to build with CMake.

Hope that helps.

from disruptor-cpp.

ThomasP1988 avatar ThomasP1988 commented on June 29, 2024

Thanks for your answer,
I already have boost but didnt use it with conan,

  1. i've did a git clone in {project}/external, then i launched the build as in the doc
  2. in my cmakelist i include(Disruptor)
  3. then i add it in target_link_libraries

but when i "make" my project, i get this error:
fatal error: Disruptor/IEventHandler.h: No such file or directory
1 | #include "Disruptor/IEventHandler.h"
I do something wrong but i can't find what, it probably seems obvious but i'm quite a beginner with cmake

from disruptor-cpp.

oktal avatar oktal commented on June 29, 2024

So if I understand correctly, you project's layout looks like this:

root_project
|
| ---- external/Disruptor
| ---- CMakeLists.txt

If you want it to work properly, you need to add the Disruptor as a subdirectory in your root CMakeLists like so:

add_subdirectory(external/Disruptor)

This will make CMake aware of the Disruptor and its targets, and build it if needed.

Then, you need to link against the right Disruptor targets (CMake will take care of adding the path to the include directories as well):

target_link_libraries(my_project PUBLIC DisruptorStatic)

from disruptor-cpp.

ThomasP1988 avatar ThomasP1988 commented on June 29, 2024

Hi oktal,

actually i was missing this : target_include_directories(${LIBRARY_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/external/Disruptor)

thank you very much for your library and for your help.

from disruptor-cpp.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.