google_robotstxt_parser 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/Gemfile +6 -0
- data/Guardfile +16 -0
- data/LICENSE +22 -0
- data/README.md +57 -0
- data/Rakefile +6 -0
- data/ext/robotstxt/.DS_Store +0 -0
- data/ext/robotstxt/extconf.rb +83 -0
- data/ext/robotstxt/robotstxt/.gitignore +1 -0
- data/ext/robotstxt/robotstxt/BUILD +40 -0
- data/ext/robotstxt/robotstxt/CMakeLists.txt +174 -0
- data/ext/robotstxt/robotstxt/CMakeLists.txt.in +30 -0
- data/ext/robotstxt/robotstxt/CONTRIBUTING.md +30 -0
- data/ext/robotstxt/robotstxt/LICENSE +203 -0
- data/ext/robotstxt/robotstxt/README.md +134 -0
- data/ext/robotstxt/robotstxt/WORKSPACE +28 -0
- data/ext/robotstxt/robotstxt/protocol-draft/README.md +9 -0
- data/ext/robotstxt/robotstxt/protocol-draft/draft-koster-rep-00.txt +529 -0
- data/ext/robotstxt/robotstxt/robots.cc +706 -0
- data/ext/robotstxt/robotstxt/robots.h +241 -0
- data/ext/robotstxt/robotstxt/robots_main.cc +101 -0
- data/ext/robotstxt/robotstxt/robots_test.cc +990 -0
- data/ext/robotstxt/robotstxt.cc +32 -0
- data/google_robotstxt_parser.gemspec +45 -0
- data/lib/google_robotstxt_parser/version.rb +6 -0
- data/lib/google_robotstxt_parser.rb +4 -0
- data/spec/google_robotstxt_parser_spec.rb +33 -0
- data/spec/spec_helper.rb +19 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 32b48f127a2b72ffb7d5cbfa054ade8e8d45a4593b52c28ca2ca8bb509778ac7
|
4
|
+
data.tar.gz: 5303c6585e4476a9fff592e05471bcff24962eff527b5c24d426b2106a1189ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 508205ed614e59004f401ef8f1d75ee32cc5a16e9b44394f07ef16299c3dda1cbd58abaa4747a40e4646c5fe0f28bad2c6dd9b757687e4438c0231da566a3ac1
|
7
|
+
data.tar.gz: 35bc34eb243f1673a291f060ff2ac440ea02653d79c489ae94b611325af982fd1448084d199a123ba01b6a00e02951cc6f178a561c14bacd7f744a569873d6e1
|
data/.gitignore
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
.byebug_history
|
14
|
+
|
15
|
+
/.yardoc/
|
16
|
+
/_yardoc/
|
17
|
+
/doc/
|
18
|
+
/rdoc/
|
19
|
+
|
20
|
+
/.bundle/
|
21
|
+
/vendor/bundle
|
22
|
+
/lib/bundler/man/
|
23
|
+
|
24
|
+
Gemfile.lock
|
25
|
+
.ruby-version
|
26
|
+
.ruby-gemset
|
27
|
+
|
28
|
+
.rvmrc
|
data/.gitmodules
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@la-revanche-des-sites.fr. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
4
|
+
require 'guard/rspec/dsl'
|
5
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
6
|
+
|
7
|
+
# RSpec files
|
8
|
+
rspec = dsl.rspec
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
11
|
+
watch(rspec.spec_files)
|
12
|
+
|
13
|
+
# Ruby files
|
14
|
+
ruby = dsl.ruby
|
15
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
16
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Philippe Creux
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
NOTE: This repo is still under construction, please use at your own risk. :-)
|
2
|
+
|
3
|
+
# Google Robotstxt Parser C++ Library Wrapper Gem
|
4
|
+
|
5
|
+
This is a unofficial Ruby gem that provides a wrapper around [Google Robotstxt Parser C++ library](https://github.com/google/robotstxt).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
```
|
11
|
+
gem 'google_robotstxt_parser'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```
|
16
|
+
bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```
|
21
|
+
gem install google_robotstxt_parser
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
At the time there is only one method available which is demonstrated below:
|
26
|
+
```
|
27
|
+
require './robotstxt'
|
28
|
+
include Robotstxt
|
29
|
+
|
30
|
+
robotstxt_content = "# robotstxt.org/\n\nUser-agent: *\nDisallow: /\n\nSitemap: https://www.bqst.fr/sitemap.xml"
|
31
|
+
user_agent = "GoogleBot"
|
32
|
+
url = "https://www.bqst.fr"
|
33
|
+
|
34
|
+
Robotstxt.allowed_by_robots(robotstxt_content, user_agent, url)
|
35
|
+
```
|
36
|
+
|
37
|
+
## Todo
|
38
|
+
There are quite a few outstanding tasks:
|
39
|
+
- [ ] Try to link the robots.dylib library from c-build instead of creating a symbolic link to /usr/local/lib/ to make it compatible with different OS
|
40
|
+
- [ ] Some tests :-)
|
41
|
+
|
42
|
+
|
43
|
+
## Author
|
44
|
+
[Bastien Montois](https://www.bqst.fr) @ [la-revanche-des-sites.fr](https://www.la-revanche-des-sites.fr)
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/larevanchedessites/google-robotstxt-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
48
|
+
|
49
|
+
## History
|
50
|
+
View the [changelog](https://github.com/larevanchedessites/google-robotstxt-ruby/blob/master/CHANGELOG.md). This gem follows [Semantic Versioning](http://semver.org/).
|
51
|
+
|
52
|
+
## License
|
53
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
54
|
+
See [LICENSE](https://github.com/larevanchedessites/google-robotstxt-ruby/blob/master/LICENSE) for details.
|
55
|
+
|
56
|
+
## Code of Conduct
|
57
|
+
Everyone interacting in the project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/larevanchedessites/google-robotstxt-ruby/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
Binary file
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mkmf'
|
4
|
+
require 'timeout'
|
5
|
+
|
6
|
+
$CXXFLAGS << " -std=c++11"
|
7
|
+
|
8
|
+
def sys(cmd)
|
9
|
+
puts " -- #{cmd}"
|
10
|
+
unless ret = xsystem(cmd)
|
11
|
+
raise "ERROR: '#{cmd}' failed"
|
12
|
+
end
|
13
|
+
ret
|
14
|
+
end
|
15
|
+
|
16
|
+
# Thrown when we detect CMake is taking too long and we killed it
|
17
|
+
class CMakeTimeout < StandardError
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.run_cmake(timeout, args)
|
21
|
+
# Set to process group so we can kill it and its children
|
22
|
+
pid = Process.spawn("cmake #{args}", pgroup: true)
|
23
|
+
|
24
|
+
Timeout.timeout(timeout) do
|
25
|
+
Process.waitpid(pid)
|
26
|
+
end
|
27
|
+
|
28
|
+
rescue Timeout::Error
|
29
|
+
# Kill it, #detach is essentially a background wait, since we don't actually
|
30
|
+
# care about waiting for it now
|
31
|
+
Process.kill(-9, pid)
|
32
|
+
Process.detach(pid)
|
33
|
+
raise CMakeTimeout.new("cmake has exceeded its timeout of #{timeout}s")
|
34
|
+
end
|
35
|
+
|
36
|
+
MAKE = if Gem.win_platform?
|
37
|
+
# On Windows, Ruby-DevKit only has 'make'.
|
38
|
+
find_executable('make')
|
39
|
+
else
|
40
|
+
find_executable('gmake') || find_executable('make')
|
41
|
+
end
|
42
|
+
|
43
|
+
unless MAKE
|
44
|
+
abort 'ERROR: GNU make is required to build Google Robotstxt Parser.'
|
45
|
+
end
|
46
|
+
|
47
|
+
CWD = __dir__
|
48
|
+
LIBROBOTSTXT_DIR = File.join(CWD, 'robotstxt')
|
49
|
+
|
50
|
+
LIBDIR = RbConfig::CONFIG['libdir']
|
51
|
+
INCLUDEDIR = RbConfig::CONFIG['includedir']
|
52
|
+
|
53
|
+
HEADER_DIRS = [
|
54
|
+
LIBROBOTSTXT_DIR,
|
55
|
+
"#{LIBROBOTSTXT_DIR}/c-build/libs/abseil-cpp-src"
|
56
|
+
]
|
57
|
+
|
58
|
+
LIB_DIRS = [
|
59
|
+
"#{LIBROBOTSTXT_DIR}/c-build"
|
60
|
+
]
|
61
|
+
|
62
|
+
Dir.chdir(LIBROBOTSTXT_DIR) do
|
63
|
+
Dir.mkdir('c-build') unless Dir.exist?('c-build')
|
64
|
+
Dir.chdir('c-build') do
|
65
|
+
puts 'Building Robotstxt library before creating Makefile...'
|
66
|
+
run_cmake(5 * 60, '..')
|
67
|
+
sys(MAKE)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
robotslib = "/usr/local/lib/librobots"
|
72
|
+
|
73
|
+
# TODO : remove this to link the lib directly from the c-build directory
|
74
|
+
FileUtils.ln_s "#{LIBROBOTSTXT_DIR}/c-build/librobots.dylib", "#{robotslib}.dylib", force: true
|
75
|
+
FileUtils.ln_s "#{LIBROBOTSTXT_DIR}/c-build/librobots.a", "#{robotslib}.a", force: true
|
76
|
+
|
77
|
+
dir_config('robotstxt', HEADER_DIRS, LIB_DIRS)
|
78
|
+
|
79
|
+
unless have_library('robots')
|
80
|
+
abort 'ERROR: Failed to build robots'
|
81
|
+
end
|
82
|
+
|
83
|
+
create_makefile('robotstxt')
|
@@ -0,0 +1 @@
|
|
1
|
+
c-build/*
|
@@ -0,0 +1,40 @@
|
|
1
|
+
package(default_visibility = ["//visibility:public"])
|
2
|
+
|
3
|
+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
4
|
+
|
5
|
+
licenses(["notice"])
|
6
|
+
|
7
|
+
exports_files(["LICENSE"])
|
8
|
+
|
9
|
+
cc_library(
|
10
|
+
name = "robots",
|
11
|
+
srcs = [
|
12
|
+
"robots.cc",
|
13
|
+
],
|
14
|
+
hdrs = [
|
15
|
+
"robots.h",
|
16
|
+
],
|
17
|
+
deps = [
|
18
|
+
"@com_google_absl//absl/base:core_headers",
|
19
|
+
"@com_google_absl//absl/container:fixed_array",
|
20
|
+
"@com_google_absl//absl/strings",
|
21
|
+
],
|
22
|
+
)
|
23
|
+
|
24
|
+
cc_test(
|
25
|
+
name = "robots_test",
|
26
|
+
srcs = ["robots_test.cc"],
|
27
|
+
deps = [
|
28
|
+
":robots",
|
29
|
+
"@com_google_absl//absl/strings",
|
30
|
+
"@com_google_googletest//:gtest_main",
|
31
|
+
],
|
32
|
+
)
|
33
|
+
|
34
|
+
cc_binary(
|
35
|
+
name = "robots_main",
|
36
|
+
srcs = ["robots_main.cc"],
|
37
|
+
deps = [
|
38
|
+
":robots",
|
39
|
+
],
|
40
|
+
)
|
@@ -0,0 +1,174 @@
|
|
1
|
+
PROJECT(robots)
|
2
|
+
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
|
3
|
+
|
4
|
+
SET(CMAKE_CXX_STANDARD 11)
|
5
|
+
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
6
|
+
|
7
|
+
SET(VERSION "0.0.0")
|
8
|
+
|
9
|
+
STRING(REGEX MATCHALL "([0-9]+)" VERSION_DIGITS "${VERSION}")
|
10
|
+
|
11
|
+
LIST(GET VERSION_DIGITS 0 CPACK_PACKAGE_VERSION_MAJOR)
|
12
|
+
LIST(GET VERSION_DIGITS 1 CPACK_PACKAGE_VERSION_MINOR)
|
13
|
+
LIST(GET VERSION_DIGITS 2 CPACK_PACKAGE_VERSION_PATCH)
|
14
|
+
|
15
|
+
SET(CPACK_PACKAGE_NAME "robots")
|
16
|
+
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Google's robots.txt parser and matcher C++ library")
|
17
|
+
SET(CPACK_PACKAGE_VENDOR "Google Inc.")
|
18
|
+
SET(CPACK_PACAKGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
|
19
|
+
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
|
20
|
+
|
21
|
+
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_DESCRIPTION_SUMMARY} ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
22
|
+
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
23
|
+
|
24
|
+
SET(base_with_ver "robots-[0-9]+\\\\.[0-9]+\\\\.[0-9]+")
|
25
|
+
SET(CPACK_SOURCE_IGNORE_FILES
|
26
|
+
"/_CPack_Packages/"
|
27
|
+
"/CMakeFiles/"
|
28
|
+
"/.deps/"
|
29
|
+
"^${base_with_ver}(-Source|-Linux)?/"
|
30
|
+
"${base_with_ver}.tar\\\\.(gz|bz2|Z|lzma|xz)$"
|
31
|
+
"\\\\.o$"
|
32
|
+
"~$"
|
33
|
+
"/\\\\.svn/"
|
34
|
+
"/CMakeCache\\\\.txt$"
|
35
|
+
"/CTestTestfile\\\\.cmake$"
|
36
|
+
"/cmake_install\\\\.cmake$"
|
37
|
+
"/CPackConfig\\\\.cmake$"
|
38
|
+
"/CPackSourceConfig\\\\.cmake$"
|
39
|
+
"/tags$"
|
40
|
+
"^config\\\\.h$"
|
41
|
+
"/install_manifest\\\\.txt$"
|
42
|
+
"/Testing/"
|
43
|
+
"ids-whitelist\\\\.txt"
|
44
|
+
"/_Inline/"
|
45
|
+
"/(B|build|BUILD)/"
|
46
|
+
"/autom4te.cache/"
|
47
|
+
)
|
48
|
+
|
49
|
+
############ build options ##############
|
50
|
+
|
51
|
+
OPTION(ROBOTS_BUILD_STATIC "If ON, robots will build also the static library" ON)
|
52
|
+
OPTION(ROBOTS_BUILD_TESTS "If ON, robots will build test targets" OFF)
|
53
|
+
OPTION(ROBOTS_INSTALL "If ON, enable the installation of the targets" ON)
|
54
|
+
|
55
|
+
############ helper libs ############
|
56
|
+
|
57
|
+
INCLUDE(CPack)
|
58
|
+
INCLUDE(CheckCCompilerFlag)
|
59
|
+
INCLUDE(ExternalProject)
|
60
|
+
|
61
|
+
############ dependencies ##############
|
62
|
+
|
63
|
+
CONFIGURE_FILE(CMakeLists.txt.in libs/CMakeLists.txt)
|
64
|
+
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libs)
|
65
|
+
|
66
|
+
IF(result)
|
67
|
+
MESSAGE(FATAL_ERROR "Failed to download dependencies: ${result}")
|
68
|
+
ENDIF()
|
69
|
+
|
70
|
+
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} --build . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libs)
|
71
|
+
|
72
|
+
IF(result)
|
73
|
+
MESSAGE(FATAL_ERROR "Failed to download dependencies: ${result}")
|
74
|
+
ENDIF()
|
75
|
+
|
76
|
+
# abseil-cpp
|
77
|
+
IF(MSVC)
|
78
|
+
# /wd4005 macro-redefinition
|
79
|
+
# /wd4068 unknown pragma
|
80
|
+
# /wd4244 conversion from 'type1' to 'type2'
|
81
|
+
# /wd4267 conversion from 'size_t' to 'type2'
|
82
|
+
# /wd4800 force value to bool 'true' or 'false' (performance warning)
|
83
|
+
ADD_COMPILE_OPTIONS(/wd4005 /wd4068 /wd4244 /wd4267 /wd4800)
|
84
|
+
ADD_DEFINITIONS(/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS)
|
85
|
+
ENDIF(MSVC)
|
86
|
+
|
87
|
+
ADD_SUBDIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-src
|
88
|
+
${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-build
|
89
|
+
EXCLUDE_FROM_ALL)
|
90
|
+
|
91
|
+
IF(ROBOTS_BUILD_TESTS)
|
92
|
+
INCLUDE(CTest)
|
93
|
+
|
94
|
+
# googletest
|
95
|
+
ADD_SUBDIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/libs/gtest-src
|
96
|
+
${CMAKE_CURRENT_BINARY_DIR}/libs/gtest-build
|
97
|
+
EXCLUDE_FROM_ALL)
|
98
|
+
|
99
|
+
SET(INSTALL_GTEST 0)
|
100
|
+
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
101
|
+
|
102
|
+
IF(CMAKE_VERSION VERSION_LESS 2.8.11)
|
103
|
+
INCLUDE_DIRECTORIES(${gtest_SOURCE_DIR}/include)
|
104
|
+
ENDIF()
|
105
|
+
ENDIF(ROBOTS_BUILD_TESTS)
|
106
|
+
|
107
|
+
########### compiler flags ##############
|
108
|
+
|
109
|
+
|
110
|
+
SET(COMPILER_FLAGS_TO_CHECK
|
111
|
+
"-Wall" "-Werror=implicit-function-declaration"
|
112
|
+
)
|
113
|
+
|
114
|
+
IF(CPU_ARCH)
|
115
|
+
LIST(APPEND COMPILER_FLAGS_TO_CHECK "-march=${CPU_ARCH}")
|
116
|
+
ENDIF(CPU_ARCH)
|
117
|
+
|
118
|
+
########### project files ###############
|
119
|
+
|
120
|
+
INCLUDE_DIRECTORIES(.)
|
121
|
+
|
122
|
+
######### targets ###########
|
123
|
+
|
124
|
+
SET(LIBROBOTS_LIBS)
|
125
|
+
|
126
|
+
SET(robots_SRCS ./robots.cc)
|
127
|
+
SET(robots_LIBS absl::base absl::container absl::strings)
|
128
|
+
|
129
|
+
ADD_LIBRARY(robots SHARED ${robots_SRCS})
|
130
|
+
TARGET_LINK_LIBRARIES(robots ${robots_LIBS})
|
131
|
+
LIST(APPEND LIBROBOTS_LIBS "robots")
|
132
|
+
|
133
|
+
IF(ROBOTS_BUILD_STATIC)
|
134
|
+
ADD_LIBRARY(robots-static STATIC ${robots_SRCS})
|
135
|
+
TARGET_LINK_LIBRARIES(robots-static ${robots_LIBS})
|
136
|
+
|
137
|
+
LIST(APPEND LIBROBOTS_LIBS "robots-static")
|
138
|
+
|
139
|
+
SET_TARGET_PROPERTIES(robots-static PROPERTIES OUTPUT_NAME "robots")
|
140
|
+
|
141
|
+
SET_TARGET_PROPERTIES(${LIBROBOTS_LIBS} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
142
|
+
ENDIF(ROBOTS_BUILD_STATIC)
|
143
|
+
|
144
|
+
IF(WIN_32)
|
145
|
+
SET_TARGET_PROPERTIES(robots PROPERTIES DEFINE_SYMBOL DLL_EXPORT)
|
146
|
+
ENDIF(WIN_32)
|
147
|
+
|
148
|
+
ADD_EXECUTABLE(robots-main ./robots_main.cc)
|
149
|
+
TARGET_LINK_LIBRARIES(robots-main ${LIBROBOTS_LIBS})
|
150
|
+
SET_TARGET_PROPERTIES(robots-main PROPERTIES OUTPUT_NAME "robots")
|
151
|
+
|
152
|
+
############ installation ############
|
153
|
+
|
154
|
+
IF(ROBOTS_INSTALL)
|
155
|
+
INSTALL(TARGETS ${LIBROBOTS_LIBS}
|
156
|
+
LIBRARY DESTINATION lib
|
157
|
+
ARCHIVE DESTINATION lib
|
158
|
+
)
|
159
|
+
|
160
|
+
INSTALL(FILES ${CMAKE_SOURCE_DIR}/robots.h DESTINATION include)
|
161
|
+
|
162
|
+
INSTALL(TARGETS robots-main DESTINATION bin)
|
163
|
+
ENDIF(ROBOTS_INSTALL)
|
164
|
+
|
165
|
+
############ tests ##############
|
166
|
+
|
167
|
+
IF(ROBOTS_BUILD_TESTS)
|
168
|
+
ENABLE_TESTING()
|
169
|
+
|
170
|
+
ADD_EXECUTABLE(robots-test ./robots_test.cc)
|
171
|
+
TARGET_LINK_LIBRARIES(robots-test ${LIBROBOTS_LIBS} gtest_main)
|
172
|
+
ADD_TEST(NAME robots-test COMMAND robots-test)
|
173
|
+
ENDIF(ROBOTS_BUILD_TESTS)
|
174
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
PROJECT(dependency-downloader NONE)
|
3
|
+
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
|
4
|
+
|
5
|
+
INCLUDE(ExternalProject)
|
6
|
+
|
7
|
+
ExternalProject_Add(abseilcpp
|
8
|
+
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
|
9
|
+
GIT_TAG master
|
10
|
+
GIT_PROGRESS 1
|
11
|
+
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-src"
|
12
|
+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-build"
|
13
|
+
CONFIGURE_COMMAND ""
|
14
|
+
BUILD_COMMAND ""
|
15
|
+
INSTALL_COMMAND ""
|
16
|
+
TEST_COMMAND ""
|
17
|
+
)
|
18
|
+
|
19
|
+
ExternalProject_Add(googletest
|
20
|
+
GIT_REPOSITORY https://github.com/google/googletest.git
|
21
|
+
GIT_TAG master
|
22
|
+
GIT_PROGRESS 1
|
23
|
+
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/gtest-src"
|
24
|
+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/gtest-build"
|
25
|
+
CONFIGURE_COMMAND ""
|
26
|
+
BUILD_COMMAND ""
|
27
|
+
INSTALL_COMMAND ""
|
28
|
+
TEST_COMMAND ""
|
29
|
+
)
|
30
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# How to Contribute
|
2
|
+
|
3
|
+
We'd love to accept your patches and contributions to this project. There are
|
4
|
+
just a few small guidelines you need to follow.
|
5
|
+
|
6
|
+
## Contributor License Agreement
|
7
|
+
|
8
|
+
Contributions to this project must be accompanied by a Contributor License
|
9
|
+
Agreement. You (or your employer) retain the copyright to your contribution;
|
10
|
+
this simply gives us permission to use and redistribute your contributions as
|
11
|
+
part of the project. Head over to <https://cla.developers.google.com/> to see
|
12
|
+
your current agreements on file or to sign a new one.
|
13
|
+
|
14
|
+
You generally only need to submit a CLA once, so if you've already submitted one
|
15
|
+
(even if it was for a different project), you probably don't need to do it
|
16
|
+
again.
|
17
|
+
|
18
|
+
## Code reviews
|
19
|
+
|
20
|
+
All submissions, including submissions by project members, require review. We
|
21
|
+
use GitHub pull requests for this purpose. Keep in mind that this library is
|
22
|
+
used in Google's production systems, so we need to be very strict about what
|
23
|
+
changes we accept. Consult
|
24
|
+
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
25
|
+
information on using pull requests.
|
26
|
+
|
27
|
+
## Community Guidelines
|
28
|
+
|
29
|
+
This project follows [Google's Open Source Community
|
30
|
+
Guidelines](https://opensource.google.com/conduct/).
|