You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by snikulov <gi...@git.apache.org> on 2015/09/02 14:39:38 UTC
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
GitHub user snikulov opened a pull request:
https://github.com/apache/thrift/pull/598
cmake // fixes for std/boost::thread detection; security test; qt test
Hello All!
Relates to https://issues.apache.org/jira/browse/THRIFT-2850
1. Will use BOOST if not explicitly provided -DWITH_STDTHREADS=ON and Boost_FOUND.
2. Will not build SecurityTest if NOT OPENSSL_FOUND (SecurityTest uses SSL headers which is not available)
3. Fix for TQTcpServerTest_Qt5.
Build successful on Windows (MSVC 2013) and CentOS 7
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/snikulov/thrift cmake_build_updates
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/598.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #598
----
commit b10dbb8a10e159af358585e0a5445b46e3e7094a
Author: Sergei Nikulov <se...@gmail.com>
Date: 2015-09-02T10:06:22Z
fixes for std/boost::thread detection; security test; qt test
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38807939
--- Diff: build/cmake/DefineOptions.cmake ---
@@ -62,8 +62,10 @@ endif()
find_package(OpenSSL QUIET)
CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
"OPENSSL_FOUND" OFF)
-option(WITH_BOOSTTHREADS "Build with Boost thread support" OFF)
option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
+CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" ON
--- End diff --
According to http://www.cmake.org/cmake/help/v3.0/module/CMakeDependentOption.html
> This macro presents an option to the user only if a set of other conditions are true.
This would hide the option itself unless the user set it in the first place, like a chicken out of no egg for GUI users.
How about literally changing the default value only:
CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" OFF
"NOT WITH_STDTHREADS;Boost_FOUND" OFF)
About the config.h, I think your concern is right.
Long story short, it originates from my past patch, and in its current state I don't see any reason not to replace *add_definitions* with *set*.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38551876
--- Diff: build/cmake/DefineOptions.cmake ---
@@ -62,8 +62,10 @@ endif()
find_package(OpenSSL QUIET)
CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
"OPENSSL_FOUND" OFF)
-option(WITH_BOOSTTHREADS "Build with Boost thread support" OFF)
option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
+CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" ON
--- End diff --
Looks like a good idea for Windows.
For *nix, pthread has been the default, and IMO it should remain so because:
* *configure.ac* option states boost thread is experimental.
* In my experience, Thrift pthread implementation has better performance (although negligible for most cases) than that of boost or std-thread on Linux.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by snikulov <gi...@git.apache.org>.
Github user snikulov commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38620073
--- Diff: lib/cpp/test/qt/CMakeLists.txt ---
@@ -18,11 +18,15 @@
#
set(CMAKE_AUTOMOC ON)
-find_package(Qt5 REQUIRED COMPONENTS Test)
+find_package(Qt5 REQUIRED COMPONENTS Test Network)
set(TQTcpServerTest_Qt5_SOURCES
TQTcpServerTest.cpp
)
add_executable(TQTcpServerTest_Qt5 ${TQTcpServerTest_Qt5_SOURCES})
-target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob thriftqt5 thrift Qt5::Test)
+target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thriftqt5)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thrift)
+qt5_use_modules(TQTcpServerTest_Qt5 Test Network)
--- End diff --
@nsuke Yep. But this was related to my laziness :)
qt5_use_modules also set includes. Error was related to include issue and LINK_AGAINST...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by snikulov <gi...@git.apache.org>.
Github user snikulov commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38619873
--- Diff: build/cmake/DefineOptions.cmake ---
@@ -62,8 +62,10 @@ endif()
find_package(OpenSSL QUIET)
CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
"OPENSSL_FOUND" OFF)
-option(WITH_BOOSTTHREADS "Build with Boost thread support" OFF)
option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
+CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" ON
--- End diff --
@nsuke Well, then we can change in following way:
CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" ON
- "NOT WITH_STDTHREADS;Boost_FOUND" OFF)
+ "NOT WITH_STDTHREADS;Boost_FOUND;WITH_BOOSTTHREADS" OFF)
Then, this feature will not be enabled if not explicitly set to on using -DWITH_BOOSTTHREADS=ON in command line.
What do you think?
BTW, I've found that this option will set add_definitions, but not update config.h
Is it normal?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by snikulov <gi...@git.apache.org>.
Github user snikulov commented on the pull request:
https://github.com/apache/thrift/pull/598#issuecomment-138227255
@nsuke updated pull request per your comments.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38807967
--- Diff: lib/cpp/test/qt/CMakeLists.txt ---
@@ -18,11 +18,15 @@
#
set(CMAKE_AUTOMOC ON)
-find_package(Qt5 REQUIRED COMPONENTS Test)
+find_package(Qt5 REQUIRED COMPONENTS Test Network)
set(TQTcpServerTest_Qt5_SOURCES
TQTcpServerTest.cpp
)
add_executable(TQTcpServerTest_Qt5 ${TQTcpServerTest_Qt5_SOURCES})
-target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob thriftqt5 thrift Qt5::Test)
+target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thriftqt5)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thrift)
+qt5_use_modules(TQTcpServerTest_Qt5 Test Network)
--- End diff --
The imported target *Qt5::Network* should handle includes for you too.
It automatically propagates *INTERFACE_INCLUDE_DIRECTORIES* and others.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/thrift/pull/598
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on the pull request:
https://github.com/apache/thrift/pull/598#issuecomment-138574945
@snikulov sorry if there was any misunderstanding but I'm just reviewing as a peer contributor and I have no way to "approve."
That said, I believe it's good to merge.
@bufferoverflow and others, could you help with this ?
The patch looks good and Travis **CMake** builds succeeded.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38552467
--- Diff: lib/cpp/test/qt/CMakeLists.txt ---
@@ -18,11 +18,15 @@
#
set(CMAKE_AUTOMOC ON)
-find_package(Qt5 REQUIRED COMPONENTS Test)
+find_package(Qt5 REQUIRED COMPONENTS Test Network)
set(TQTcpServerTest_Qt5_SOURCES
TQTcpServerTest.cpp
)
add_executable(TQTcpServerTest_Qt5 ${TQTcpServerTest_Qt5_SOURCES})
-target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob thriftqt5 thrift Qt5::Test)
+target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thriftqt5)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thrift)
+qt5_use_modules(TQTcpServerTest_Qt5 Test Network)
--- End diff --
According to [Qt5 documentation](http://doc.qt.io/qt-5/cmake-manual.html), *qt5_use_modules* is the way to go with CMake **prior to 2.8.11**.
Since root CMakeLists.txt requires 2.8.12, I believe imported targets (*Qt5::Test Qt5::Network*) are more appropriate than the macro here.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38552677
--- Diff: lib/cpp/test/qt/CMakeLists.txt ---
@@ -18,11 +18,15 @@
#
set(CMAKE_AUTOMOC ON)
-find_package(Qt5 REQUIRED COMPONENTS Test)
+find_package(Qt5 REQUIRED COMPONENTS Test Network)
set(TQTcpServerTest_Qt5_SOURCES
TQTcpServerTest.cpp
)
add_executable(TQTcpServerTest_Qt5 ${TQTcpServerTest_Qt5_SOURCES})
-target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob thriftqt5 thrift Qt5::Test)
+target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thriftqt5)
+LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thrift)
--- End diff --
+1
You're absolutely right for using LINK_AGAINST... macro (I think I wrote the original line).
These should fix static lib build at the very least.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] thrift pull request: cmake // fixes for std/boost::thread detectio...
Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:
https://github.com/apache/thrift/pull/598#discussion_r38552069
--- Diff: lib/cpp/test/qt/CMakeLists.txt ---
@@ -18,11 +18,15 @@
#
set(CMAKE_AUTOMOC ON)
-find_package(Qt5 REQUIRED COMPONENTS Test)
+find_package(Qt5 REQUIRED COMPONENTS Test Network)
--- End diff --
Network module should be already found either by non-test part of cpp/CMakeLists.txt or qt5/CMakeLists.txt before reaching here.
I'm not particularly against being explicit if it's your intention, though.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---