Browse Source

Add conan build description to README

- Disable crosscompile detection to fix conan build for now
Alexey Edelev 3 years ago
parent
commit
1b694d02f5
2 changed files with 50 additions and 9 deletions
  1. 7 9
      CMakeLists.txt
  2. 43 0
      README.md

+ 7 - 9
CMakeLists.txt

@@ -60,15 +60,13 @@ elseif(WIN32)
 endif()
 
 include(CMakePackageConfigHelpers)
-if(NOT CMAKE_CROSSCOMPILING)
-    configure_package_config_file(
-        "${CMAKE_CURRENT_SOURCE_DIR}/ProjectConfig.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
-        INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")
-    install(FILES "${QT_PROTOBUF_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
-        COMPONENT dev)
-    export(PACKAGE ${PROJECT_NAME})
-    add_subdirectory("src/generator")
-endif()
+configure_package_config_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/ProjectConfig.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+    INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")
+install(FILES "${QT_PROTOBUF_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
+    COMPONENT dev)
+export(PACKAGE ${PROJECT_NAME})
+add_subdirectory("src/generator")
 
 add_subdirectory("src/protobuf")
 add_subdirectory("src/grpc")

+ 43 - 0
README.md

@@ -251,6 +251,49 @@ cmake ..
 cmake --build . [--config <RELEASE|DEBUG>] -- /m:<N>
 ```
 
+## Conan build
+
+QtProtobuf supports conan builds since version 0.4.0.
+
+### Build QtProtobuf
+
+Before build make sure that all sub-modules are deinitilized:
+
+```bash
+git submodule deinit -f --all
+```
+
+Build QtProtobuf:
+
+```bash
+mkdir -p build_conan
+cd build_conan
+conan source ..
+conan install .. --build=microjson
+conan build ..
+```
+
+### Conan project integration
+
+QtProtobuf conan source packages are hosted on JFrog Bintray. Add remote to conan:
+
+```bash
+conan remote add semlanik https://api.bintray.com/conan/semlanik/libs
+```
+
+To intergrate QtProtobuf add it as a dependency to your conanfile.py:
+
+```python
+    ...
+    requires = [
+        ...
+        "qtprotobuf/0.5.0@semlanik/stable",
+        ...
+    ]
+    ...
+```
+>**Note:** You also may use QtProtobuf package is built localy or from other remote source. Look in conan documentation for details.
+
 # Usage
 ## Direct usage of generator