From c1318f71256ffde36e1451677146daf63e793b49 Mon Sep 17 00:00:00 2001 From: "Scott J. Goldman" Date: Sat, 26 May 2012 18:16:13 -0700 Subject: [PATCH 1/3] Use lowercase names for Windows headers Otherwise we can't cross-compile on Linux. --- src/netops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 #else # include -# include +# include # ifdef _MSC_VER -# pragma comment(lib, "Ws2_32.lib") +# pragma comment(lib, "ws2_32.lib") # endif #endif From 2eb1844990609fdf1c7d4c66e4f5a1dd397cd816 Mon Sep 17 00:00:00 2001 From: "Scott J. Goldman" Date: Sat, 26 May 2012 18:20:33 -0700 Subject: [PATCH 2/3] Refactor CMakeLists.txt for mingw cross-compile Two things: 1) By default, Linux CMake puts -fPIC on the link line. So we remove that for MINGW to avoid warnings that it will be ignored. 2) Similarly, move -fvisibility=hidden flag to be for non-mingw compilation only to avoid warnings that it will be ignored. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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}") From 64ab0ba7fb39d276114744bb700b48c8c0cd8916 Mon Sep 17 00:00:00 2001 From: "Scott J. Goldman" Date: Sat, 26 May 2012 18:23:54 -0700 Subject: [PATCH 3/3] Enable mingw cross-compile stage in travis-ci --- .travis.yml | 1 + 1 file changed, 1 insertion(+) 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: