Skip to content
Open
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
2 changes: 1 addition & 1 deletion contrib/curl/lib/config-linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
#define HAVE_GETHOSTBYNAME 1

/* Define to 1 if you have the gethostbyname_r function. */
#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__sun__)
#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__sun__) && !defined(__CYGWIN__)
#define HAVE_GETHOSTBYNAME_R 1
#endif

Expand Down
4 changes: 4 additions & 0 deletions contrib/curl/lib/curl_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@
# include "config-linux.h"
#endif

#ifdef __CYGWIN__
# include "config-linux.h"
#endif

#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
# include "config-linux.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion contrib/lua/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ project "lua-lib"
"src/print.c",
}

filter "system:linux or bsd or hurd or aix or solaris or haiku"
filter "system:linux or bsd or hurd or aix or solaris or haiku or cygwin"
defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }

filter "system:macosx"
Expand Down
12 changes: 12 additions & 0 deletions contrib/lua/src/luaconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@
LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
LUA_CDIR"loadall.dll;" ".\\?.dll"

#elif defined(__CYGWIN__) /* }{ */

#define LUA_ROOT "/usr/"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
#define LUA_PATH_DEFAULT \
LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
"./?.lua;" "./?/init.lua"
#define LUA_CPATH_DEFAULT \
LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" "./?.dll"

#else /* }{ */

#define LUA_ROOT "/usr/local/"
Expand Down
2 changes: 1 addition & 1 deletion contrib/luashim/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ project "luashim-lib"
"*.lua"
}

filter "system:linux or bsd or hurd or aix or haiku"
filter "system:linux or bsd or hurd or aix or haiku or cygwin"
defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }

filter "system:macosx"
Expand Down
2 changes: 1 addition & 1 deletion premake4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
configuration { "solaris" }
links { "m", "socket", "nsl" }

configuration "aix"
configuration "aix or cygwin"
defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
links { "m" }

Expand Down
2 changes: 1 addition & 1 deletion premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
filter { "system:solaris" }
links { "m", "socket", "nsl" }

filter "system:aix"
filter "system:aix or cygwin"
defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
links { "m" }

Expand Down
14 changes: 13 additions & 1 deletion src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@
allowed = {
"aix",
"bsd",
"cygwin",
"emscripten",
"haiku",
"hurd",
Expand Down Expand Up @@ -1606,6 +1607,7 @@
allowed = {
{ "aix", "IBM AIX" },
{ "bsd", "OpenBSD, NetBSD, or FreeBSD" },
{ "cygwin", "CYGWIN" },
{ "emscripten", "Emscripten" },
{ "haiku", "Haiku" },
{ "hurd", "GNU/Hurd" },
Expand Down Expand Up @@ -1725,6 +1727,16 @@
targetprefix ""
targetbundleextension ".xctest"

-- CYGWIN specific.

filter { "system:cygwin", "kind:ConsoleApp or WindowedApp" }
targetextension ".exe"

filter { "system:cygwin", "kind:SharedLib" }
targetprefix "cyg"
targetextension ".dll"
implibextension ".dll.a"

-- Windows and friends.

filter { "system:Windows or language:C# or language:F#", "kind:ConsoleApp or WindowedApp" }
Expand All @@ -1744,7 +1756,7 @@
targetextension ".dll"
implibextension ".dll"

filter { "kind:SharedLib", "system:not Windows" }
filter { "kind:SharedLib", "system:not Windows and not cygwin" }
pic "On"

filter { "system:darwin" }
Expand Down
7 changes: 6 additions & 1 deletion src/base/os.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
local function get_library_search_path()
if os.istarget("windows") then
return (os.getenv("PATH") or ""):explode(";")
elseif os.istarget("cygwin") then
return (os.getenv("PATH") or ""):explode(":")
elseif os.istarget("haiku") then
return (os.getenv("LIBRARY_PATH") or ""):explode(":")
else
Expand All @@ -84,7 +86,7 @@

local archpaths = {"/lib", "/usr/lib", "/usr/local/lib"}
if os.is64bit() and not (os.istarget("darwin")) then
archpaths = table.join({"/lib64", "/usr/lib64/", "usr/local/lib64"}, archpaths)
archpaths = table.join({"/lib64", "/usr/lib64", "usr/local/lib64"}, archpaths)
end
return table.join(paths, archpaths)
end
Expand Down Expand Up @@ -116,6 +118,8 @@
-- assemble a search path, depending on the platform
if os.istarget("windows") then
formats = { "%s.dll", "%s" }
elseif os.istarget("cygwin") then
formats = { "cyg%s.dll", "%s.dll", "%s" }
elseif os.istarget("haiku") then
formats = { "lib%s.so", "%s.so" }
else
Expand Down Expand Up @@ -868,6 +872,7 @@
["aix"] = { "aix", "posix", "desktop" },
["android"] = { "android", "mobile" },
["bsd"] = { "bsd", "posix", "desktop" },
["cygwin"] = { "cygwin", "posix", "desktop" },
["emscripten"] = { "emscripten", "web" },
["haiku"] = { "haiku", "posix", "desktop" },
["ios"] = { "ios", "darwin", "posix", "mobile" },
Expand Down
5 changes: 3 additions & 2 deletions src/host/os_getnumcpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
#include <sys/sysctl.h>
#elif PLATFORM_SOLARIS
#include <unistd.h>
#elif PLATFORM_WINDOWS
#elif PLATFORM_WINDOWS | PLATFORM_CYGWIN
#define WIN32_LEAN_AND_MEAN
#define NOGDI
#include <windows.h>
#endif

int do_getnumcpus()
{
#if PLATFORM_WINDOWS
#if PLATFORM_WINDOWS | PLATFORM_CYGWIN
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
Expand Down
2 changes: 1 addition & 1 deletion src/host/os_getversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int getversion(struct OsVersionInfo* info)

/*************************************************************/

#elif defined(PLATFORM_BSD) || defined(PLATFORM_LINUX) || defined(PLATFORM_SOLARIS) || defined(PLATFORM_HURD) || defined(PLATFORM_HAIKU) || defined(PLATFORM_COSMO)
#elif defined(PLATFORM_BSD) || defined(PLATFORM_LINUX) || defined(PLATFORM_SOLARIS) || defined(PLATFORM_HURD) || defined(PLATFORM_HAIKU) || defined(PLATFORM_COSMO) || defined(__CYGWIN__)

#include <string.h>
#include <sys/utsname.h>
Expand Down
5 changes: 4 additions & 1 deletion src/host/premake.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@
#elif defined(_WIN32) || defined(_WIN64)
#define PLATFORM_WINDOWS (1)
#define PLATFORM_OS "windows"
#elif defined (__CYGWIN__)
#define PLATFORM_CYGWIN (1)
#define PLATFORM_OS "cygwin"
#else
#error Unknown platform detected
#endif

#define PLATFORM_POSIX (PLATFORM_LINUX || PLATFORM_BSD || PLATFORM_MACOSX || PLATFORM_SOLARIS || PLATFORM_HAIKU || PLATFORM_HURD || PLATFORM_COSMO)
#define PLATFORM_POSIX (PLATFORM_LINUX || PLATFORM_BSD || PLATFORM_MACOSX || PLATFORM_SOLARIS || PLATFORM_HAIKU || PLATFORM_HURD || PLATFORM_COSMO || PLATFORM_CYGWIN)

#if defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || defined(__amd64) || \
defined(_M_X64) || defined(_M_AMD64)
Expand Down
4 changes: 3 additions & 1 deletion tests/base/test_os.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
end

local function get_LD_PATH_variable_name()
if os.istarget("windows") then
if os.istarget("windows") or os.istarget("cygwin") then
return 'PATH'
elseif os.istarget("haiku") then
return 'LIBRARY_PATH'
Expand Down Expand Up @@ -51,6 +51,8 @@
-- https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes
elseif os.istarget("windows") then
test.istrue(os.findlib("user32"))
elseif os.istarget("cygwin") then
test.istrue(os.findlib("cygwin1"))
elseif os.istarget("haiku") then
test.istrue(os.findlib("root"))
elseif os.istarget("bsd") and os.getversion().description == "OpenBSD" then
Expand Down
1 change: 1 addition & 0 deletions website/docs/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ If no system is specified, Premake will identify and target the current operatin
| aix | IBM AIX |
| android | Android Platform |
| bsd | BSD Variants |
| cygwin | CYGWIN |
| emscripten | Emscripten targets |
| haiku | Haiku OS |
| hurd | GNU Hurd |
Expand Down