open-dis / open-dis-cpp

C++ implementation of the IEEE-1278.1 Distributed Interactive Simulation (DIS) application protocol v6 and v7
BSD 2-Clause "Simplified" License
90 stars 65 forks source link

building open-dis-cpp with cmake #89

Open AJPerriello opened 9 months ago

AJPerriello commented 9 months ago

I want to build open-dis ccp dis6 source as a shared library. I don't need examples. I am building on a machine that has cmake and most everything needed for development. If this build is going to need more than I can not install that, need to work with what I have, which should be enough anyhow, can I please have an example of linux command line to cmake and build

i tried .. cmake -BUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -S src (I'm sunning that in a directory that contains src/dis6, src/dis7 CMakeLists.txt I tried using cmake3 as well cmake -h doesn't help much :) Do I need to make entries in CMakeLists? I assumed, just download, install, and do cmake -S -B and turn on SHARED_LIBS, but so far isn't working. thanks

wadehunk commented 9 months ago

There could be a couple of things going on here based on the command you ran. Try the following:

git clone https://github.com/open-dis/open-dis-cpp.git
cd open-dis-cpp
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/path/to/install ..
cmake --build .
cmake --install .

The key is to do an out-of-source build and point the source directory to where the top-level CMakeLists.txt file is located.

crhowell3 commented 8 months ago

@leif81 We could update the README to be a little more explicit on using CMake. I might throw this into #83.