I have discovered several issues, and would like to submit several
fixes in the svn diffs below, for building the wengophone-2.1
libraries on mingw32 with CMake.

1. owbuild (owbuild.diff): since MinGW/GCC/ar make DLL names starting
with lib, the copy command is fixed for MINGW.

2. libs/3rdparty (libs-3rdparty.diff):
   a) In libs/3rdparty/glib/CMakeLists.txt &
3rdparty/gaim/CMakeLists.txt, we should use the Windows libraries for
all WIN32: MINGW as well as MSVC.

   b) Fix libs/3rdparty/portaudio/CMakeLists-internal.txt for MINGW.

3. libs/qtutil (libs-qtutil.diff): 2 definitions to build for MINGW.

4. libs/owutil (libs-owutil.diff): small fixes for MINGW.

I would also like to highlight two issues for which I am using local
workarounds:

1. libs/3rdparty/openssl:
   a) CMake is not using the correct libraries.
   b) Include files in libs/3rdparty/openssl/include/openssl have an
extra control-Z,
       making them impossible to build with mingw-gcc/g++.

2. libs/owwebcam:
   a) I don't know whether it is better to make a few fixes to work
with COM/DirectX
       on MinGW or just leave these things out.
   b) Apparently, there is an option to disable building owwebcam in scons
       but not in CMake.

I hope these fixes are helpful. I will submit some more patches for
the wifo tree tomorrow.

Thanks,
Chris
Index: owbuild/owbuild/OWCreateBinary.cmake
===================================================================
--- owbuild/owbuild/OWCreateBinary.cmake        (revision 10824)
+++ owbuild/owbuild/OWCreateBinary.cmake        (working copy)
@@ -57,13 +57,17 @@
        if (${PROJECT_NAME}_PROJECT_TYPE STREQUAL Shared)
                add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SRCS})
 
-               if (WIN32)
+               if (MSVC)
                        
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.dll .)
                        if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE 
STREQUAL RelWithDebInfo)
                                
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pdb .)
                        endif (CMAKE_BUILD_TYPE STREQUAL Debug OR 
CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
-               endif (WIN32)
+               endif (MSVC)
 
+               if (MINGW)
+                       
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/lib${PROJECT_NAME}.dll 
./${PROJECT_NAME}.dll)
+               endif (MINGW)
+
                if (UNIX AND NOT APPLE)
                        
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/lib${PROJECT_NAME}.so .)
                endif (UNIX AND NOT APPLE)
@@ -79,13 +83,17 @@
 
                add_library(${PROJECT_NAME} MODULE ${${PROJECT_NAME}_SRCS})
 
-               if (WIN32)
+               if (MSVC)
                        
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.dll .)
                        if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE 
STREQUAL RelWithDebInfo)
                                
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pdb .)
                        endif (CMAKE_BUILD_TYPE STREQUAL Debug OR 
CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
-               endif (WIN32)
+               endif (MSVC)
 
+               if (MINGW)
+                       
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/lib${PROJECT_NAME}.dll 
./lib${PROJECT_NAME}.dll)
+               endif (MINGW)
+
                if (UNIX AND NOT APPLE)
                        
ow_post_build_copy_file(${CMAKE_CURRENT_BINARY_DIR}/lib${PROJECT_NAME}.so .)
                endif (UNIX AND NOT APPLE)
Index: libs/3rdparty/portaudio/CMakeLists-internal.txt
===================================================================
--- libs/3rdparty/portaudio/CMakeLists-internal.txt     (revision 10824)
+++ libs/3rdparty/portaudio/CMakeLists-internal.txt     (working copy)
@@ -32,10 +32,15 @@
        ow_add_sources(
                src/os/win/pa_win_util.c
                src/os/win/pa_win_hostapis.c
-               src/os/win/pa_x86_plain_converters.c
-               build/msvc/portaudio.def
        )
 
+       if (MSVC)
+               ow_add_sources(
+                       src/os/win/pa_x86_plain_converters.c
+                       build/msvc/portaudio.def
+               )
+       endif (MSVC)
+
        ow_add_private_definitions(
                -DPA_LITTLE_ENDIAN
                -DPA_NO_ASIO
@@ -59,6 +64,12 @@
                        -DPA_NO_DS
                )
        endif (PORTAUDIO_DIRECTSOUND_SUPPORT)
+
+       if (MINGW)
+               ow_add_private_libraries(
+                       winmm
+               )
+       endif (MINGW)
 endif (WIN32)
 
 if (LINUX)
Index: libs/3rdparty/glib/CMakeLists.txt
===================================================================
--- libs/3rdparty/glib/CMakeLists.txt   (revision 10824)
+++ libs/3rdparty/glib/CMakeLists.txt   (working copy)
@@ -1,5 +1,6 @@
-if (NOT MSVC)
+if (NOT WIN32)
+       # NOT MSVC AND NOT MINGW
        include(CMakeLists-unix.txt)
-else (NOT MSVC)
+else (NOT WIN32)
        include(CMakeLists-msvc.txt)
-endif (NOT MSVC)
+endif (NOT WIN32)
Index: libs/3rdparty/gaim/CMakeLists.txt
===================================================================
--- libs/3rdparty/gaim/CMakeLists.txt   (revision 10824)
+++ libs/3rdparty/gaim/CMakeLists.txt   (working copy)
@@ -1,5 +1,6 @@
-if (NOT MSVC)
+if (NOT WIN32)
+       # NOT MSVC AND NOT MINGW
        include(CMakeLists-internal-unix.txt)
-else (NOT MSVC)
+else (NOT WIN32)
        include(CMakeLists-internal-msvc.txt)
-endif (NOT MSVC)
+endif (NOT WIN32)
Index: libs/qtutil/CMakeLists.txt
===================================================================
--- libs/qtutil/CMakeLists.txt  (revision 10824)
+++ libs/qtutil/CMakeLists.txt  (working copy)
@@ -97,6 +97,13 @@
 endif (APPLE)
 
 if (WIN32)
+       if (MINGW)
+               ow_add_private_definitions(
+                       -DWINVER=0x500
+                       -D_WIN32_IE=0x500
+               )
+       endif (MINGW)
+
        ow_add_sources(
                src/WindowsDesktopService.cpp
        )
Index: libs/owutil/socket/src/SocketCommon.h
===================================================================
--- libs/owutil/socket/src/SocketCommon.h       (revision 10824)
+++ libs/owutil/socket/src/SocketCommon.h       (working copy)
@@ -25,19 +25,21 @@
 #ifdef OS_WINDOWS
        #include <winsock2.h>
        #include <windows.h>
+
        #ifndef CC_MINGW
                #include <wininet.h>
                #include <urlmon.h>
                #include <stdio.h>
-               #include <ws2tcpip.h>
                #include <time.h>
 
                #ifndef snprintf
                        #define snprintf _snprintf
                #endif
+       #endif
 
-               typedef SOCKET Socket;
-       #endif
+       #include <ws2tcpip.h>
+
+       typedef SOCKET Socket;
 #else
        #include <sys/time.h>
        #include <sys/types.h>
_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel

Reply via email to