Move rapidjson/ under include/ to match upstream

Fix BUILD.gn/CMakeLists.txt accordingly.

Change-Id: I9ce6b0268a1b2efe85e66bf0f041f82db92585ac
diff --git a/BUILD.gn b/BUILD.gn
index 031ded3..cbb9f0c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -28,6 +28,7 @@
 config("rapidjson_config") {
   include_dirs = [
     ".",
+    "include",
   ]
 
   # rapidjson needs these defines to support C++11 features. These features
@@ -43,40 +44,40 @@
 
 source_set("rapidjson") {
   sources = [
-    "rapidjson/allocators.h",
-    "rapidjson/cursorstreamwrapper.h",
-    "rapidjson/document.h",
-    "rapidjson/encodedstream.h",
-    "rapidjson/encodings.h",
-    "rapidjson/error/en.h",
-    "rapidjson/error/error.h",
-    "rapidjson/filereadstream.h",
-    "rapidjson/filewritestream.h",
-    "rapidjson/fwd.h",
-    "rapidjson/internal/biginteger.h",
-    "rapidjson/internal/diyfp.h",
-    "rapidjson/internal/dtoa.h",
-    "rapidjson/internal/ieee754.h",
-    "rapidjson/internal/itoa.h",
-    "rapidjson/internal/meta.h",
-    "rapidjson/internal/pow10.h",
-    "rapidjson/internal/regex.h",
-    "rapidjson/internal/stack.h",
-    "rapidjson/internal/strfunc.h",
-    "rapidjson/internal/strtod.h",
-    "rapidjson/internal/swap.h",
-    "rapidjson/istreamwrapper.h",
-    "rapidjson/memorybuffer.h",
-    "rapidjson/memorystream.h",
-    "rapidjson/ostreamwrapper.h",
-    "rapidjson/pointer.h",
-    "rapidjson/prettywriter.h",
-    "rapidjson/rapidjson.h",
-    "rapidjson/reader.h",
-    "rapidjson/schema.h",
-    "rapidjson/stream.h",
-    "rapidjson/stringbuffer.h",
-    "rapidjson/writer.h",
+    "include/rapidjson/allocators.h",
+    "include/rapidjson/cursorstreamwrapper.h",
+    "include/rapidjson/document.h",
+    "include/rapidjson/encodedstream.h",
+    "include/rapidjson/encodings.h",
+    "include/rapidjson/error/en.h",
+    "include/rapidjson/error/error.h",
+    "include/rapidjson/filereadstream.h",
+    "include/rapidjson/filewritestream.h",
+    "include/rapidjson/fwd.h",
+    "include/rapidjson/internal/biginteger.h",
+    "include/rapidjson/internal/diyfp.h",
+    "include/rapidjson/internal/dtoa.h",
+    "include/rapidjson/internal/ieee754.h",
+    "include/rapidjson/internal/itoa.h",
+    "include/rapidjson/internal/meta.h",
+    "include/rapidjson/internal/pow10.h",
+    "include/rapidjson/internal/regex.h",
+    "include/rapidjson/internal/stack.h",
+    "include/rapidjson/internal/strfunc.h",
+    "include/rapidjson/internal/strtod.h",
+    "include/rapidjson/internal/swap.h",
+    "include/rapidjson/istreamwrapper.h",
+    "include/rapidjson/memorybuffer.h",
+    "include/rapidjson/memorystream.h",
+    "include/rapidjson/ostreamwrapper.h",
+    "include/rapidjson/pointer.h",
+    "include/rapidjson/prettywriter.h",
+    "include/rapidjson/rapidjson.h",
+    "include/rapidjson/reader.h",
+    "include/rapidjson/schema.h",
+    "include/rapidjson/stream.h",
+    "include/rapidjson/stringbuffer.h",
+    "include/rapidjson/writer.h",
   ]
 
   public_configs = [ ":rapidjson_config" ]
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c19964..57c6801 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,15 +6,8 @@
 
 project(rapidjson)
 
-set(RAPIDJSON_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
-
-macro(rapidjson_export_hdrs)
-  file(RELATIVE_PATH _file_path "${PROJECT_SOURCE_DIR}"
-    "${CMAKE_CURRENT_SOURCE_DIR}")
-  foreach(name ${ARGN})
-    file(COPY "${name}.h" DESTINATION ${RAPIDJSON_INCLUDE_DIR}/${_file_path})
-  endforeach()
-endmacro()
-
-add_subdirectory(rapidjson)
-
+add_library(rapidjson INTERFACE)
+target_include_directories(rapidjson INTERFACE
+  "${CMAKE_CURRENT_SOURCE_DIR}"
+  "${CMAKE_CURRENT_SOURCE_DIR}/include"
+)
diff --git a/rapidjson/allocators.h b/include/rapidjson/allocators.h
similarity index 100%
rename from rapidjson/allocators.h
rename to include/rapidjson/allocators.h
diff --git a/rapidjson/cursorstreamwrapper.h b/include/rapidjson/cursorstreamwrapper.h
similarity index 100%
rename from rapidjson/cursorstreamwrapper.h
rename to include/rapidjson/cursorstreamwrapper.h
diff --git a/rapidjson/document.h b/include/rapidjson/document.h
similarity index 100%
rename from rapidjson/document.h
rename to include/rapidjson/document.h
diff --git a/rapidjson/encodedstream.h b/include/rapidjson/encodedstream.h
similarity index 100%
rename from rapidjson/encodedstream.h
rename to include/rapidjson/encodedstream.h
diff --git a/rapidjson/encodings.h b/include/rapidjson/encodings.h
similarity index 100%
rename from rapidjson/encodings.h
rename to include/rapidjson/encodings.h
diff --git a/rapidjson/error/en.h b/include/rapidjson/error/en.h
similarity index 100%
rename from rapidjson/error/en.h
rename to include/rapidjson/error/en.h
diff --git a/rapidjson/error/error.h b/include/rapidjson/error/error.h
similarity index 100%
rename from rapidjson/error/error.h
rename to include/rapidjson/error/error.h
diff --git a/rapidjson/filereadstream.h b/include/rapidjson/filereadstream.h
similarity index 100%
rename from rapidjson/filereadstream.h
rename to include/rapidjson/filereadstream.h
diff --git a/rapidjson/filewritestream.h b/include/rapidjson/filewritestream.h
similarity index 100%
rename from rapidjson/filewritestream.h
rename to include/rapidjson/filewritestream.h
diff --git a/rapidjson/fwd.h b/include/rapidjson/fwd.h
similarity index 100%
rename from rapidjson/fwd.h
rename to include/rapidjson/fwd.h
diff --git a/rapidjson/internal/biginteger.h b/include/rapidjson/internal/biginteger.h
similarity index 100%
rename from rapidjson/internal/biginteger.h
rename to include/rapidjson/internal/biginteger.h
diff --git a/rapidjson/internal/diyfp.h b/include/rapidjson/internal/diyfp.h
similarity index 100%
rename from rapidjson/internal/diyfp.h
rename to include/rapidjson/internal/diyfp.h
diff --git a/rapidjson/internal/dtoa.h b/include/rapidjson/internal/dtoa.h
similarity index 100%
rename from rapidjson/internal/dtoa.h
rename to include/rapidjson/internal/dtoa.h
diff --git a/rapidjson/internal/ieee754.h b/include/rapidjson/internal/ieee754.h
similarity index 100%
rename from rapidjson/internal/ieee754.h
rename to include/rapidjson/internal/ieee754.h
diff --git a/rapidjson/internal/itoa.h b/include/rapidjson/internal/itoa.h
similarity index 100%
rename from rapidjson/internal/itoa.h
rename to include/rapidjson/internal/itoa.h
diff --git a/rapidjson/internal/meta.h b/include/rapidjson/internal/meta.h
similarity index 100%
rename from rapidjson/internal/meta.h
rename to include/rapidjson/internal/meta.h
diff --git a/rapidjson/internal/pow10.h b/include/rapidjson/internal/pow10.h
similarity index 100%
rename from rapidjson/internal/pow10.h
rename to include/rapidjson/internal/pow10.h
diff --git a/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h
similarity index 100%
rename from rapidjson/internal/regex.h
rename to include/rapidjson/internal/regex.h
diff --git a/rapidjson/internal/stack.h b/include/rapidjson/internal/stack.h
similarity index 100%
rename from rapidjson/internal/stack.h
rename to include/rapidjson/internal/stack.h
diff --git a/rapidjson/internal/strfunc.h b/include/rapidjson/internal/strfunc.h
similarity index 100%
rename from rapidjson/internal/strfunc.h
rename to include/rapidjson/internal/strfunc.h
diff --git a/rapidjson/internal/strtod.h b/include/rapidjson/internal/strtod.h
similarity index 100%
rename from rapidjson/internal/strtod.h
rename to include/rapidjson/internal/strtod.h
diff --git a/rapidjson/internal/swap.h b/include/rapidjson/internal/swap.h
similarity index 100%
rename from rapidjson/internal/swap.h
rename to include/rapidjson/internal/swap.h
diff --git a/rapidjson/istreamwrapper.h b/include/rapidjson/istreamwrapper.h
similarity index 100%
rename from rapidjson/istreamwrapper.h
rename to include/rapidjson/istreamwrapper.h
diff --git a/rapidjson/memorybuffer.h b/include/rapidjson/memorybuffer.h
similarity index 100%
rename from rapidjson/memorybuffer.h
rename to include/rapidjson/memorybuffer.h
diff --git a/rapidjson/memorystream.h b/include/rapidjson/memorystream.h
similarity index 100%
rename from rapidjson/memorystream.h
rename to include/rapidjson/memorystream.h
diff --git a/rapidjson/msinttypes/inttypes.h b/include/rapidjson/msinttypes/inttypes.h
similarity index 100%
rename from rapidjson/msinttypes/inttypes.h
rename to include/rapidjson/msinttypes/inttypes.h
diff --git a/rapidjson/msinttypes/stdint.h b/include/rapidjson/msinttypes/stdint.h
similarity index 100%
rename from rapidjson/msinttypes/stdint.h
rename to include/rapidjson/msinttypes/stdint.h
diff --git a/rapidjson/ostreamwrapper.h b/include/rapidjson/ostreamwrapper.h
similarity index 100%
rename from rapidjson/ostreamwrapper.h
rename to include/rapidjson/ostreamwrapper.h
diff --git a/rapidjson/pointer.h b/include/rapidjson/pointer.h
similarity index 100%
rename from rapidjson/pointer.h
rename to include/rapidjson/pointer.h
diff --git a/rapidjson/prettywriter.h b/include/rapidjson/prettywriter.h
similarity index 100%
rename from rapidjson/prettywriter.h
rename to include/rapidjson/prettywriter.h
diff --git a/rapidjson/rapidjson.h b/include/rapidjson/rapidjson.h
similarity index 100%
rename from rapidjson/rapidjson.h
rename to include/rapidjson/rapidjson.h
diff --git a/rapidjson/reader.h b/include/rapidjson/reader.h
similarity index 100%
rename from rapidjson/reader.h
rename to include/rapidjson/reader.h
diff --git a/rapidjson/schema.h b/include/rapidjson/schema.h
similarity index 100%
rename from rapidjson/schema.h
rename to include/rapidjson/schema.h
diff --git a/rapidjson/stream.h b/include/rapidjson/stream.h
similarity index 100%
rename from rapidjson/stream.h
rename to include/rapidjson/stream.h
diff --git a/rapidjson/stringbuffer.h b/include/rapidjson/stringbuffer.h
similarity index 100%
rename from rapidjson/stringbuffer.h
rename to include/rapidjson/stringbuffer.h
diff --git a/rapidjson/writer.h b/include/rapidjson/writer.h
similarity index 100%
rename from rapidjson/writer.h
rename to include/rapidjson/writer.h
diff --git a/rapidjson/CMakeLists.txt b/rapidjson/CMakeLists.txt
deleted file mode 100644
index ecf1959..0000000
--- a/rapidjson/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-rapidjson_export_hdrs(
-  allocators
-  document
-  encodedstream
-  encodings
-  filereadstream
-  filewritestream
-  fwd
-  istreamwrapper
-  memorybuffer
-  memorystream
-  ostreamwrapper
-  pointer
-  prettywriter
-  rapidjson
-  reader
-  schema
-  stream
-  stringbuffer
-  writer
-)
-
-add_subdirectory(error)
-add_subdirectory(internal)
diff --git a/rapidjson/error/CMakeLists.txt b/rapidjson/error/CMakeLists.txt
deleted file mode 100644
index 07c3ac2..0000000
--- a/rapidjson/error/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-rapidjson_export_hdrs(
-  en
-  error
-)
diff --git a/rapidjson/internal/CMakeLists.txt b/rapidjson/internal/CMakeLists.txt
deleted file mode 100644
index 129e053..0000000
--- a/rapidjson/internal/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-rapidjson_export_hdrs(
-  biginteger
-  diyfp
-  dtoa
-  ieee754
-  itoa
-  meta
-  pow10
-  regex
-  stack
-  strfunc
-  strtod
-  swap
-)