Skip to content

Commit

Permalink
Use appropriate headers on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
noteflakes committed Jul 21, 2023
1 parent a4b309d commit 7d10300
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/polyphony/backend_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
#define BACKEND_COMMON_H

#include <sys/types.h>
#ifdef POLYPHONY_WINDOWS
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif
#include <netinet/in.h>
#include <netdb.h>

Expand Down
3 changes: 3 additions & 0 deletions ext/polyphony/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

require 'rubygems'
require 'mkmf'
require 'rbconfig'

dir_config 'polyphony_ext'

KERNEL_INFO_RE = /Linux (\d)\.(\d+)(?:\.)?((?:\d+\.?)*)(?:\-)?([\w\-]+)?/
def get_config
config = { linux: !!(RUBY_PLATFORM =~ /linux/) }
config[:windows] = !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
return config if !config[:linux]

kernel_info = `uname -sr`
Expand Down Expand Up @@ -72,6 +74,7 @@ def define_bool(name, value)
else
$defs << "-DPOLYPHONY_BACKEND_LIBEV"
$defs << "-DPOLYPHONY_LINUX" if config[:linux]
$defs << "-DPOLYPHONY_WINDOWS" if config[:windows]

$defs << "-DEV_STANDALONE" # prevent libev from assuming "config.h" exists

Expand Down

0 comments on commit 7d10300

Please sign in to comment.