Commit 9f3078e1 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #518 from sourcedelica/topic/cygwin_port_517_sourcedelica

Port to Cygwin
parents b83765b5 60f254eb
...@@ -11,6 +11,7 @@ lib/* ...@@ -11,6 +11,7 @@ lib/*
manual manual
*.swp *.swp
bii/* bii/*
.idea/
libcaf_core/caf/detail/build_config.hpp libcaf_core/caf/detail/build_config.hpp
.ycm_extra_conf.pyc .ycm_extra_conf.pyc
blog_release_note.md blog_release_note.md
......
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8.4)
project(caf C CXX) project(caf C CXX)
# be nice to vim users # be nice to vim users
...@@ -266,7 +266,7 @@ endif(CAF_ENABLE_ADDRESS_SANITIZER) ...@@ -266,7 +266,7 @@ endif(CAF_ENABLE_ADDRESS_SANITIZER)
if(NOT APPLE AND NOT WIN32) if(NOT APPLE AND NOT WIN32)
set(EXTRA_FLAGS "${EXTRA_FLAGS} -pthread") set(EXTRA_FLAGS "${EXTRA_FLAGS} -pthread")
endif() endif()
# -fPIC generates warnings on MinGW plus extra setup steps needed on MinGW # -fPIC generates warnings on MinGW and Cygwin plus extra setup steps needed on MinGW
if(MINGW) if(MINGW)
add_definitions(-D_WIN32_WINNT=0x0600) add_definitions(-D_WIN32_WINNT=0x0600)
add_definitions(-DWIN32) add_definitions(-DWIN32)
...@@ -274,6 +274,8 @@ if(MINGW) ...@@ -274,6 +274,8 @@ if(MINGW)
set(LD_FLAGS "ws2_32 -liphlpapi") set(LD_FLAGS "ws2_32 -liphlpapi")
# build static to avoid runtime dependencies to GCC libraries # build static to avoid runtime dependencies to GCC libraries
set(EXTRA_FLAGS "${EXTRA_FLAGS} -static") set(EXTRA_FLAGS "${EXTRA_FLAGS} -static")
elseif(CYGWIN)
set(EXTRA_FLAGS "${EXTRA_FLAGS} -U__STRICT_ANSI__")
else() else()
set(EXTRA_FLAGS "${EXTRA_FLAGS} -fPIC") set(EXTRA_FLAGS "${EXTRA_FLAGS} -fPIC")
endif() endif()
......
...@@ -106,7 +106,9 @@ if (NOT CAF_BUILD_STATIC_ONLY) ...@@ -106,7 +106,9 @@ if (NOT CAF_BUILD_STATIC_ONLY)
SOVERSION ${CAF_VERSION} SOVERSION ${CAF_VERSION}
VERSION ${CAF_VERSION} VERSION ${CAF_VERSION}
OUTPUT_NAME caf_core) OUTPUT_NAME caf_core)
if(NOT WIN32) if (CYGWIN)
install(TARGETS libcaf_core_shared RUNTIME DESTINATION bin)
elseif (NOT WIN32)
install(TARGETS libcaf_core_shared LIBRARY DESTINATION lib) install(TARGETS libcaf_core_shared LIBRARY DESTINATION lib)
endif() endif()
add_dependencies(libcaf_core_shared libcaf_core) add_dependencies(libcaf_core_shared libcaf_core)
......
...@@ -170,12 +170,14 @@ ...@@ -170,12 +170,14 @@
# endif # endif
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
# define CAF_BSD # define CAF_BSD
#elif defined(__CYGWIN__)
# define CAF_CYGWIN
#elif defined(WIN32) || defined(_WIN32) #elif defined(WIN32) || defined(_WIN32)
# define CAF_WINDOWS # define CAF_WINDOWS
#else #else
# error Platform and/or compiler not supportet # error Platform and/or compiler not supportet
#endif #endif
#if defined(CAF_MACOS) || defined(CAF_LINUX) || defined(CAF_BSD) #if defined(CAF_MACOS) || defined(CAF_LINUX) || defined(CAF_BSD) || defined(CAF_CYGWIN)
# define CAF_POSIX # define CAF_POSIX
#endif #endif
......
...@@ -110,6 +110,11 @@ public: ...@@ -110,6 +110,11 @@ public:
m.mem = pmc.PeakWorkingSetSize / 1024; m.mem = pmc.PeakWorkingSetSize / 1024;
m.usr = to_usec(user_time); m.usr = to_usec(user_time);
m.sys = to_usec(kernel_time); m.sys = to_usec(kernel_time);
# elif defined(CAF_CYGWIN)
// TODO - decide what to do here instead of zeros
m.usr = usec::zero();
m.sys = usec::zero();
m.mem = 0;
# else # else
::rusage ru; ::rusage ru;
::getrusage(RUSAGE_THREAD, &ru); ::getrusage(RUSAGE_THREAD, &ru);
......
...@@ -76,7 +76,7 @@ std::vector<iface_info> get_mac_addresses() { ...@@ -76,7 +76,7 @@ std::vector<iface_info> get_mac_addresses() {
} // namespace detail } // namespace detail
} // namespace caf } // namespace caf
#elif defined(CAF_LINUX) || defined(CAF_ANDROID) #elif defined(CAF_LINUX) || defined(CAF_ANDROID) || defined(CAF_CYGWIN)
#include <vector> #include <vector>
#include <string> #include <string>
......
...@@ -61,7 +61,7 @@ std::string get_root_uuid() { ...@@ -61,7 +61,7 @@ std::string get_root_uuid() {
} // namespace detail } // namespace detail
} // namespace caf } // namespace caf
#elif defined(CAF_LINUX) || defined(CAF_BSD) #elif defined(CAF_LINUX) || defined(CAF_BSD) || defined(CAF_CYGWIN)
#include <vector> #include <vector>
#include <string> #include <string>
......
...@@ -39,7 +39,9 @@ if (NOT CAF_BUILD_STATIC_ONLY) ...@@ -39,7 +39,9 @@ if (NOT CAF_BUILD_STATIC_ONLY)
SOVERSION ${CAF_VERSION} SOVERSION ${CAF_VERSION}
VERSION ${CAF_VERSION} VERSION ${CAF_VERSION}
OUTPUT_NAME caf_io) OUTPUT_NAME caf_io)
if(NOT WIN32) if (CYGWIN)
install(TARGETS libcaf_io_shared RUNTIME DESTINATION bin)
elseif (NOT WIN32)
install(TARGETS libcaf_io_shared LIBRARY DESTINATION lib) install(TARGETS libcaf_io_shared LIBRARY DESTINATION lib)
endif() endif()
add_dependencies(libcaf_io_shared libcaf_io) add_dependencies(libcaf_io_shared libcaf_io)
......
...@@ -135,7 +135,7 @@ expected<uint16_t> remote_port_of_fd(native_socket fd); ...@@ -135,7 +135,7 @@ expected<uint16_t> remote_port_of_fd(native_socket fd);
} }
expected<void> allow_sigpipe(native_socket fd, bool new_value) { expected<void> allow_sigpipe(native_socket fd, bool new_value) {
# ifndef CAF_LINUX # if !defined(CAF_LINUX) && !defined(CAF_CYGWIN)
int value = new_value ? 0 : 1; int value = new_value ? 0 : 1;
CALL_CFUN(res, cc_zero, "setsockopt", CALL_CFUN(res, cc_zero, "setsockopt",
setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &value, setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &value,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment