-
Notifications
You must be signed in to change notification settings - Fork 376
feat cmake: add CPM to several depenencies #1004
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
Closed
Closed
Changes from 20 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
a64dd15
feat cmake: add CPM to several depenencies
segoon 4dc8196
w
segoon bd65b9a
ccache
segoon 17a02b3
jemalloc=off
segoon 0c0ed53
jemmalloc=on
segoon 4048b94
benchmark
segoon 36b6a41
format
segoon a4731d8
w
segoon 3c26548
mark_targets_as_system
segoon 1c9cda4
fix name
segoon 279807c
fixes for nghttp2 (some of)
segoon f43b0a6
fixes for nghttp2
segoon 55aad23
format
segoon dd53efa
libev
segoon f54cc8e
cleanup
segoon f8c2db1
TODO
segoon 001159c
fix libev + libnghttp2
segoon 444180e
remove extra deps
segoon 48ddd77
benchmark-dev is not needed with CPM!
segoon 2e7e4e4
Revert "benchmark-dev is not needed with CPM!"
segoon 1cc6022
build once
segoon 5cc152d
add options to docs
segoon 7a0abb8
Merge remote-tracking branch 'origin/develop' into feature/ci-minimal
segoon ba25113
more robust execute_process
segoon 4246ed7
Merge remote-tracking branch 'origin/develop' into feature/ci-minimal
segoon e14e4cc
fix for Conan
segoon 0f4357a
fix cpm
segoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| name: Ubuntu | ||
|
|
||
| 'on': | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
| - develop | ||
| - feature/** | ||
|
|
||
| env: | ||
| JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64 | ||
| UBSAN_OPTIONS: print_stacktrace=1 | ||
| ASAN_OPTIONS: detect_odr_violation=2 | ||
| CCACHE_DIR: /home/runner/.cache/ccache | ||
| CCACHE_NOHASHDIR: true | ||
| CPM_SOURCE_CACHE: /home/runner/.cache/CPM | ||
| REDIS_SLEEP_WORKAROUND_SECONDS: 60 | ||
|
|
||
| jobs: | ||
| posix: | ||
| strategy: | ||
| fail-fast: false | ||
| env: | ||
| CMAKE_FLAGS: >- | ||
| -DCMAKE_BUILD_TYPE=Debug | ||
| -DCMAKE_CXX_STANDARD=17 | ||
| -DUSERVER_SANITIZE="ub addr" | ||
| -DUSERVER_BUILD_SAMPLES=1 | ||
| -DUSERVER_BUILD_TESTS=1 | ||
|
|
||
| name: ubuntu (minimal installation) | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Restore cached directories | ||
| id: restore-cache | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: | | ||
| ${{env.CCACHE_DIR}} | ||
| ${{env.CPM_SOURCE_CACHE}} | ||
| key: 'ubuntu-cache-dir ${{matrix.id}} ${{github.ref}} run-${{github.run_number}}' | ||
| restore-keys: | | ||
| ubuntu-cache-dir ${{matrix.id}} ${{github.ref}} | ||
| ubuntu-cache-dir ${{matrix.id}} | ||
|
|
||
| - name: Setup ramdrive for testsuites | ||
| run: | | ||
| sudo mkdir -p "/mnt/ramdisk/$USER" | ||
| sudo chmod 777 "/mnt/ramdisk/$USER" | ||
| sudo mount -t tmpfs -o size=2048M tmpfs "/mnt/ramdisk/$USER" | ||
|
|
||
| - name: Free disk space | ||
| run: | | ||
| df -h | ||
| # See https://stackoverflow.com/questions/75536771/github-runner-out-of-disk-space-after-building-docker-image | ||
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/lib/php* /opt/ghc \ | ||
| /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ | ||
| /opt/hostedtoolcache/CodeQL || true | ||
| sudo docker image prune --all --force | ||
| df -h | ||
|
|
||
| - name: Install common deps | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install build-essential clang cmake ccache libjemalloc-dev | ||
| sudo apt install \ | ||
| libssl-dev \ | ||
| libboost-context1.83-dev \ | ||
| libboost-coroutine1.83-dev \ | ||
| libboost-filesystem1.83-dev \ | ||
| libboost-iostreams1.83-dev \ | ||
| libboost-locale1.83-dev \ | ||
| libboost-program-options1.83-dev \ | ||
| libboost-stacktrace1.83-dev \ | ||
| libbenchmark-dev | ||
|
|
||
| - name: Setup ccache | ||
| run: | | ||
| ccache -M 2.0GB | ||
| ccache -s -v | ||
|
|
||
| - name: Run cmake | ||
| run: | | ||
| cmake -S . -B build_debug | ||
|
|
||
| - name: Compile | ||
| run: | | ||
| pwd | ||
| cd build_debug | ||
| cmake --build . -j $(nproc) | ||
|
|
||
| - name: Save cached directories | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: | | ||
| ${{env.CCACHE_DIR}} | ||
| ${{env.CPM_SOURCE_CACHE}} | ||
| key: ${{ steps.restore-cache.outputs.cache-primary-key }} | ||
|
|
||
| - name: Show cache stats | ||
| run: | | ||
| du -h -d 1 ${{env.CCACHE_DIR}} | ||
| du -h -d 1 ${{env.CPM_SOURCE_CACHE}} | ||
| ccache -s -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,10 @@ _userver_module_begin( | |
| libev-devel | ||
| PACMAN_NAMES | ||
| libev | ||
|
|
||
| CPM_NAME libev | ||
| CPM_URL http://dist.schmorp.de/libev/libev-4.33.tar.gz | ||
| CPM_DOWNLOAD_ONLY | ||
| ) | ||
|
|
||
| _userver_module_find_include(NAMES ev.h libev/ev.h) | ||
|
|
@@ -18,5 +22,36 @@ _userver_module_find_library(NAMES ev) | |
| _userver_module_end() | ||
|
|
||
| if(NOT TARGET libev::libev) | ||
| add_library(libev::libev ALIAS libev) | ||
| if(TARGET libev) | ||
| add_library(libev::libev ALIAS libev) | ||
| elseif(libev_ADDED) | ||
| # nghttp2 doesn't use find_package(), but calls find_path() and find_library() | ||
| # so we have to provide libev.a at the _configure_ time, not at build time, =( | ||
|
Member
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. Is it also necessary to build a fresh copy of libev on each reconfigure?
Collaborator
Author
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. fixed |
||
| execute_process( | ||
| COMMAND ${CMAKE_COMMAND} -E copy_directory ${libev_SOURCE_DIR} ${libev_BINARY_DIR} | ||
| ) | ||
| execute_process( | ||
| COMMAND ./configure | ||
| WORKING_DIRECTORY ${libev_BINARY_DIR} | ||
| ) | ||
| execute_process( | ||
| COMMAND make | ||
| WORKING_DIRECTORY ${libev_BINARY_DIR} | ||
| ) | ||
| execute_process( | ||
| COMMAND rm -rf ${libev_BINARY_DIR}/.libs/libev.so | ||
| ) | ||
|
|
||
| add_library(libev STATIC IMPORTED) | ||
| target_include_directories(libev INTERFACE ${libev_BINARY_DIR}) | ||
| set_target_properties(libev PROPERTIES IMPORTED_LOCATION ${libev_BINARY_DIR}/.libs/libev.a) | ||
|
|
||
| # For nghttp2 installed from CPM | ||
| list(APPEND CMAKE_INCLUDE_PATH ${libev_BINARY_DIR}) | ||
| list(APPEND CMAKE_LIBRARY_PATH ${libev_BINARY_DIR}/.libs) | ||
|
|
||
| add_library(libev::libev ALIAS libev) | ||
| else() | ||
| message(FATAL_ERROR "libev cmake target not found, don't know how to link") | ||
| endif() | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.