Overview
Features
Download
Documentation
Community
Add-Ons & Services

CMake build system and Mingw fixes

General discussion regarding the development of POCO for contributors.

CMake build system and Mingw fixes

Postby ogopogo » 02 Aug 2012, 11:30

Hi all,
I am working on a CMake port of the Poco build system and I'd like to contribute it. Is there any interest in the community?
Also, there are some problems with FPEnvironment_WIN32 on MinGW (gcc 4.5), which I fixed - the defines
RC_xxx, MCW_RC and SW_xxx are not available in the mingw headers. RC_xxx and MCW_RC are available with leading underscores, and in MSVC the version without underscore is an alias to the underscored version. So I appended underscore to these. AFAIK the underscored version is actually the more correct to use, since underscored macros starting with capital letter are reserved by the standard library.
The SW_xxx are not avaiable at all, so I added #ifdef-s to check if they are not defined, in which case I define them with the values taken from MSVC, again prepending an underscore.
Arguably I could just switch to the C99 implementation, and enable C99 in the compiler options, but since it seems for windows C99 is not expected, I decided that enabling has a chance of breaking win32 specific code.

Best regards
Alex
ogopogo
 
Posts: 3
Joined: 02 Aug 2012, 10:25

Re: CMake build system and Mingw fixes

Postby alex » 03 Aug 2012, 15:31

CMake support is available in the trunk, Marian Krivos is the maintainer. Not sure if Günter wants it in 1.4.4, he'll be the one to decide. As for MinGW, contributions are welcome as long as they don't break compilation on other platforms. Again, I am only speaking from the trunk/1.5 release position, Günter is the one deciding on 1.4.4 branch issues.
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: CMake build system and Mingw fixes

Postby ogopogo » 03 Aug 2012, 19:03

Wow, I'm glad that CMake build has already been adopted, it's a great tool.
Here are the Mingw patches. The only build that they might break is the MSVC build, and the defines that I switch to in the patches are available in MSVC (see MSVC's float.h header for confirmation):

--- ./poco-1.4.3-all/Foundation/src/FPEnvironment_WIN32.cpp 2012-01-15 18:26:18.000000000 +0200
+++ ./poco-1.4.3-all-gcc/Foundation/src/FPEnvironment_WIN32.cpp 2012-08-01 16:27:59.508843800 +0300
@@ -54,7 +54,7 @@

FPEnvironmentImpl::~FPEnvironmentImpl()
{
- _controlfp(_env, MCW_RC);
+ _controlfp(_env, _MCW_RC);
}


@@ -85,13 +85,13 @@

void FPEnvironmentImpl::setRoundingModeImpl(RoundingModeImpl mode)
{
- _controlfp(mode, MCW_RC);
+ _controlfp(mode, _MCW_RC);
}


FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
{
- return RoundingModeImpl(_controlfp(0, 0) & MCW_RC);
+ return RoundingModeImpl(_controlfp(0, 0) & _MCW_RC);
}




--- ./poco-1.4.3-all/Foundation/include/Poco/FPEnvironment_WIN32.h 2012-01-15 18:26:18.000000000 +0200
+++ ./poco-1.4.3-all-gcc/Foundation/include/Poco/FPEnvironment_WIN32.h 2012-08-01 16:24:19.105523500 +0300
@@ -48,23 +48,42 @@
namespace Poco {


+#ifndef _SW_INEXACT
+ #define _SW_INEXACT 0x00000001 /* inexact (precision) */
+#endif
+#ifndef _SW_UNDERFLOW
+ #define _SW_UNDERFLOW 0x00000002 /* underflow */
+#endif
+#ifndef _SW_OVERFLOW
+ #define _SW_OVERFLOW 0x00000004 /* overflow */
+#endif
+#ifndef _SW_ZERODIVIDE
+ #define _SW_ZERODIVIDE 0x00000008 /* zero divide */
+#endif
+#ifndef _SW_INVALID
+ #define _SW_INVALID 0x00000010 /* invalid */
+#endif
+#ifndef _SW_DENORMAL
+ #define _SW_DENORMAL 0x00080000 /* denormal status bit */
+#endif
+
class Foundation_API FPEnvironmentImpl
{
protected:
enum RoundingModeImpl
{
- FP_ROUND_DOWNWARD_IMPL = RC_DOWN,
- FP_ROUND_UPWARD_IMPL = RC_UP,
- FP_ROUND_TONEAREST_IMPL = RC_NEAR,
- FP_ROUND_TOWARDZERO_IMPL = RC_CHOP
+ FP_ROUND_DOWNWARD_IMPL = _RC_DOWN,
+ FP_ROUND_UPWARD_IMPL = _RC_UP,
+ FP_ROUND_TONEAREST_IMPL = _RC_NEAR,
+ FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP
};
enum FlagImpl
{
- FP_DIVIDE_BY_ZERO_IMPL = SW_ZERODIVIDE,
- FP_INEXACT_IMPL = SW_INEXACT,
- FP_OVERFLOW_IMPL = SW_OVERFLOW,
- FP_UNDERFLOW_IMPL = SW_UNDERFLOW,
- FP_INVALID_IMPL = SW_INVALID
+ FP_DIVIDE_BY_ZERO_IMPL = _SW_ZERODIVIDE,
+ FP_INEXACT_IMPL = _SW_INEXACT,
+ FP_OVERFLOW_IMPL = _SW_OVERFLOW,
+ FP_UNDERFLOW_IMPL = _SW_UNDERFLOW,
+ FP_INVALID_IMPL = _SW_INVALID
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl& env);
ogopogo
 
Posts: 3
Joined: 02 Aug 2012, 10:25

Re: CMake build system and Mingw fixes

Postby alex » 03 Aug 2012, 21:00

SF patch 3554079
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: CMake build system and Mingw fixes

Postby ogopogo » 07 Aug 2012, 15:56

Thanks
ogopogo
 
Posts: 3
Joined: 02 Aug 2012, 10:25


Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest