felixguendling / cista

Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.
https://cista.rocks
MIT License
1.78k stars 113 forks source link

Documentation request: how to build and run tests #171

Closed AdelKS closed 1 year ago

AdelKS commented 1 year ago

Hello!

I tried to add the project to my IDE (Qt Creator) and it kept telling me there's nothing to compile :thinking:

Then I tried the simple CLI approach

git clone https://github.com/felixguendling/cista.git
cd cista
mkdir build
cd build
cmake ..
cmake --build .

And nothing happens, am I missing something ? I have near to zero knowledge in cmake (went for meson directly in my own projects)

felixguendling commented 1 year ago

I think the reason is EXCLUDE_FROM_ALL in CMakeLists.txt. You need to give it a specific target to build. For example: cmake --build . --target cista-test

AdelKS commented 1 year ago

Ah yeah that works thanks! is it possible to support --target all ? It seem that my IDE is trying to use that instead, is it common ?

felixguendling commented 1 year ago

You mean to remove the EXCLUDE_FROM_ALL from the executable targets? That would be cista-test and cista-single-header-test? Or also the amalgamation tool? I think it's best if the user selects what they would like to run. Otherwise, you end up building a lot of stuff again and again that you don't use (e.g. cista-test and cista-single-header-test are redundant, the latter one is only required to check that the release single header works).

AdelKS commented 1 year ago

I am not sure what I am asking, but I suppose to have this to work

git clone https://github.com/felixguendling/cista.git
cd cista
mkdir build
cd build
cmake ..
cmake --build . --target all

This what I saw my IDE doing. Is it possible to define the target "all" so the above works (so yeah basically building every target) ? or is "all" a cmake specific target. In any case, I figured out how to build only cista-test so we are all good !

We can close this issue without doing anything. Although I suppose a small addition the the readme with

git clone https://github.com/felixguendling/cista.git
cd cista
mkdir build
cd build
cmake ..
cmake --build . --target cista-test

is welcome

felixguendling commented 1 year ago

I guess all is a CMake specific target. Naming a target all would increase the risk of name collisions (and I don't know if that's even possible). I will add your how-to to the wiki. Thank you!

felixguendling commented 1 year ago

Update: https://github.com/felixguendling/cista/wiki/Installation-and-Usage#developer-setup