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

Fix code and build system to build on Visual C++ (#25) #34

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

aheck
Copy link
Contributor

@aheck aheck commented Dec 29, 2022

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.

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.
Copy link
Owner

@Aetf Aetf left a 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"
Copy link
Owner

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.

Comment on lines +47 to +50
#ifdef _MSC_VER
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
#endif

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused?

Comment on lines +290 to +298
#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
Copy link
Owner

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.

Comment on lines +63 to +81
- 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 }}
Copy link
Owner

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.

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

Successfully merging this pull request may close these issues.

2 participants