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

enable building pywinpty without winpty and debug code #198

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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