Skip to content

Commit

Permalink
Merge pull request #198 from nsait-linaro/enable_build_without_winpty
Browse files Browse the repository at this point in the history
enable building pywinpty without winpty and debug code
  • Loading branch information
andfoy authored Nov 11, 2021
2 parents 0d68168 + 829b604 commit bceb883
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,7 @@ fn main() {
.extra_warnings(false)
.compile("winptywrapper");

println!("cargo:rustc-link-lib=dylib=winpty");
if winpty_enabled == "1" {
println!("cargo:rustc-link-lib=dylib=winpty");
}
}
2 changes: 1 addition & 1 deletion include/StackWalker.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#ifdef DEBUG
#if DEBUG
#ifndef __STACKWALKER_H__
#define __STACKWALKER_H__

Expand Down
4 changes: 2 additions & 2 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#include <iostream>


#ifdef ENABLE_WINPTY
#if ENABLE_WINPTY
static constexpr bool WINPTY_ENABLED = true;
#else
static constexpr bool WINPTY_ENABLED = false;
#endif // ENABLE_WINPTY

#ifdef ENABLE_CONPTY
#if ENABLE_CONPTY
static constexpr bool CONPTY_ENABLED = true;
#else
static constexpr bool CONPTY_ENABLED = false;
Expand Down
3 changes: 2 additions & 1 deletion include/winpty_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#include "base.h"


#ifdef ENABLE_WINPTY
#if ENABLE_WINPTY

extern "C" {
#include <winpty.h>
#include <winpty_constants.h>
Expand Down
2 changes: 1 addition & 1 deletion src/csrc/StackWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
*
**********************************************************************/

#ifdef DEBUG
#if DEBUG
#include "StackWalker.h"

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/csrc/conpty_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Native ConPTY calls.
See: https://docs.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session
**/

#ifdef ENABLE_CONPTY
#if ENABLE_CONPTY

HRESULT SetUpPseudoConsole(HPCON* hPC, COORD size, HANDLE* inputReadSide, HANDLE* outputWriteSide,
HANDLE* outputReadSide, HANDLE* inputWriteSide) {
Expand Down
2 changes: 1 addition & 1 deletion src/csrc/pty.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "pty.h"

#ifdef DEBUG
#if DEBUG
// Debug utilities used to print a stack trace
// In order to use it:
// MyStackWalker sw; sw.ShowCallstack();
Expand Down
2 changes: 1 addition & 1 deletion src/csrc/winpty_common.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "winpty_common.h"

#ifdef ENABLE_WINPTY
#if ENABLE_WINPTY
void compose_error_message(winpty_error_ptr_t err, char* tmp) {
std::wstring err_msg = winpty_error_msg(err);
std::wstring err_code = std::to_wstring(winpty_error_code(err));
Expand Down

0 comments on commit bceb883

Please sign in to comment.