FreeYourSoul / FSeam

Cpp header only library to manage compile time mock class generated via Python script
MIT License
86 stars 8 forks source link

Please make the version of python configurable at CMake time. #6

Closed dashneptune closed 4 years ago

dashneptune commented 5 years ago

It would be nice to not have the python path hard coded. On my system this causes build to fail as the default python is python2. Ideally it would be given in as a parameter to cmake upon setup, or alternatively, have CMake find python3 instead of python at configure time.

That said, I may be missing something dumb.

I will include my build error below

dashneptune commented 5 years ago

Cmake setup: -- The C compiler identification is GNU 7.4.0 -- The CXX compiler identification is GNU 7.4.0 -- Check for working C compiler: /usr/bin/gcc-7 -- Check for working C compiler: /usr/bin/gcc-7 -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/g++-7 -- Check for working CXX compiler: /usr/bin/g++-7 -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- FSeam v1.0.1 -- add custom command for testFSeam with fileToMock /home/marcintrosh/FSeam/test/src/DependencyNonGettable.hh with command : python;/home/marcintrosh/FSeam/test/../Generator/FSeamerFile.py /home/marcintrosh/FSeam/test/src/DependencyNonGettable.hh /home/marcintrosh/FSeam/build/test -- add custom command for testFSeam with fileToMock /home/marcintrosh/FSeam/test/src/DependencyGettable.hh with command : python;/home/marcintrosh/FSeam/test/../Generator/FSeamerFile.py /home/marcintrosh/FSeam/test/src/DependencyGettable.hh /home/marcintrosh/FSeam/build/test -- add custom command for testFSeamFreeFunction with fileToMock /home/marcintrosh/FSeam/test/src/FreeFunctionClass.hh with command : python;/home/marcintrosh/FSeam/test/../Generator/FSeamerFile.py /home/marcintrosh/FSeam/test/src/FreeFunctionClass.hh /home/marcintrosh/FSeam/build/test -- Configuring done -- Generating done -- Build files have been written to: /home/marcintrosh/FSeam/build

Build: /usr/local/bin/cmake -S/home/marcintrosh/FSeam -B/home/marcintrosh/FSeam/build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/local/bin/cmake -E cmake_progress_start /home/marcintrosh/FSeam/build/CMakeFiles /home/marcintrosh/FSeam/build/CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all make[1]: Entering directory '/home/marcintrosh/FSeam/build' make -f test/CMakeFiles/testFSeamFreeFunction.dir/build.make test/CMakeFiles/testFSeamFreeFunction.dir/depend make[2]: Entering directory '/home/marcintrosh/FSeam/build' [ 3%] Generating FSEAM code for /home/marcintrosh/FSeam/test/src/FreeFunctionClass.hh cd /home/marcintrosh/FSeam/build/test && python /home/marcintrosh/FSeam/test/../Generator/FSeamerFile.py /home/marcintrosh/FSeam/test/src/FreeFunctionClass.hh /home/marcintrosh/FSeam/build/test FSeam generated file FreeFunctionClass.fseam.cc at /home/marcintrosh/FSeam/build/test FSeam generated file FSeamMockData.hpp at /home/marcintrosh/FSeam/build/test FSeam generated file FSeamSpecialization.cpp at /home/marcintrosh/FSeam/build/test cd /home/marcintrosh/FSeam/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/marcintrosh/FSeam /home/marcintrosh/FSeam/test /home/marcintrosh/FSeam/build /home/marcintrosh/FSeam/build/test /home/marcintrosh/FSeam/build/test/CMakeFiles/testFSeamFreeFunction.dir/DependInfo.cmake --color= Scanning dependencies of target testFSeamFreeFunction make[2]: Leaving directory '/home/marcintrosh/FSeam/build' make -f test/CMakeFiles/testFSeamFreeFunction.dir/build.make test/CMakeFiles/testFSeamFreeFunction.dir/build make[2]: Entering directory '/home/marcintrosh/FSeam/build' [ 7%] Building CXX object test/CMakeFiles/testFSeamFreeFunction.dir/src/DependencyNonGettable.cpp.o cd /home/marcintrosh/FSeam/build/test && /usr/bin/g++-7 -DFSEAM_USE_CATCH2 -I/home/marcintrosh/FSeam/test/src -I/home/marcintrosh/FSeam/build/test -I/home/marcintrosh/FSeam/test/../FSeam -I/home/marcintrosh/FSeam/FSeam -isystem /usr/local/include -std=gnu++1z -o CMakeFiles/testFSeamFreeFunction.dir/src/DependencyNonGettable.cpp.o -c /home/marcintrosh/FSeam/test/src/DependencyNonGettable.cpp [ 10%] Building CXX object test/CMakeFiles/testFSeamFreeFunction.dir/src/DependencyGettable.cpp.o cd /home/marcintrosh/FSeam/build/test && /usr/bin/g++-7 -DFSEAM_USE_CATCH2 -I/home/marcintrosh/FSeam/test/src -I/home/marcintrosh/FSeam/build/test -I/home/marcintrosh/FSeam/test/../FSeam -I/home/marcintrosh/FSeam/FSeam -isystem /usr/local/include -std=gnu++1z -o CMakeFiles/testFSeamFreeFunction.dir/src/DependencyGettable.cpp.o -c /home/marcintrosh/FSeam/test/src/DependencyGettable.cpp [ 14%] Building CXX object test/CMakeFiles/testFSeamFreeFunction.dir/src/TestingClass.cpp.o cd /home/marcintrosh/FSeam/build/test && /usr/bin/g++-7 -DFSEAM_USE_CATCH2 -I/home/marcintrosh/FSeam/test/src -I/home/marcintrosh/FSeam/build/test -I/home/marcintrosh/FSeam/test/../FSeam -I/home/marcintrosh/FSeam/FSeam -isystem /usr/local/include -std=gnu++1z -o CMakeFiles/testFSeamFreeFunction.dir/src/TestingClass.cpp.o -c /home/marcintrosh/FSeam/test/src/TestingClass.cpp [ 17%] Building CXX object test/CMakeFiles/testFSeamFreeFunction.dir/FreeFunctionClass.fseam.cc.o cd /home/marcintrosh/FSeam/build/test && /usr/bin/g++-7 -DFSEAM_USE_CATCH2 -I/home/marcintrosh/FSeam/test/src -I/home/marcintrosh/FSeam/build/test -I/home/marcintrosh/FSeam/test/../FSeam -I/home/marcintrosh/FSeam/FSeam -isystem /usr/local/include -std=gnu++1z -o CMakeFiles/testFSeamFreeFunction.dir/FreeFunctionClass.fseam.cc.o -c /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc In file included from /home/marcintrosh/FSeam/build/test/FSeamMockData.hpp:11:0, from /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:8: /home/marcintrosh/FSeam/test/../FSeam/FSeam/FSeam.hpp:1:1: error: expected unqualified-id before ‘.’ token ../FSeam.hpp ^ In file included from /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:8:0: /home/marcintrosh/FSeam/build/test/FSeamMockData.hpp:51:20: error: ‘TypeParseTraits’ is not a class template template <> struct TypeParseTraits { ^~~~~~~ /home/marcintrosh/FSeam/build/test/FSeamMockData.hpp:51:36: error: ‘source’ was not declared in this scope template <> struct TypeParseTraits { ^~ /home/marcintrosh/FSeam/build/test/FSeamMockData.hpp:51:36: note: suggested alternative: ‘double’ template <> struct TypeParseTraits { ^~ double /home/marcintrosh/FSeam/build/test/FSeamMockData.hpp:51:63: error: explicit specialization of non-template ‘FSeam::TypeParseTraits’ template <> struct TypeParseTraits { ^ In file included from /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:9:0: /home/marcintrosh/FSeam/test/../FSeam/FSeam/FSeam.hpp:1:1: error: expected unqualified-id before ‘.’ token ../FSeam.hpp ^ /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:32:5: error: ‘source’ has not been declared int source::freeFunctionReturn() { ^~ /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc: In function ‘int freeFunctionReturn()’: /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:33:32: error: ‘FSeam::MockVerifier’ has not been declared auto mockVerifier = FSeam::MockVerifier::instance().getDefaultMock("FreeFunction"); ^~~~ /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc: At global scope: /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:41:6: error: ‘source’ has not been declared void source::freeFunctionWithArguments(int arg1, int arg2, char arg3) { ^~ /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc: In function ‘void freeFunctionWithArguments(int, int, char)’: /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:42:32: error: ‘FSeam::MockVerifier’ has not been declared auto mockVerifier = FSeam::MockVerifier::instance().getDefaultMock("FreeFunction"); ^~~~ /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc: At global scope: /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:56:5: error: ‘source’ has not been declared int source::FreeFunctionClass::staticFunction() { ^~ /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc: In function ‘int staticFunction()’: /home/marcintrosh/FSeam/build/test/FreeFunctionClass.fseam.cc:57:32: error: ‘FSeam::MockVerifier’ has not been declared auto mockVerifier = FSeam::MockVerifier::instance().getDefaultMock("FreeFunction");

FreeYourSoul commented 5 years ago

From the look of it, It looks like the generation of FSeam files had an issue. Can you delete the files FSeamMockData.hpp, and the *.fseam.cc files in order to have a proper trigger of the generation.

dashneptune commented 5 years ago

Same issue. I'll mess around for a bit and let you know if I can fix the issue

dashneptune commented 5 years ago

Confirmed that switching to python3 did not fix the issue, however it would still be a nice to have

FreeYourSoul commented 5 years ago

I keep this issue opened for the improvement (by the way you are welcomed to make the improvement if you desire to and provide a PullRequest). But it good to note that the python path is not hardcoded, the env variable called PYTHON_EXECUTABLE set by cmake is used. You can choose which python is executed by using cmake while changing this variable for example: cmake -DPYTHON_EXECUTABLE=python3

Concerning your issue, TypeParseTraits is a type trait generated by FSeam in order to find the name of the class to mock in a string format by using the type. I will dig into it on my side myself. But as it is compiling for me it may be hard to find out the problem.

dashneptune commented 5 years ago

I'll go ahead and close this then. Thanks

FreeYourSoul commented 5 years ago

I am currently trying to reproduce your issue, tell me if you found out what the issue is,

Thank you

dashneptune commented 5 years ago

Will do! I think this is a great project

FreeYourSoul commented 5 years ago

Thank you, the idea is great, but the execution needs a lot of fine-tuning to make it widely usable :)

dashneptune commented 4 years ago

I have a commit that fixes the issue I was seeing here as well as others that I found. What is your process for pull requests?

FreeYourSoul commented 4 years ago

Sorry, i am currently in holliday. I didn't set any real process. You can fork the project create a pr. I will merge it

FreeYourSoul commented 4 years ago

A process has been written. https://github.com/FreeYourSoul/FSeam/blob/master/docs/contributing.md Basically very basic. For now, just create your own branch and ask for a merge on master which is the only branch of the repo. In case of major features (like introduction of Modules in C++20 which will be very interesting for FSeam), there will be a specific branch in order to test it fully before merging it definitely with master.