poco icon indicating copy to clipboard operation
poco copied to clipboard

MinGW support

Open ark0f opened this issue 7 years ago • 7 comments

Why POCO doesn't have MinGW support? I think it is not difficult. I can even add support personally.

ark0f avatar Jun 02 '18 14:06 ark0f

if you want to own it, it's yours. send pulls with fixes and if they don't break other builds, they will be merged. see with @zosrothko if there is space in CI environment for it

aleks-f avatar Jun 02 '18 15:06 aleks-f

On AppVeyor, there is space.. on VSTS, it remains 25GB but one should keep it for VS addition. Thus I would suggest to CI the MinGW on AppVeyor. @Good-Pudge Please ask for a account on Slack to easy the communication

zosrothko avatar Jun 02 '18 15:06 zosrothko

yes, appveyor will be fine. @Good-Pudge I have sent you invite for slack

aleks-f avatar Jun 02 '18 15:06 aleks-f

For the error in PocoMacros.cmake, these modified code chunks should work, at least with 1.9.0:

if (WIN32)
  # cmake has CMAKE_RC_COMPILER, but no message compiler
  if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
    # this path is only present for 2008+, but we currently require PATH to
    # be set up anyway
    get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
    get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH)
    get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH)
    if (X64)
      set(sdk_bindir "${sdk_dir}/bin/x64")
      set(kit_bindir "${kit_dir}/bin/x64")
      set(kit81_bindir "${kit81_dir}/bin/x64")
    else (X64)
      set(sdk_bindir "${sdk_dir}/bin")
      set(kit_bindir "${kit_dir}/bin/x86")
      set(kit81_bindir "${kit81_dir}/bin/x86")
    endif (X64)
  endif ()
  find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}"
    DOC "path to message compiler")
  if (NOT CMAKE_MC_COMPILER)
    message(WARNING "Message compiler not found, using pre-generated headers")
  endif (NOT CMAKE_MC_COMPILER)
  message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}")
  mark_as_advanced(CMAKE_MC_COMPILER)
endif(WIN32)

...

macro(POCO_MESSAGES out name)
    if (WIN32 AND CMAKE_MC_COMPILER)
        foreach(msg ${ARGN})
            get_filename_component(msg_name ${msg} NAME)
            get_filename_component(msg_path ${msg} ABSOLUTE)
            string(REPLACE ".mc" ".h" hdr ${msg_name})
            set_source_files_properties(${hdr} PROPERTIES GENERATED TRUE)
            add_custom_command(
                OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${hdr}
                DEPENDS ${msg}
                COMMAND ${CMAKE_MC_COMPILER}
                ARGS
                    -h ${CMAKE_CURRENT_BINARY_DIR}
                    -r ${CMAKE_CURRENT_BINARY_DIR}
                    ${msg_path}
                VERBATIM # recommended: p260
            )

            # Add the generated file to the include directory
            include_directories(${CMAKE_CURRENT_BINARY_DIR})

            # Add the generated headers to POCO_HEADERS of the component
            POCO_HEADERS( ${out} ${name} ${CMAKE_CURRENT_BINARY_DIR}/${hdr})

        endforeach()

        set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
        source_group("${name}\\Message Files" FILES ${ARGN})
        list(APPEND ${out} ${ARGN})

    endif (WIN32 AND CMAKE_MC_COMPILER)
endmacro()

And the contents of Foundation/src/pocomsg.h (which would normally be generated by mc.exe):

//
// pocomsg.mc[.h]
//
// The Poco message source/header file.
//
// NOTE: pocomsg.h is automatically generated from pocomsg.mc.
//       Never edit pocomsg.h directly!
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
//
// Categories
//
//
//  Values are 32 bit values laid out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +---+-+-+-----------------------+-------------------------------+
//  |Sev|C|R|     Facility          |               Code            |
//  +---+-+-+-----------------------+-------------------------------+
//
//  where
//
//      Sev - is the severity code
//
//          00 - Success
//          01 - Informational
//          10 - Warning
//          11 - Error
//
//      C - is the Customer code flag
//
//      R - is a reserved bit
//
//      Facility - is the facility code
//
//      Code - is the facility's status code
//
//
// Define the facility codes
//


//
// Define the severity codes
//


//
// MessageId: POCO_CTG_FATAL
//
// MessageText:
//
// Fatal
//
#define POCO_CTG_FATAL                   0x00000001L

//
// MessageId: POCO_CTG_CRITICAL
//
// MessageText:
//
// Critical
//
#define POCO_CTG_CRITICAL                0x00000002L

//
// MessageId: POCO_CTG_ERROR
//
// MessageText:
//
// Error
//
#define POCO_CTG_ERROR                   0x00000003L

//
// MessageId: POCO_CTG_WARNING
//
// MessageText:
//
// Warning
//
#define POCO_CTG_WARNING                 0x00000004L

//
// MessageId: POCO_CTG_NOTICE
//
// MessageText:
//
// Notice
//
#define POCO_CTG_NOTICE                  0x00000005L

//
// MessageId: POCO_CTG_INFORMATION
//
// MessageText:
//
// Information
//
#define POCO_CTG_INFORMATION             0x00000006L

//
// MessageId: POCO_CTG_DEBUG
//
// MessageText:
//
// Debug
//
#define POCO_CTG_DEBUG                   0x00000007L

//
// MessageId: POCO_CTG_TRACE
//
// MessageText:
//
// Trace
//
#define POCO_CTG_TRACE                   0x00000008L

//
// Event Identifiers
//
//
// MessageId: POCO_MSG_LOG
//
// MessageText:
//
// %1
//
#define POCO_MSG_LOG                     0x00001000L

qwertychouskie avatar Mar 15 '19 03:03 qwertychouskie

Hmm, it seems the issue has been fixed in develop for systems that have mc.exe, though this may be useful for anyone looking to cross-compile Windows binaries on Linux.

qwertychouskie avatar Mar 15 '19 03:03 qwertychouskie

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jun 28 '22 03:06 github-actions[bot]

I'll leave this open for now if anyone care to carry the changes from develop over to devel (sorry that 2.0 did not happen, but we simply don't have resources to support two lines of development/support).

aleks-f avatar Jun 28 '22 08:06 aleks-f

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Nov 28 '23 02:11 github-actions[bot]

This issue was closed because it has been inactive for 60 days since being marked as stale.

github-actions[bot] avatar Jan 28 '24 02:01 github-actions[bot]