Closed mnesarco closed 1 year ago
I love this library because it provides cancel-able, detachable, and split-able futures. But if Qt and boost are now required dependencies, I am afraid I cannot use it anymore and there are no alternatives :( Very sad.
The requirements have not changed. Boost is required if you are building the tests (which use boost test) or if you require boost optional/variant (because you don't have C++17). QT is optional if you are trying to use the QT schedulers.
cmake
is only being used to generate the config.hpp if you are not building tests file (you can also provide one manually). What is your cmake
command? To test I just uninstalled boost and tried this:
cmake -S . -B ../builds/noboost -DCMAKE_CXX_STANDARD=17 -DBUILD_TESTING=OFF
And it worked fine.
Hi @sean-parent thank you for looking into this.
I can build the lib appart and it works if BUILD_TESTING=OFF
, but in my project I am using the lib with add_subdirectory(3rdparty/stlab)
and I don´t want to set BUILD_TESTING=OFF for the whole project. Is there a way to disable tests only for stlab? something like STLAB_BUILD_TESTING=OFF
?
Even with BUILD_TESTING=OFF
it does not work with add_subdirectory(3rdparty/stlab)
[cmake] CMake Error: File /xxx/stlab/config.hpp.in does not exist.
[cmake] CMake Error at 3rdparty/stlab/cmake/StlabUtil.cmake:203 (configure_file):
[cmake] configure_file Problem configuring file
[cmake] Call Stack (most recent call first):
[cmake] 3rdparty/stlab/stlab/CMakeLists.txt:44 (stlab_generate_config_file)
It works out of the box with 1.6.2
Special treatment for add_subdirectory
was present in 1.6.2's CMakeLists.txt
https://github.com/stlab/libraries/blob/0a7232a4120c2daf8ddb6621ec13f313a029e495/CMakeLists.txt#L32
But it was removed in 1.7.1 Maybe it is related.
@camio Issue may be fixed by recent PR? Can you take a look?
Issue is present in main branch
Oh something was merged some minutes ago. I will retry.
Ok https://github.com/stlab/libraries/commit/9a75c3decbb12fca58c996be604a03b8184fc332 fixed the build. Thank you @laserallan @camio
BUILD_TESTING=OFF
is still required to avoid boost, the former option to disable tests was definitively removed. so basically now it is all or nothing.
Another strange thing is this error on program termination (in 1.7.1 not present in 1.6.2):
libc++abi: terminating
Aborted (core dumped)
The termination exception is from priority_task_system destructor:
~priority_task_system() {
assert(_q.empty() && "stlab: Thread pool not joined prior to destruction.");
}
Is there any lifecycle management required in 1.7.1 that was not required in 1.6.2?
Termination exception solved by calling stlab::pre_exit();
before returning from main. I am sorry, it was clearly specified in CHANGES.md 🤦🏼♂️
Is there a way to disable tests only for stlab?
Setting BUILD_TESTING=OFF
before calling add_subdirectory
should work I believe.
BUILD_TESTING=OFF affects other subprojects. I only want to disable tests of stlab to avoid boost dependency. A possible solution: https://github.com/stlab/libraries/pull/509 ?
See the set documentation. As long as the variable isn't a CACHE variable, which it shouldn't be, then set
will apply only to the current directory scope and not impact other parts of your project.
So if you keep your stuff in 3rdparty
, 3rdparty/CMakeLists.txt
would look like this:
set(BUILD_TESTING OFF)
add_subdirectory(stlab)
# ...
# set(BUILD_TESTING OFF) <--- affects all below
add_subdirectory(3rdparty/stlab)
add_subdirectory(3rdparty/imgui)
add_subdirectory(3rdparty/sqlite3)
add_subdirectory(3rdparty/nlohmann/json)
add_subdirectory(3rdparty/stb)
add_subdirectory(3rdparty/rapidxml_ns)
add_subdirectory(3rdparty/tigl-partial)
What you are proposing is something like this?:
set(BUILD_TESTING OFF)
add_subdirectory(3rdparty/stlab)
set(BUILD_TESTING ON)
add_subdirectory(3rdparty/imgui)
add_subdirectory(3rdparty/sqlite3)
add_subdirectory(3rdparty/nlohmann/json)
add_subdirectory(3rdparty/stb)
add_subdirectory(3rdparty/rapidxml_ns)
add_subdirectory(3rdparty/tigl-partial)
I was assuming you don't want to enable testing for any of your 3rdparty libraries. If you only want to disable it for stlab then your second snippet looks right.
Those are only part of the 3rdparty submodules, others are own projects but included as 3rdparty in this specific project and some of them need to run tests that depend on config.
I will try the second snipped. Thank your for the info.
@camio It worked. Thank you, I am sorry for all the noise.
For reference:
set(GLOBAL_BUILD_TESTING ${BUILD_TESTING})
set(BUILD_TESTING OFF)
add_subdirectory(3rdparty/stlab)
set(BUILD_TESTING ${GLOBAL_BUILD_TESTING})
unset(GLOBAL_BUILD_TESTING)
FWIW I think that can be simplified to this:
block()
set(BUILD_TESTING OFF)
add_subdirectory(3rdparty/stlab)
endblock()
block() looks good, but it requires cmake 3.25.
Hello Friends, I have a project using 1.6.2, I am not using Qt at all. I tried to upgrade it to 1.7.1 today and apparently Qt5 is now required and also Boost.
How can I avoid these new dependencies? In my cmake project I just include stlab folder:
It used to work. I am very bad at cmake but I upgraded stlab before without issues just replacing the folder with a new version.