Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32Arduino on Linux #15

Closed
sidey79 opened this issue Mar 28, 2018 · 9 comments
Closed

win32Arduino on Linux #15

sidey79 opened this issue Mar 28, 2018 · 9 comments
Labels
enhancement New feature or request
Milestone

Comments

@sidey79
Copy link
Contributor

sidey79 commented Mar 28, 2018

Is there any chance to get rid of the win32 specific libs / functions used in this lib?

I wanted to run some integration tests with travic ci but there are serval things missing.

@end2endzone
Copy link
Owner

end2endzone commented Apr 12, 2018

That's a good idea and I had this planned for a long time. I am locally working on porting all scripts from /ci/appveyor to /ci/ant to have cross-Platform scripts. However, I do not have much experience programming in Linux (I do own a Raspberry Pi & a Ubuntu partition).

I do not know how many sections of the library would be impacted by the change but I think it would be possible without too much work. Nothing that a google search can't fix.

@end2endzone
Copy link
Owner

I think it would be a matter of wrapping each function implementation with #ifdef statements. See stackoverflow for details.

@end2endzone
Copy link
Owner

I would be glad if you give me a hand on this and help me porting the code to linux. Feel free to send me a pull request.

@sidey79
Copy link
Contributor Author

sidey79 commented Apr 12, 2018

I am not so familiar with all the win32 libs.

I think, there are std cpp libs which are available crossplattform.

But win32arduino usues win32 specific libs.

There are some very easy to fix T
things.

end2endzone added a commit that referenced this issue Apr 13, 2018
end2endzone added a commit that referenced this issue Apr 13, 2018
…form usability.

Created ant `clean`, `compile` and `test` target.
Required for issue #15 - win32Arduino on Linux
end2endzone added a commit that referenced this issue Apr 13, 2018
…oad test result.

Required for issue #15 - win32Arduino on Linux
end2endzone added a commit that referenced this issue Apr 13, 2018
…sts.txt` as per cmake best practices.

Moved `build` directory from `/src/build` to `/build`.
Moved product version definition to `/CMakeLists.txt`.
Modified `/CMakeLists.txt` to generate version files and scripts.
Required for issue #15 - win32Arduino on Linux
@end2endzone end2endzone added this to the 2.1 milestone Apr 14, 2018
@end2endzone end2endzone added the enhancement New feature or request label Apr 14, 2018
end2endzone added a commit that referenced this issue Apr 14, 2018
Created nativefunc.h/nativefunc.cpp files which purpose is to provide cross-platform code.
Removed usage of #include <windows.h> code. Replaced by code from nativefunc.h
Removed #pragma once statements.
Wrapped all include files by #ifndef, #define and #endif statements.
Deleted targetver.h which is a win32 deprecated file.
Required for issue #15 - win32Arduino on Linux
end2endzone added a commit that referenced this issue Apr 15, 2018
…ialPrinter.h:51:14: error: explicit specialization in non-namespace scope'. Fixed arduino.cpp:97:50: error: 'vsprintf_s' was not declared in this scope. Fixed arduino.cpp:465:58: error: no match for 'operator<<'. Required for cross-platform issue #15 - win32Arduino on Linux
end2endzone added a commit that referenced this issue Apr 15, 2018
…tringfunc.cpp:103:30: error: 'itoa' was not declared in this scope. Reimplemented isNumeric() using valid code. Fixed gtesthelper.cpp:1:25: fatal error: gTestHelper.h: No such file or directory. Fixed gtesthelper.cpp:519:9: error: expected primary-expression before 'unsigned'. Required for cross-platform issue #15 - win32Arduino on Linux.
end2endzone added a commit that referenced this issue Apr 15, 2018
…. Created ant target reset to delete all project artifacts. Fixed nativefunc.cpp:30:20: warning: narrowing conversion of '(milliseconds / 1000u)' from 'uint32_t {aka unsigned int}' to '__time_t'. Fixed nativefunc.cpp:31:36: warning: narrowing conversion of '(((milliseconds % 1000u) * 1000u) * 1000u)' from 'uint32_t {aka unsigned int}' to '__syscall_slong_t {aka long int}'. Required for cross-platform issue #15 - win32Arduino on Linux.
@end2endzone
Copy link
Owner

@sidey79 I would appreciate your help for issue #17.

@end2endzone
Copy link
Owner

@sidey79 The code is now able to compile without errors on the Raspberry Pi. However, I am not able to compile on Travis CI.

The following error is displayed in the Travis CI build log:

     [exec] /home/travis/build/end2endzone/win32Arduino/src/win32Arduino/arduino.cpp: In function ‘void randomSeed(int16_t)’:
     [exec] /home/travis/build/end2endzone/win32Arduino/src/win32Arduino/arduino.cpp:926:3: error: ‘::srand’ has not been declared
     [exec]    ::srand(value);

I do not have enough experience for fixing the issue. Does it mean that srand() definition is located elsewhere? Can you take a look at it?

@sidey79
Copy link
Contributor Author

sidey79 commented Apr 15, 2018

@end2endzone
You are fast..

I haven't tested it, but the function you try to call, seems not to exist:

Not sure, what the compiler does with this style of coding, but srand and rand should be located in
stdlib:
http://www.cplusplus.com/reference/cstdlib/srand/
http://www.cplusplus.com/reference/cstdlib/rand/

@sidey79
Copy link
Contributor Author

sidey79 commented Apr 16, 2018

Fixes are here:
#18

@end2endzone
Copy link
Owner

Fixed in 623f317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants