summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-05-26 20:08:04 -0700
committerVicent Martí <tanoku@gmail.com>2012-05-26 20:08:04 -0700
commit4c977a61e598f2230e9902aa80cfea8e89d94f88 (patch)
tree7abae537eb500c47b1de21fbbf21553f4d33554f
parent539e6c138ec3edc42f72a23d8e8814edf1319f07 (diff)
parent64ab0ba7fb39d276114744bb700b48c8c0cd8916 (diff)
downloadlibgit2-4c977a61e598f2230e9902aa80cfea8e89d94f88.tar.gz
Merge pull request #734 from scottjg/travis-mingw
Enable mingw cross-compilation in travis-ci
-rw-r--r--.travis.yml1
-rw-r--r--CMakeLists.txt8
-rw-r--r--src/netops.c4
3 files changed, 8 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml
index 11c85bbc4..2713651a8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@ language: erlang
env:
- OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release"
- OPTIONS="-DBUILD_CLAR=ON -DBUILD_EXAMPLES=ON"
+ - CC=i586-mingw32msvc-gcc OPTIONS="-DBUILD_CLAR=OFF -DWIN32=ON -DMINGW=ON"
# Make sure CMake is installed
install:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 165baba78..8018ea72d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,10 +71,12 @@ IF (MSVC)
# Precompiled headers
ELSE ()
- SET(CMAKE_C_FLAGS "-O2 -g -D_GNU_SOURCE -fvisibility=hidden -Wall -Wextra -Wno-missing-field-initializers -Wstrict-aliasing=2 -Wstrict-prototypes -Wmissing-prototypes ${CMAKE_C_FLAGS}")
+ SET(CMAKE_C_FLAGS "-O2 -g -D_GNU_SOURCE -Wall -Wextra -Wno-missing-field-initializers -Wstrict-aliasing=2 -Wstrict-prototypes -Wmissing-prototypes ${CMAKE_C_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
- IF (NOT MINGW) # MinGW always does PIC and complains if we tell it to
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+ IF (MINGW) # MinGW always does PIC and complains if we tell it to
+ STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
+ ELSE ()
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fPIC")
ENDIF ()
IF (PROFILE)
SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")
diff --git a/src/netops.c b/src/netops.c
index 4d461a049..e16cae8e6 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -12,9 +12,9 @@
# include <netdb.h>
#else
# include <winsock2.h>
-# include <Ws2tcpip.h>
+# include <ws2tcpip.h>
# ifdef _MSC_VER
-# pragma comment(lib, "Ws2_32.lib")
+# pragma comment(lib, "ws2_32.lib")
# endif
#endif