-
Notifications
You must be signed in to change notification settings - Fork 345
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
Fix same bug, add cmake to ci, refactor cmake #177
base: master
Are you sure you want to change the base?
Conversation
45dcb38
to
84e9a17
Compare
@KangLin thank you very much for your contribution. As soon as you are done with the changes, poke me for a review. |
e22865e
to
038f606
Compare
@KangLin thank you for the changes to the minimum version of cmake! Since I do not personally use cmake, to complete the review I would kindly request from people that already use QZXing with cmake in their project to give it a try. @dobey and @Milerius , would it be possible to try the proposed CMakelist from this Pull Request to your projects? Does it affect you in any way? I really appreciate the help and effort from all of you! Kind regards. |
|
||
option(QZXING_QML "Use qml" ${QZXING_QML}) | ||
if(QZXING_QML) | ||
target_sources(${PROJECT_NAME} PRIVATE QZXingImageProvider.cpp QZXingImageProvider.h) |
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 you also need to add target_compile_definitions(${PROJECT_NAME} PRIVATE QZXING_QML)
in here as well, as I'm still having to add_definitions()
for it to be built.
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 don't understand why you use this? You only set -DQZXING_QML=ON or -DQZXING_MULTIMEDIA=ON when run cmake configure.
When run cmake configure. It is default is ON.
You only add follow code in your CMakeLists.txt:
find_package(QZXing)
add_executable(YOUR_PROJECT)
target_link_libraries(${PROJECT_NAME} QZXing)
If you use qzxing source code in your project:
add_subdirectory(${QZXing_DIR}/src ${CMAKE_BINARY_DIR}/QZXing)
target_link_libraries(${PROJECT_NAME} PUBLIC QZXing)
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.
Setting only QZXING_QML=ON
doesn't work because you are not setting the necessary build define to trigger the feature in the code. Thus, I still have to do add_definitions(-DQZXING_XML)
in order to get the code compiled properly, otherwise there is API missing from the resulting library.
For QZXING_MULTIMEDIA
it is fine, because you added the target_compile_definitions()
for it in this CMakeLists.txt
when it is enabled. But the target_compile_definitions()
is missing for the QZXING_QML
feature.
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.
The QZXING_QML is added in follow code:
LIST(APPEND EXPORT_DEFINES QZXING_QML)
# Export defines by configure_file
target_compile_definitions(${PROJECT_NAME} PUBLIC ${EXPORT_DEFINES})
This is modified in the commit later. Please read all commits.
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.
See commit 4b67917
Had to make a few other changes to get things building again with the changes, and I still had to manually add a compile definition (which I mentioned in an inline comment). And I'm not sure why the default build was changed from static to shared here. But it looks mostly OK otherwise. |
@dobey If you need static library, please set -DBUILD_SHARED_LIBS=OFF. Please see the README.md of changed. |
Yes, I understood this. What I meant was, is that it's not clear from this merge request why it's being changed to be an installed shared library, or why the library name was changed to the capitalized version (beyond the fact that the |
If you do not want to change, please comment the following line: SET(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libs") |
OK. This is problematic. Even when I have done
|
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.
Needs to not install headers, pkgconfig file, or shared objects (nor build them) when BUILD_SHARED_LIBS
is set to off.
This is wrong usage. -DBUILD_SHARED_LIBS=OFF can only be specified on the command line: cmake . -DBUILD_SHARED_LIBS=OFF |
See a68853c |
@ftylitak Please merge it. |
Sorry, I've been very busy and haven't been able to look deeper into this again, but please do not merge this yet. I don't need to be having headers and pkgconfig and shared libraries installed along with my apps when I'm explicitly telling qxzing to build static (as it was doing automatically already before). It still also seems to be a lot of changes mixed together with no specific rationale as to why each individual part is being done, or why they all need to be done at once in a single large change. |
It is recommended that you use it as an external library, When you are use cmake. |
The README talks specifically about embedding qzxing and your changes here expressly break that. Your adding of |
You misunderstood. BUILD_SHARED_LIBS only controls whether to generate dynamic libraries. The installation target is controlled by the INSTALL command. See: https://cmake.org/cmake/help/latest/command/install.html?highlight=install#targets Your android program should modify the installation target and add COMPONENT. The qzxing has add COMPONENT Runtime. You can refer to the modification. |
@ftylitak Please merge it. The commit do not change the default behavior . |
No. I did not misunderstand. Your adding it as a cache option breaks the default behavior of cmake. Setting it to OFF does not result in a static qxzing build. I tried it. I had to remove it from your changes to get a static build. You also aren't using it or any other option as a determination to install development files or not. I shoudn't need to patch qzxing to keep the same behavior that I have now when building my application with a static qzxing from git. There is still no specified issue that this claims to fix, nor does it provide any specific rationale for the many changes. IMO it needs to at least be split up (add CI builds in one change, open issues for whatever bug(s) your'e referring to, and then maybe do refactoring if necessary separately). As it is, this is a massive set of changes which breaks current and expected behavior for developers embedding qzxing in their applications. |
No description provided.