From d5378f50af6835ba044d9a3f102492723d176cbf Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Tue, 13 May 2014 14:55:27 -0600 Subject: [PATCH] Fix cygwin builds #121 Cygwin claims to be POSIX but only implementes part of the dl_open interface. For this usage, we revert to win32 interface when building on Cygwin. --- CMakeLists.txt | 2 +- include/chaiscript/chaiscript_defines.hpp | 2 +- include/chaiscript/language/chaiscript_engine.hpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10b7399..0ed23b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ endif() # limitations in MinGW require us to make an optimized build # for the sake of object sizes or something -if(MINGW) +if(MINGW OR CYGWIN) add_definitions(-O3) endif() diff --git a/include/chaiscript/chaiscript_defines.hpp b/include/chaiscript/chaiscript_defines.hpp index d6b6dc7..0fd6fc5 100644 --- a/include/chaiscript/chaiscript_defines.hpp +++ b/include/chaiscript/chaiscript_defines.hpp @@ -12,7 +12,7 @@ #define CHAISCRIPT_HAS_DECLSPEC #endif -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) #define CHAISCRIPT_WINDOWS #endif diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index a5b3de1..a5cb129 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -34,7 +34,7 @@ #include #endif -#ifdef _POSIX_VERSION +#if defined(_POSIX_VERSION) && !defined(__CYGWIN__) #include #else #ifdef CHAISCRIPT_WINDOWS @@ -69,7 +69,7 @@ namespace chaiscript namespace detail { -#ifdef _POSIX_VERSION +#if defined(_POSIX_VERSION) && !defined(__CYGWIN__) struct Loadable_Module { struct DLModule @@ -438,8 +438,7 @@ namespace chaiscript m_usepaths.push_back(""); } - -#ifdef _POSIX_VERSION +#if defined(_POSIX_VERSION) && !defined(__CYGWIN__) // If on Unix, add the path of the current executable to the module search path // as windows would do @@ -704,6 +703,7 @@ namespace chaiscript std::vector prefixes; prefixes.push_back("lib"); + prefixes.push_back("cyg"); prefixes.push_back(""); std::vector postfixes;