Skip to content

Commit

Permalink
Credit for "wmain()" wrapper (#2372)
Browse files Browse the repository at this point in the history
* Add credit for "wmain()" wrapper.

* Now message compiler required just for MSVC.

* Some code rearrange.
  • Loading branch information
ark0f authored and aleks-f committed Aug 1, 2018
1 parent ceb1637 commit 36e5121
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
8 changes: 4 additions & 4 deletions CppUnit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ if(NOT BUILD_SHARED_LIBS)
PUBLIC
POCO_STATIC
)
endif()

if(BUILD_SHARED_LIBS AND MINGW)
target_compile_definitions(CppUnit PUBLIC _DLL)
elseif(MINGW)
target_compile_definitions(CppUnit
PUBLIC
_DLL)
endif()

POCO_INSTALL(CppUnit)
Expand Down
7 changes: 2 additions & 5 deletions Foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ if (CMAKE_SYSTEM MATCHES "SunOS")
target_link_libraries(Foundation PUBLIC pthread socket xnet nsl resolv rt ${CMAKE_DL_LIBS})
endif()

if (CMAKE_COMPILER_IS_MINGW)
if (MINGW)
target_compile_definitions(Foundation
PUBLIC
WC_NO_BEST_FIT_CHARS=0x400
Expand All @@ -189,6 +189,7 @@ if (CMAKE_COMPILER_IS_MINGW)
WINVER=0x500
ODBCVER=0x0300
POCO_THREAD_STACK_SIZE
$<$<BOOL:BUILD_SHARED_LIBS>:_DLL>
)
endif()

Expand Down Expand Up @@ -237,10 +238,6 @@ if (NOT POCO_ENABLE_FPENVIRONMENT)
target_compile_definitions(Foundation PUBLIC POCO_NO_FPENVIRONMENT)
endif()

if(BUILD_SHARED_LIBS AND MINGW)
target_compile_definitions(Foundation PUBLIC _DLL)
endif()

POCO_INSTALL(Foundation)
POCO_GENERATE_PACKAGE(Foundation)

Expand Down
6 changes: 4 additions & 2 deletions Foundation/src/Thread_STD_WIN32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ namespace Poco {

void ThreadImpl::setPriorityImpl(int prio)
{
HANDLE handle = reinterpret_cast<HANDLE>(_pData->thread->native_handle());
if (prio != _pData->prio)
{
_pData->prio = prio;
_pData->policy = 0;
if (_pData->started && !_pData->joined && _pData->thread)
{
if (SetThreadPriority(reinterpret_cast<HANDLE>(_pData->thread->native_handle()), _pData->prio) == 0)
if (SetThreadPriority(handle, _pData->prio) == 0)
throw SystemException("cannot set thread priority");
}
}
Expand Down Expand Up @@ -64,11 +65,12 @@ void ThreadImpl::setStackSizeImpl(int size)

void ThreadImpl::setAffinityImpl(int cpu)
{
HANDLE handle = reinterpret_cast<HANDLE>(_pData->thread->native_handle());
DWORD mask = 1;
mask <<= cpu;
if (_pData->started && !_pData->joined && _pData->thread)
{
if (SetThreadAffinityMask(reinterpret_cast<HANDLE>(_pData->thread->native_handle()), mask) == 0)
if (SetThreadAffinityMask(handle, mask) == 0)
{
throw SystemException("Failed to set affinity");
}
Expand Down
4 changes: 2 additions & 2 deletions cmake/PocoMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ if (WIN32)
endif ()
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir}
DOC "path to message compiler")
if (NOT CMAKE_MC_COMPILER AND NOT MINGW)
if(NOT CMAKE_MC_COMPILER AND MSVC)
message(FATAL_ERROR "message compiler not found: required to build")
endif (NOT CMAKE_MC_COMPILER AND NOT MINGW)
endif(NOT CMAKE_MC_COMPILER AND MSVC)
if(CMAKE_MC_COMPILER)
message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}")
mark_as_advanced(CMAKE_MC_COMPILER)
Expand Down
11 changes: 11 additions & 0 deletions doc/90100-Acknowledgements.page
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,14 @@ following copyrighted material, the use of which is hereby acknowledged.
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
----


!!! Wrapper for function "wmain" for MinGW

http://www.coderforlife.com/projects/utilities/#MinGWUnicodeSupport

Copyright (c) 2012 Jeff Bush <jeff@coderforlife.com>

This document is released into the public domain. Absolutely no warranty is provided.
See http://www.coderforlife.com/projects/utilities.

0 comments on commit 36e5121

Please sign in to comment.