Comments (17)
I've seen tinyfsm. It is really great! I needed hierarchical and orthogonal statechart support which is why I wrote this. I also plan to make the event queue distributed.
from tsm.
Decided to use the Catch2 header-only cpp unit testing library to eliminate gtest dependency. Glog dependency will be eliminated by defining "null" LOG and DLOG macros. If the developer wants to use glog, they can include it in their program where these macros resolve to Glog types. Thanks @DJuego! Opening two separate issues to track these. Closing this one.
from tsm.
I don't have a windows system. However, what issue are you facing with windows? Could you send me the output?
from tsm.
Thanks for using tsm! I've created a branch feature/configure_dependencies you can try out. You should be able to configure with "cmake BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=${HOME}/local <path_to_source_dir>" from the build folder. I'm not ready to merge this into master until you/someone tests out the branch.
from tsm.
Thank you for your fast reply!
Ideally, I prefer a pure header-only library. For me, this means that simply including the entt.hpp header should be enough to include the library as a whole and use it. So, not cmake. Obviously the tests could be build optionally.
However, with tsm-feature-configure_dependencies:
#include <tsm/src/tsm.h>
void main()
{
}
I get (Visual Studio 2017 x64):
1>------ Rebuild All started: Project: tsm_msvc2017, Configuration: Debug x64 ------
1>main.cpp
1>p:\mis-proyectos\personal\tsm\inc\tsm\src\uniqueid.h(7): error C3615: constexpr function 'tsm::counter_inc' cannot result in a constant expression
1>p:\mis-proyectos\personal\tsm\inc\tsm\src\uniqueid.h(7): note: failure was because type 'tsm::counter_inc::<lambda_b5e2635d32ab89691d28703f26c345e2>' is not a literal type
1>p:\mis-proyectos\personal\tsm\inc\tsm\src\tsm_log.h(2): fatal error C1083: Cannot open include file: 'tsm_config.h': No such file or directory
1>Done building project "tsm_msvc2017.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Anyway, i will test the CMake build procedure...
DJuego
from tsm.
My first try with CMake 3.13.3 was unsucessful.
I got:
Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
Could NOT find GFlags (missing: GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
CMake Error at cmake/superbuild/dependencies.cmake:54 (message):
source code directory path length is too long (77 > 50).Please move the tsm
source code directory to a directory with a shorter path.
Call Stack (most recent call first):
CMakeLists.txt:41 (include)
Configuring incomplete, errors occurred!
See also "P:/Compilados/x32-x64/TRABAJO_MSVC2017_x64/BehaviorTree.CPP/builds/debug/CMakeFiles/CMakeOutput.log".
I had never had an error like that with Cmake.
All right. I will shorten the path ...
DJuego
from tsm.
With Default options:
USE_GLOG OFF
BUILD_TESTS ON
I got:
Tiempo transcurrido 00:00:06.52
Module path:P:/Compilados/x32-x64/tsm/cmakeP:/Compilados/x32-x64/tsm/cmake/modulesP:/Compilados/x32-x64/tsm/cmake/superbuildP:/Compilados/x32-x64/tsm/../CMake
Could NOT find GFlags (missing: GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
CMake Error at P:/Desarrollo/cmake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
Call Stack (most recent call first):
P:/Desarrollo/cmake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindGlog.cmake:39 (find_package_handle_standard_args)
CMakeLists.txt:59 (find_package)
Configuring incomplete, errors occurred!
See also "P:/Compilados/x32-x64/tsm/builds/debug/CMakeFiles/CMakeOutput.log".
Now i will try:
USE_GLOG OFF
BUILD_TESTS OFF
Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
Could NOT find GFlags (missing: GFLAGS_LIBRARY)
Could NOT find Glog (missing: GLOG_LIBRARY)
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
Module path:P:/Compilados/x32-x64/tsm/cmakeP:/Compilados/x32-x64/tsm/cmake/modulesP:/Compilados/x32-x64/tsm/cmake/superbuildP:/Compilados/x32-x64/tsm/../CMake
CMAKE_INSTALL_PREFIX: P:/Compilados/x32-x64/tsm/builds/debug/Windows
Found Doxygen: P:/Desarrollo/Documentador/doxygen/x64/bin/doxygen.exe (found version "1.8.15") found components: doxygen dot
Configuring done
Success!
However, i opened the generated .sln project (msvc 2017 solution), I built and then i got a new bunch of errors... Fortunately, it seems related to documentation and dot.
2>Generating docs for compound tsm::IHsmDef...
2>Generating docs for compound tsm::InternalTransitionT...
2>Generating docs for compound tsm::MethodNotImplementedException...
2>CUSTOMBUILD : error : Problems running dot: exit code=-1, command='dot', arguments='"P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_orthogonal_state_machine_8h__dep__incl.dot" -Tpng -o "P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_orthogonal_state_machine_8h__dep__incl.png"'
2>CUSTOMBUILD : error : Problems running dot: exit code=-1, command='dot', arguments='"P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_event_queue_8h__dep__incl.dot" -Tpng -o "P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_event_queue_8h__dep__incl.png"'
2>CUSTOMBUILD : error : Problems running dot: exit code=-1, command='dot', arguments='"P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_orthogonal_state_machine_8h__incl.dot" -Tpng -o "P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_orthogonal_state_machine_8h__incl.png"'
2>CUSTOMBUILD : error : Problems running dot: exit code=-1, command='dot', arguments='"P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_async_execution_policy_8h__incl.dot" -Tpng -o "P:/Compilados/x32-x64/tsm/builds/debug/docs/html/_async_execution_policy_8h__incl.png"'
[...]
DJuego
from tsm.
It should generate documentation only if you have doxygen installed. Can you comment out the option to generate documentation in the root CmakeLists.txt and try again?
from tsm.
Yes. Success. Really i have doxygen, but not installed. Habitually, i have to specify the path in the CMake parameters... But don´t worry for now
Good. Success. it has generated the tsm_config.h with content: /* #undef USE_GLOG */
:-DDD
I included it in the proyect. I test:
#include <tsm/src/tsm.h>
int main()
{
return 0;
}.
I got:
1>------ Build started: Project: tsm_msvc2017, Configuration: Debug x64 ------
1>main.cpp
1>p:\mis-proyectos\personal\tsm\inc\tsm\src\uniqueid.h(7): error C3615: constexpr function 'tsm::counter_inc' cannot result in a constant expression
1>p:\mis-proyectos\personal\tsm\inc\tsm\src\uniqueid.h(7): note: failure was because type 'tsm::counter_inc::<lambda_b5e2635d32ab89691d28703f26c345e2>' is not a literal type
1>p:\mis-proyectos\personal\tsm\inc\tsm\src\eventqueue.h(27): warning C4521: 'tsm::dummy_mutex': multiple copy constructors specified
1>Done building project "tsm_msvc2017.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
DJuego
from tsm.
I believe at this time msvc does not support lamba functions in constexpr functions. Can you check that by writing a simple test?
from tsm.
Unfortunately, my c++ skills are too limited. :-( However i have circumvented the problem with the flag ISO C++17 Standard (/std:c++17). tsm has the tag c-plus-plus-17, but maybe you should make it more explicit.
Now i got :
1>------ Build started: Project: tsm_msvc2017, Configuration: Release x64 ------
1>main.cpp
1>p:\mis-proyectos\personal\tsm\inc\tsm\src\eventqueue.h(27): warning C4521: 'tsm::dummy_mutex': multiple copy constructors specified
1>Generating code
1>All 8 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
1>Finished generating code
1>tsm_msvc2017.vcxproj -> P:\Mis-Proyectos\Personal\tsm\prj\tsm_msvc2017\x64\Release\tsm_msvc2017.exe
1>Done building project "tsm_msvc2017.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Of course there is no guarantee that it will run correctly. Perhaps you can produce a minimal and complete sample test code?
Thanks
DJuego
from tsm.
Of course there is no guarantee that it will run correctly. Perhaps you can produce a minimal and
complete sample test code?
So I think we definitely need to get the unit tests (BUILD_TESTS option) working on windows. I've made some changes in the feature/configure_dependencies. Can you update and test again? If the binary ./bin/tsm_test is created, just run it.
from tsm.
I have updated to new tsm-feature-configure_dependencies. Unfortunately, it does not work.
With Default options:
USE_GLOG OFF
BUILD_TESTS ON
I have attached the output log and CMakeOutput.log.
CMakeOutput.log
log.txt
DJuego
from tsm.
I'm setting up a windows vm and looking into it.
from tsm.
I've pushed a commit to the feature branch. It will build the tests and run them. That way you know it's working. However, linking to glog libraries is broken. Hope it's useful.
from tsm.
Thank you for your efforts!
And congratulations! It works! Apparently all tests passed.
However i miss a x64 configuration. Now it only has a x86 configuration (win32) in tests.
There are things that I wish would be different. My personal preference is that it should not be necessary to build anything in order to use the library, and zero-dependencies. Simply we should just drop the library into the code. No special installation steps should be needed. See, for example, https://digint.ch/tinyfsm.
But it is your library, and it is likely that you have good technical reasons to make that decision.
Thank you again @dibsonmuad !
DJuego
from tsm.
I don't force any configuration to be 32-bit. I remember why I stayed away from windows :). GTest usually has a lot of trouble as well. The main issue was that gtest v1.8.0 was breaking on msvc 2017. I had to rev up the version to v1.8.1.
from tsm.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsm.