-
Notifications
You must be signed in to change notification settings - Fork 844
update cmake for rpc and swoc #9409
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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,37 @@ | ||
| ####################### | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
| # agreements. See the NOTICE file distributed with this work for additional information regarding | ||
| # copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software distributed under the License | ||
| # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
| # or implied. See the License for the specific language governing permissions and limitations under | ||
| # the License. | ||
| # | ||
| ####################### | ||
|
|
||
| # subproject_version(<subproject-name> <result-variable>) | ||
| # | ||
| # Extract version of a sub-project, which was previously included with add_subdirectory(). | ||
| function(subproject_version subproject_name VERSION_VAR) | ||
| # Read CMakeLists.txt for subproject and extract project() call(s) from it. | ||
| file(STRINGS "${${subproject_name}_SOURCE_DIR}/CMakeLists.txt" project_calls REGEX "[ \t]*project\\(") | ||
| # For every project() call try to extract its VERSION option | ||
| foreach(project_call ${project_calls}) | ||
| string(REGEX MATCH "VERSION[ ]+([^ )]+)" version_param "${project_call}") | ||
| if(version_param) | ||
| set(version_value "${CMAKE_MATCH_1}") | ||
| endif() | ||
| endforeach() | ||
| if(version_value) | ||
| set(${VERSION_VAR} "${version_value}" PARENT_SCOPE) | ||
| message("INFO: ${subproject_name} version ${version_value}") | ||
| else() | ||
| message("WARNING: Cannot extract version for subproject '${subproject_name}'") | ||
| endif() | ||
| endfunction(subproject_version) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| cmake_minimum_required(VERSION 3.11) | ||
|
|
||
| project(Lib-SWOC CXX) | ||
| set(LIBSWOC_VERSION "1.4.2") | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| cmake_policy(SET CMP0087 NEW) | ||
| # override "lib64" to be "lib" unless the user explicitly sets it. | ||
| set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "directory for libraries" FORCE) | ||
| include(GNUInstallDirs) | ||
|
|
||
| cmake_dependent_option(LIBSWOC_INSTALL | ||
| "Enable generation of libswoc install targets" ON | ||
| "NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT" OFF) | ||
|
|
||
| set(HEADER_FILES | ||
| include/swoc/swoc_version.h | ||
| include/swoc/ArenaWriter.h | ||
| include/swoc/BufferWriter.h | ||
| include/swoc/bwf_base.h | ||
| include/swoc/bwf_ex.h | ||
| include/swoc/bwf_ip.h | ||
| include/swoc/bwf_std.h | ||
| include/swoc/DiscreteRange.h | ||
| include/swoc/Errata.h | ||
| include/swoc/IntrusiveDList.h | ||
| include/swoc/IntrusiveHashMap.h | ||
| include/swoc/swoc_ip.h | ||
| include/swoc/IPEndpoint.h | ||
| include/swoc/IPAddr.h | ||
| include/swoc/IPSrv.h | ||
| include/swoc/IPRange.h | ||
| include/swoc/Lexicon.h | ||
| include/swoc/MemArena.h | ||
| include/swoc/MemSpan.h | ||
| include/swoc/Scalar.h | ||
| include/swoc/TextView.h | ||
| include/swoc/swoc_file.h | ||
| include/swoc/swoc_meta.h | ||
| include/swoc/string_view.h | ||
| include/swoc/Vectray.h | ||
| ) | ||
|
|
||
| # These are external but required. | ||
| set(EXTERNAL_HEADER_FILES | ||
| include/swoc/ext/HashFNV.h | ||
| ) | ||
|
|
||
| set(CC_FILES | ||
| src/bw_format.cc | ||
| src/bw_ip_format.cc | ||
| src/ArenaWriter.cc | ||
| src/Errata.cc | ||
| src/swoc_ip.cc | ||
| src/MemArena.cc | ||
| src/RBTree.cc | ||
| src/swoc_file.cc | ||
| src/TextView.cc | ||
| src/string_view_util.cc | ||
| ) | ||
|
|
||
| add_library(libswoc SHARED ${CC_FILES}) | ||
| set_target_properties(libswoc PROPERTIES OUTPUT_NAME swoc-${LIBSWOC_VERSION}) | ||
| if (CMAKE_COMPILER_IS_GNUCXX) | ||
| target_compile_options(libswoc PRIVATE -fPIC -Wall -Wextra -Werror -Wnon-virtual-dtor -Wpedantic) | ||
| endif() | ||
|
|
||
| add_library(libswoc-static STATIC ${CC_FILES}) | ||
| set_target_properties(libswoc-static PROPERTIES OUTPUT_NAME swoc-static-${LIBSWOC_VERSION}) | ||
| if (CMAKE_COMPILER_IS_GNUCXX) | ||
| target_compile_options(libswoc-static PRIVATE -fPIC -Wall -Wextra -Werror -Wnon-virtual-dtor -Wpedantic) | ||
| endif() | ||
|
|
||
| # Not quite sure how this works, but I think it generates one of two paths depending on the context. | ||
| # That is, the generator functions return non-empty strings only in the corresponding context. | ||
| target_include_directories(libswoc-static | ||
| PUBLIC | ||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
| $<INSTALL_INTERFACE:include> | ||
| ) | ||
|
|
||
| target_include_directories(libswoc | ||
| PUBLIC | ||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
| $<INSTALL_INTERFACE:include> | ||
| ) | ||
|
|
||
| if (LIBSWOC_INSTALL) | ||
| # These install target variables are created by GNUInstallDirs. | ||
| install(TARGETS libswoc-static | ||
| EXPORT libswoc-static-config | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # seems to have no effect. | ||
| ) | ||
| install(TARGETS libswoc | ||
| EXPORT libswoc-config | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # seems to have no effect. | ||
| ) | ||
| install(DIRECTORY include/swoc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
|
||
| set(link-target libswoc.so) | ||
| set(link-src $<TARGET_FILE_NAME:libswoc>) | ||
| install(CODE | ||
| "execute_process(COMMAND bash -c \"echo Linking ${link-src} to ${link-target};cd ${CMAKE_INSTALL_FULL_LIBDIR} && (rm -f ${link-target};ln -s ${link-src} ${link-target}) | ||
| \")" | ||
| ) | ||
|
|
||
| install(EXPORT libswoc-static-config | ||
| NAMESPACE libswoc:: | ||
| DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libswoc | ||
| ) | ||
|
|
||
| install(EXPORT libswoc-config | ||
| NAMESPACE libswoc:: | ||
| DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libswoc | ||
| ) | ||
|
|
||
| # set(PKG_CONFIG_FILE libswoc.pc) | ||
| # set(PKG_STATIC_CONFIG_FILE libswoc-static.pc) | ||
| # configure_file("libswoc.pc.cmake" ${PKG_CONFIG_FILE} @ONLY) | ||
| # | ||
| # configure_file("libswoc.pc.cmake" libswoc.pc @ONLY) | ||
| # configure_file("libswoc-static.pc.cmake" libswoc-static.pc @ONLY) | ||
| # install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libswoc.pc ${CMAKE_CURRENT_BINARY_DIR}/libswoc-static.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) | ||
| # install(FILES ${PKG_STATIC_CONFIG_FILE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) | ||
| endif() | ||
|
|
||
| # Alledgedly this makes the targets "importable from the build directory" but I see no evidence of that. | ||
| # AFAICT the file isn't created at all even with this enabled. | ||
| #export(TARGETS libswoc FILE libswoc-config.cmake) | ||
|
|
||
| set(CLANG_DIRS ) | ||
|
|
||
| set_target_properties(libswoc-static PROPERTIES CLANG_FORMAT_DIRS "${PROJECT_SOURCE_DIR}/src;${PROJECT_SOURCE_DIR}/include") | ||
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,32 @@ | ||
| ####################### | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
| # agreements. See the NOTICE file distributed with this work for additional information regarding | ||
| # copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software distributed under the License | ||
| # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
| # or implied. See the License for the specific language governing permissions and limitations under | ||
| # the License. | ||
| # | ||
| ####################### | ||
|
|
||
| add_library(configmanager STATIC | ||
| FileManager.cc | ||
| AddConfigFilesHere.cc | ||
| ) | ||
| include_directories( | ||
| ${CMAKE_SOURCE_DIR}/mgmt | ||
| ${CMAKE_SOURCE_DIR}/proxy | ||
| ${CMAKE_SOURCE_DIR}/proxy/hdrs | ||
| ${CMAKE_SOURCE_DIR}/proxy/http | ||
| ${CMAKE_SOURCE_DIR}/iocore/eventsystem | ||
| ${CMAKE_SOURCE_DIR}/iocore/net | ||
| ${CMAKE_SOURCE_DIR}/iocore/cache | ||
| ${CMAKE_SOURCE_DIR}/iocore/aio | ||
| ${CMAKE_SOURCE_DIR}/iocore/dns | ||
| ) |
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 |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| ####################### | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
| # agreements. See the NOTICE file distributed with this work for additional information regarding | ||
| # copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software distributed under the License | ||
| # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
| # or implied. See the License for the specific language governing permissions and limitations under | ||
| # the License. | ||
| # | ||
| ####################### | ||
|
|
||
| include_directories( | ||
| ${CMAKE_SOURCE_DIR}/mgmt | ||
| ${CMAKE_SOURCE_DIR}/mgmt/rpc | ||
| ${CMAKE_SOURCE_DIR}/iocore/eventsystem | ||
| ${CMAKE_SOURCE_DIR}/iocore/utils | ||
| ${CMAKE_SOURCE_DIR}/iocore/cache | ||
| ${CMAKE_SOURCE_DIR}/iocore/aio | ||
| ${CMAKE_SOURCE_DIR}/iocore/net | ||
| ${CMAKE_SOURCE_DIR}/iocore/dns | ||
| ${CMAKE_SOURCE_DIR}/lib | ||
| ${CMAKE_SOURCE_DIR}/proxy | ||
| ${CMAKE_SOURCE_DIR}/proxy/hdrs | ||
| ${CMAKE_SOURCE_DIR}/proxy/http | ||
|
|
||
| ) | ||
|
|
||
| add_library(jsonrpc_protocol STATIC | ||
| jsonrpc/error/RPCError.cc | ||
| jsonrpc/JsonRPCManager.cc | ||
| jsonrpc/Context.cc | ||
| ) | ||
|
|
||
| add_library(jsonrpc_server STATIC | ||
| server/RPCServer.cc | ||
| server/CommBase.cc | ||
| server/IPCSocketServer.cc | ||
| config/JsonRPCConfig.cc | ||
| ) | ||
|
|
||
| add_library(rpcpublichandlers STATIC | ||
| handlers/common/RecordsUtils.cc | ||
| handlers/config/Configuration.cc | ||
| handlers/records/Records.cc | ||
| handlers/storage/Storage.cc | ||
| handlers/server/Server.cc | ||
| handlers/plugins/Plugins.cc | ||
| ) |
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
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.
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 had to comment these
configure_filelines out since the source files are missing. Otherwise this file is the same as swoc upstream.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.
Hmmm. I might to put those back in so that the internal libswoc can generate accurate pkg-config files. That would make it easier for external consumption to switch.