Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ports/rapidjson/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Source: rapidjson
Version: 2020-02-08
Port-Version: 1
Description: A fast JSON parser/generator for C++ with both SAX/DOM style API <http://rapidjson.org/>
Homepage: http://rapidjson.org/
8 changes: 3 additions & 5 deletions ports/rapidjson/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#header-only library
include(vcpkg_common_functions)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Tencent/rapidjson
Expand All @@ -21,13 +19,13 @@ vcpkg_configure_cmake(
)
vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/RapidJSON)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/share/doc)

file(READ "${CURRENT_PACKAGES_DIR}/share/rapidjson/RapidJSONConfig.cmake" _contents)
file(READ "${CURRENT_PACKAGES_DIR}/share/RapidJSON/RapidJSONConfig.cmake" _contents)
string(REPLACE "\${RapidJSON_SOURCE_DIR}" "\${RapidJSON_CMAKE_DIR}/../.." _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/rapidjson/RapidJSONConfig.cmake" "${_contents}\nset(RAPIDJSON_INCLUDE_DIRS \"\${RapidJSON_INCLUDE_DIRS}\")\n")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/RapidJSON/RapidJSONConfig.cmake" "${_contents}\nset(RAPIDJSON_INCLUDE_DIRS \"\${RapidJSON_INCLUDE_DIRS}\")\n")

file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
Expand Down
54 changes: 54 additions & 0 deletions toolsrc/src/vcpkg/postbuildlint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,59 @@ namespace vcpkg::PostBuildLint
return LintStatus::SUCCESS;
}

static LintStatus check_for_cmake_files(const Files::Filesystem& fs, const fs::path& share_dir)
{
Comment thread
JackBoosY marked this conversation as resolved.
static StringLiteral UPPER_CONFIG = "Config.cmake";
static StringLiteral LOWER_CONFIG = "-config.cmake";
std::vector<fs::path> shareFolders = fs.get_files_non_recursive(share_dir);
for (const auto folder : shareFolders)
{
if (!fs.is_directory(folder))
{
continue;
}

const auto files = fs.get_files_non_recursive(folder);
fs::path cmake_file;
std::string config_prefix;
for (const auto file_path : files)
{
auto filename = fs::u8string(file_path.filename());
if (Strings::ends_with(filename, UPPER_CONFIG))
{
config_prefix = filename.substr(0, filename.size() - UPPER_CONFIG.size());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check for "CoNFiG.cmAkE" (And possibly fail the results if any such things are present?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, generally, the file names generated by cmake are fixed.

cmake_file = file_path;
break;
}
else if (Strings::ends_with(filename, LOWER_CONFIG))
{
config_prefix = filename.substr(0, filename.size() - LOWER_CONFIG.size());
cmake_file = file_path;
break;
}
}

auto containing_directory = fs::u8string(cmake_file.parent_path().filename());
if (!cmake_file.empty() && config_prefix != containing_directory)
{
System::printf(System::Color::warning,
"The following cmake file %s was found in %s: the config prefix %s did not match the "
"containing directory's name %s.\n",
cmake_file.filename().string().c_str(),
cmake_file.parent_path().string().c_str(),
Comment on lines +457 to +458
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probably need to use some form of u8something rather than string()

config_prefix.c_str(),
cmake_file.parent_path().filename().string().c_str());
System::print2(System::Color::warning, "Please add the following code to portfile.cmake:\n");
System::printf(System::Color::warning,
" vcpkg_fixup_cmake_targets(... TARGET_PATH share/%s).\n",
config_prefix);
return LintStatus::ERROR_DETECTED;
}
}

return LintStatus::SUCCESS;
}

static LintStatus check_uwp_bit_of_dlls(const std::string& expected_system_name,
const std::vector<fs::path>& dlls,
const fs::path dumpbin_exe)
Expand Down Expand Up @@ -860,6 +913,7 @@ namespace vcpkg::PostBuildLint
error_count += check_for_copyright_file(fs, spec, paths);
error_count += check_for_exes(fs, package_dir);
error_count += check_for_exes(fs, package_dir / "debug");
error_count += check_for_cmake_files(fs, package_dir / "share");

const fs::path debug_lib_dir = package_dir / "debug" / "lib";
const fs::path release_lib_dir = package_dir / "lib";
Expand Down