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

Add support for viz_noxserver on macos #577

Merged
merged 2 commits into from
Dec 15, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
path: dist/*.tar.gz

upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
Expand Down
6 changes: 3 additions & 3 deletions src/lib/ViZDoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ namespace vizdoom {

this->MQDoom->send(MSG_CODE_CLOSE);

#ifdef OS_LINUX
#ifdef OS_POSIX
if(0 == kill(this->doomProcessPid, 0)){
bpr::child doomProcess(this->doomProcessPid);
bpr::terminate(doomProcess);
Expand Down Expand Up @@ -1415,7 +1415,7 @@ namespace vizdoom {
this->doomArgs.push_back("+viz_window_hidden");
this->doomArgs.push_back("1");

#ifdef OS_LINUX
#ifdef OS_POSIX
if (this->noXServer){
this->doomArgs.push_back("+viz_noxserver");
this->doomArgs.push_back("1");
Expand Down Expand Up @@ -1464,7 +1464,7 @@ namespace vizdoom {
void DoomController::launchDoom() {
try {
bpr::child doomProcess = bpr::execute(bpri::set_args(this->doomArgs), bpri::inherit_env());
#ifdef OS_LINUX
#ifdef OS_POSIX
this->doomProcessPid = doomProcess.pid;
#endif
bpr::wait_for_exit(doomProcess);
Expand Down
6 changes: 5 additions & 1 deletion src/lib/ViZDoomController.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ namespace vizdoom {
/* OSes */
#ifdef __linux__
#define OS_LINUX
#define OS_POSIX
#include <sys/types.h>
#include <signal.h>
#elif _WIN32
#define OS_WIN
#elif __APPLE__
#define OS_OSX
#define OS_POSIX
#include <sys/types.h>
#include <signal.h>
#endif

class DoomController {
Expand Down Expand Up @@ -329,7 +333,7 @@ namespace vizdoom {

b::thread *doomThread;

#ifdef OS_LINUX
#ifdef OS_POSIX
pid_t doomProcessPid;
#endif

Expand Down
Loading