-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix code and build system to build on Visual C++ (#25) #34
base: develop
Are you sure you want to change the base?
Conversation
This commit is based on work from RadAd (RadAd/libtsm@f879875) It also adds GitHub Actions support for Windows, changes code that relied on gcc extensions, and introduces Conan to install libcheck in a platform agnostic way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many things happened in life and I finally got some time to sit down and review some PRs. Hopefully you are still interested in contributing :P
Overall LGTM minus a few minor comments.
@@ -27,6 +27,8 @@ | |||
#include "libtsm.h" | |||
#include "libtsm-int.h" | |||
|
|||
#define ESC "\x1b" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we directly use "\x1b"? I feel using a macro here doesn't add too much value.
#ifdef _MSC_VER | ||
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0) | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unused?
#ifdef _MSC_VER | ||
struct line **cache = malloc(sizeof(struct line *) * num); | ||
if (!cache) { | ||
llog_warning(con, "Out of memory"); | ||
return; | ||
} | ||
#else | ||
struct line *cache[num]; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using non-constant variables as array size is nonstandard anyway. Let's just use the malloc version on all platforms.
- name: Configure CMake on Unix | ||
if: ${{ !startsWith(matrix.config.name, 'Windows') }} | ||
working-directory: ./build | ||
run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DBUILD_TESTING=On -DBUILD_GTKTSM=${{ matrix.config.gtk_tsm }} | ||
|
||
- name: Configure CMake on Windows | ||
if: startsWith(matrix.config.name, 'Windows') | ||
working-directory: ./build | ||
run: cmake .. -G "Visual Studio 17" -DBUILD_SHARED_LIBS=Off -DBUILD_TESTING=On -DBUILD_GTKTSM=${{ matrix.config.gtk_tsm }} | ||
|
||
- name: Build on Unix | ||
if: ${{ !startsWith(matrix.config.name, 'Windows') }} | ||
working-directory: ./build | ||
run: cmake --build . | ||
|
||
- name: Build on Windows | ||
if: startsWith(matrix.config.name, 'Windows') | ||
working-directory: ./build | ||
run: cmake --build . --config ${{ matrix.config.build_type }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost every step is conditioned on Windows or not. IMHO it's cleaner to just create a separate Windows build job.
This commit is based on work from RadAd (RadAd/libtsm@f879875)
It also adds GitHub Actions support for Windows, changes code that relied on gcc extensions, and introduces Conan to install libcheck in a platform agnostic way.