-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MinGW support #2360
MinGW support #2360
Changes from 6 commits
a7380c1
a957ef0
cf60c8d
9879965
7e70fa8
b15db46
e2534d4
98492f5
dc6602e
a885d0b
e539c07
711696f
2ea9bf4
d99bd11
ff9fd43
edd44d3
32d40da
e781565
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.2.0) | |
|
||
project(Poco) | ||
|
||
if(WINCE AND MINGW) | ||
message(FATAL_ERROR "MinGW does not support WinCE") | ||
endif() | ||
|
||
option(POCO_VERBOSE_MESSAGES "Enable informational messages during configure" ON) | ||
|
||
file(STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION) | ||
|
@@ -81,6 +85,10 @@ else() | |
option(BUILD_SHARED_LIBS "Build shared libraries" ON) | ||
endif() | ||
|
||
if(BUILD_SHARED_LIBS AND MINGW) | ||
add_definitions(-D_DLL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use "add_definitons". Use target_compile_definitons ... See also CMake-contribution-rules There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Define There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should ask your self, if it is mandatory to set also _DLL into your project they use the compiled poco library ? Mostly I checked in the code if this preprocessor definiton is in the header file .... if not, then it can be |
||
endif() | ||
|
||
# allow disabling of internally built OpenSSL# (see below for details) | ||
# if POCO pre-built OpenSSL directory is found, and POCO_DISABLE_INTERNAL_OPENSSL=OFF, | ||
# the internal OpenSSL build will be used | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
add_executable(genrsakey src/genrsakey.cpp) | ||
target_link_libraries(genrsakey PUBLIC Poco::Crypto Poco::Util Poco::XML) | ||
POCO_ENABLE_EXE_WMAIN(genrsakey) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Bjoe can you please confirm this is the right thing to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my review comment... |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
|
||
#include "Poco/Platform.h" | ||
// see https://github.com/openssl/openssl/blob/master/doc/man3/OPENSSL_Applink.pod | ||
#if defined(POCO_OS_FAMILY_WINDOWS) | ||
#if defined(_MSC_VER) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes I see, we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OpenSSL for MinGW has no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
#include "openssl/applink.c" | ||
#endif | ||
#include "CryptoTestSuite.h" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,6 @@ | |
// MongoDB_API functions as being imported from a DLL, whereas this DLL sees symbols | ||
// defined with this macro as being exported. | ||
// | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please read contribution documentation about code formatting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
#if defined(_WIN32) && defined(POCO_DLL) | ||
#if defined(MongoDB_EXPORTS) | ||
#define MongoDB_API __declspec(dllexport) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,11 @@ set_target_properties( Net | |
target_link_libraries(Net PUBLIC Poco::Foundation) | ||
# Windows and WindowsCE need additional libraries | ||
if(WIN32) | ||
target_link_libraries(Net PUBLIC "iphlpapi.lib") | ||
target_link_libraries(Net PUBLIC "iphlpapi") | ||
if(WINCE) | ||
target_link_libraries(Net PUBLIC "ws2.lib") | ||
target_link_libraries(Net PUBLIC "ws2") | ||
else() | ||
target_link_libraries(Net PUBLIC "ws2_32.lib") | ||
target_link_libraries(Net PUBLIC "ws2_32") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well I don't know yet if this will work with microsoft compile. But ws2_32 is better then ws2_32.lib .... I would like to investigate if cmake support .lib suffix for microsoft compiler... |
||
endif() | ||
endif(WIN32) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
#include <set> | ||
|
||
|
||
#if defined(_WIN32) && _WIN32_WINNT >= 0x0600 | ||
#if defined(_WIN32) && _WIN32_WINNT >= 0x0600 && !defined(__MINGW32__) | ||
#ifndef POCO_HAVE_FD_POLL | ||
#define POCO_HAVE_FD_POLL 1 | ||
#endif | ||
|
@@ -44,7 +44,6 @@ | |
namespace Poco { | ||
namespace Net { | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please read contribution documentation about code formatting |
||
#if defined(POCO_HAVE_FD_EPOLL) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,10 @@ target_include_directories(PDF | |
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src | ||
) | ||
|
||
if(MINGW) | ||
add_definitions(-DHPDF_DLL_MAKE_CDECL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use add_definitons ... use target_compile_definitons. See also CMake-contribution-rules |
||
endif() | ||
|
||
if (POCO_UNBUNDLED) | ||
target_include_directories(PDF PUBLIC "${ZLIB_INCLUDE_DIRS}") | ||
target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,5 @@ if (POCO_ENABLE_SAMPLES) | |
# add_subdirectory(samples) | ||
endif () | ||
|
||
POCO_ENABLE_EXE_WMAIN( "${POCO_EXENAME}" ) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,6 @@ install( | |
RUNTIME DESTINATION bin | ||
INCLUDES DESTINATION include | ||
) | ||
|
||
POCO_ENABLE_EXE_WMAIN(File2Page) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ | |
// Poco_SQL_API functions as being imported from a DLL, whereas this DLL sees symbols | ||
// defined with this macro as being exported. | ||
// | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please read contribution documentation about code formatting :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
#if defined(_WIN32) && defined(POCO_DLL) | ||
#if defined(SQL_EXPORTS) | ||
#define Poco_SQL_API __declspec(dllexport) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
add_executable(un7zip src/un7zip.cpp) | ||
target_link_libraries(un7zip PUBLIC Poco::SevenZip Poco::Util Poco::XML) | ||
POCO_ENABLE_EXE_WMAIN(un7zip) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,7 +232,7 @@ class Util_API ServerApplication: public Application | |
// | ||
// Macro to implement main() | ||
// | ||
#if defined(_WIN32) && !defined(__MINGW32__) | ||
#if defined(_WIN32) && !defined(POCO_NO_MINGW_UNICODE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No unicode ? I was expected you should have wmain for unicode support? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As stated in the URL
|
||
#define POCO_SERVER_MAIN(App) \ | ||
int wmain(int argc, wchar_t** argv) \ | ||
{ \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,11 +41,13 @@ 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) | ||
if (NOT CMAKE_MC_COMPILER AND NOT MINGW) | ||
message(FATAL_ERROR "message compiler not found: required to build") | ||
endif (NOT CMAKE_MC_COMPILER) | ||
message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") | ||
mark_as_advanced(CMAKE_MC_COMPILER) | ||
endif (NOT CMAKE_MC_COMPILER AND NOT MINGW) | ||
if(CMAKE_MC_COMPILER) | ||
message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") | ||
mark_as_advanced(CMAKE_MC_COMPILER) | ||
endif(CMAKE_MC_COMPILER) | ||
endif(WIN32) | ||
|
||
# Accept older ENABLE_<COMPONENT>, ENABLE_TESTS and ENABLE_SAMPLES and | ||
|
@@ -183,7 +185,7 @@ endmacro() | |
|
||
|
||
macro(POCO_MESSAGES out name) | ||
if (WIN32) | ||
if (WIN32 AND CMAKE_MC_COMPILER) | ||
foreach(msg ${ARGN}) | ||
get_filename_component(msg_name ${msg} NAME) | ||
get_filename_component(msg_path ${msg} ABSOLUTE) | ||
|
@@ -212,7 +214,14 @@ macro(POCO_MESSAGES out name) | |
source_group("${name}\\Message Files" FILES ${ARGN}) | ||
list(APPEND ${out} ${ARGN}) | ||
|
||
endif (WIN32) | ||
endif (WIN32 AND CMAKE_MC_COMPILER) | ||
endmacro() | ||
|
||
|
||
macro(POCO_ENABLE_EXE_WMAIN target_name) | ||
if(MINGW) | ||
set_target_properties("${target_name}" PROPERTIES LINK_FLAGS "-municode") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
in MinGW wikiUnicode applications Normaly CMake takes care that it works on all compilers and platforms. See also CMake rulse:
I would like to investigate if cmake has any support for such compile flag. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to compile application with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But wmain is needed when you will have unicode support or? For me it looks like this depends on POCO_ENBALE_WSTRING .... but I'm still investigating... |
||
endif() | ||
endmacro() | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I should delete this. CMake will cope with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think also we should remove this.... mingw will not work at all on wince ...