mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 11:41:36 +08:00
Merge branch 'master' of https://github.com/microsoft/vcpkg
This commit is contained in:
commit
9e1d40e4dc
4
ports/harfbuzz/CONTROL
Normal file
4
ports/harfbuzz/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: harfbuzz
|
||||
Version: 1.3.2
|
||||
Description: HarfBuzz OpenType text shaping engine
|
||||
Build-depends: ragel
|
52
ports/harfbuzz/portfile.cmake
Normal file
52
ports/harfbuzz/portfile.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
# Common Ambient Variables:
|
||||
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
|
||||
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
|
||||
# PORT is the current port name (zlib, etc)
|
||||
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
|
||||
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
|
||||
#
|
||||
|
||||
include(${CMAKE_TRIPLET_FILE})
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/harfbuzz-1.3.2)
|
||||
find_program(NMAKE nmake)
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.2.tar.bz2"
|
||||
FILENAME "harfbuzz-1.3.2.tar.bz2"
|
||||
SHA512 19f846ee75d8a2d94da2a2b489fa8e54a5120599f998e451187f6695aa3931b28c491bbc0837892eaaebbd1da3441effe01f5f2470454f83cfa6a7c510ebcb32
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NMAKE} -f Makefile.vc CFG=debug
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}/win32/
|
||||
LOGNAME nmake-build-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NMAKE} -f Makefile.vc CFG=release
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}/win32/
|
||||
LOGNAME nmake-build-${TARGET_TRIPLET}-release
|
||||
)
|
||||
|
||||
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" NATIVE_PACKAGES_DIR_DBG)
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NMAKE} -f Makefile.vc CFG=debug PREFIX=${NATIVE_PACKAGES_DIR_DBG} install
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}/win32/
|
||||
LOGNAME nmake-install-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR_REL)
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NMAKE} -f Makefile.vc CFG=release PREFIX=${NATIVE_PACKAGES_DIR_REL} install
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}/win32/
|
||||
LOGNAME nmake-install-${TARGET_TRIPLET}-release
|
||||
)
|
||||
|
||||
# Handle copyright
|
||||
file(COPY ${CURRENT_BUILDTREES_DIR}/src/harfbuzz-1.3.2/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/harfbuzz)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/harfbuzz/COPYING ${CURRENT_PACKAGES_DIR}/share/harfbuzz/copyright)
|
40
toolsrc/include/Stopwatch.h
Normal file
40
toolsrc/include/Stopwatch.h
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
class Stopwatch
|
||||
{
|
||||
public:
|
||||
static Stopwatch createUnstarted();
|
||||
|
||||
static Stopwatch createStarted();
|
||||
|
||||
bool isRunning() const;
|
||||
|
||||
Stopwatch& start();
|
||||
|
||||
Stopwatch& stop();
|
||||
|
||||
Stopwatch& reset();
|
||||
|
||||
template <class TimeUnit>
|
||||
TimeUnit elapsed() const
|
||||
{
|
||||
return std::chrono::duration_cast<TimeUnit>(elapsedNanos());
|
||||
}
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
private:
|
||||
Stopwatch();
|
||||
|
||||
std::chrono::nanoseconds elapsedNanos() const;
|
||||
|
||||
bool m_isRunning;
|
||||
std::chrono::nanoseconds m_elapsedNanos;
|
||||
std::chrono::steady_clock::time_point m_startTick;
|
||||
};
|
||||
}
|
@ -19,6 +19,11 @@ namespace vcpkg {namespace Strings {namespace details
|
||||
return s;
|
||||
}
|
||||
|
||||
inline double to_printf_arg(const double s)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
inline size_t to_printf_arg(const size_t s)
|
||||
{
|
||||
return s;
|
||||
|
@ -64,7 +64,7 @@ namespace vcpkg {namespace System
|
||||
return println(c, Strings::format(messageTemplate, messageArgs...).c_str());
|
||||
}
|
||||
|
||||
struct Stopwatch
|
||||
struct Stopwatch2
|
||||
{
|
||||
int64_t start_time, end_time, freq;
|
||||
|
||||
|
104
toolsrc/src/Stopwatch.cpp
Normal file
104
toolsrc/src/Stopwatch.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
#include "Stopwatch.h"
|
||||
#include "vcpkg_Checks.h"
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
Stopwatch Stopwatch::createUnstarted()
|
||||
{
|
||||
return Stopwatch();
|
||||
}
|
||||
|
||||
Stopwatch Stopwatch::createStarted()
|
||||
{
|
||||
return Stopwatch().start();
|
||||
}
|
||||
|
||||
bool Stopwatch::isRunning() const
|
||||
{
|
||||
return this->m_isRunning;
|
||||
}
|
||||
|
||||
Stopwatch& Stopwatch::start()
|
||||
{
|
||||
Checks::check_exit(!this->m_isRunning, "This stopwatch is already running.");
|
||||
this->m_isRunning = true;
|
||||
this->m_startTick = std::chrono::high_resolution_clock::now();
|
||||
return *this;
|
||||
}
|
||||
|
||||
Stopwatch& Stopwatch::stop()
|
||||
{
|
||||
auto tick = std::chrono::high_resolution_clock::now();
|
||||
Checks::check_exit(this->m_isRunning, "This stopwatch is already stopped.");
|
||||
this->m_isRunning = false;
|
||||
this->m_elapsedNanos += tick - this->m_startTick;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Stopwatch& Stopwatch::reset()
|
||||
{
|
||||
this->m_elapsedNanos = std::chrono::nanoseconds();
|
||||
this->m_isRunning = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string Stopwatch::toString() const
|
||||
{
|
||||
using std::chrono::hours;
|
||||
using std::chrono::minutes;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::microseconds;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::duration_cast;
|
||||
|
||||
auto nanos = elapsedNanos();
|
||||
auto nanos_as_double = static_cast<double>(nanos.count());
|
||||
|
||||
if (duration_cast<hours>(nanos) > hours())
|
||||
{
|
||||
auto t = nanos_as_double / duration_cast<nanoseconds>(hours(1)).count();
|
||||
return Strings::format("%.4g h", t);
|
||||
}
|
||||
|
||||
if (duration_cast<minutes>(nanos) > minutes())
|
||||
{
|
||||
auto t = nanos_as_double / duration_cast<nanoseconds>(minutes(1)).count();
|
||||
return Strings::format("%.4g min", t);
|
||||
}
|
||||
|
||||
if (duration_cast<seconds>(nanos) > seconds())
|
||||
{
|
||||
auto t = nanos_as_double / duration_cast<nanoseconds>(seconds(1)).count();
|
||||
return Strings::format("%.4g s", t);
|
||||
}
|
||||
|
||||
if (duration_cast<milliseconds>(nanos) > milliseconds())
|
||||
{
|
||||
auto t = nanos_as_double / duration_cast<nanoseconds>(milliseconds(1)).count();
|
||||
return Strings::format("%.4g ms", t);
|
||||
}
|
||||
|
||||
if (duration_cast<microseconds>(nanos) > microseconds())
|
||||
{
|
||||
auto t = nanos_as_double / duration_cast<nanoseconds>(microseconds(1)).count();
|
||||
return Strings::format("%.4g micros", t);
|
||||
}
|
||||
|
||||
return Strings::format("%.4g ns", nanos_as_double);
|
||||
}
|
||||
|
||||
Stopwatch::Stopwatch() : m_isRunning(false), m_elapsedNanos(), m_startTick()
|
||||
{
|
||||
}
|
||||
|
||||
std::chrono::nanoseconds Stopwatch::elapsedNanos() const
|
||||
{
|
||||
if (this->m_isRunning)
|
||||
{
|
||||
return std::chrono::high_resolution_clock::now() - this->m_startTick + this->m_elapsedNanos;
|
||||
}
|
||||
|
||||
return this->m_elapsedNanos;
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@ namespace vcpkg
|
||||
port_dir.generic_wstring(),
|
||||
ports_cmake_script_path.generic_wstring());
|
||||
|
||||
System::Stopwatch timer;
|
||||
System::Stopwatch2 timer;
|
||||
timer.start();
|
||||
int return_code = System::cmd_execute(command);
|
||||
timer.stop();
|
||||
|
@ -153,7 +153,7 @@ static void loadConfig()
|
||||
}
|
||||
}
|
||||
|
||||
static System::Stopwatch g_timer;
|
||||
static System::Stopwatch2 g_timer;
|
||||
|
||||
static std::string trim_path_from_command_line(const std::string& full_command_line)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include "vcpkg_System.h"
|
||||
#include <set>
|
||||
|
||||
namespace fs = std::tr2::sys;
|
||||
|
||||
@ -279,16 +280,43 @@ namespace vcpkg
|
||||
|
||||
static lint_status check_architecture(const std::string& expected_architecture, const std::vector<fs::path>& files)
|
||||
{
|
||||
// static const std::regex machine_regex = std::regex(R"###([0-9A-F]+ machine \([^)]+\))###");
|
||||
|
||||
// Parenthesis is there to avoid some other occurrences of the word "machine". Those don't match the expected regex.
|
||||
static const std::string machine_string_scan = "machine (";
|
||||
|
||||
std::vector<file_and_arch> binaries_with_invalid_architecture;
|
||||
std::set<fs::path> binaries_with_no_architecture(files.cbegin(), files.cend());
|
||||
|
||||
for (const fs::path& f : files)
|
||||
{
|
||||
const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s" | findstr machine)", DUMPBIN_EXE.native(), f.native());
|
||||
const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s")", DUMPBIN_EXE.native(), f.native());
|
||||
System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
|
||||
Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
|
||||
|
||||
if (Strings::case_insensitive_ascii_find(ec_data.output, expected_architecture) == ec_data.output.end())
|
||||
const std::string& s = ec_data.output;
|
||||
|
||||
for (size_t start, end, idx = s.find(machine_string_scan); idx != std::string::npos; idx = s.find(machine_string_scan, end))
|
||||
{
|
||||
binaries_with_invalid_architecture.push_back({f, ec_data.output});
|
||||
// Skip the space directly in front of "machine" and find the previous one. Get the index of the char after it.
|
||||
// Go no further than a newline
|
||||
start = std::max(s.find_last_of('\n', idx - 2) + 1, s.find_last_of(' ', idx - 2) + 1);
|
||||
|
||||
// Find the first close-parenthesis. Get the index of the char after it
|
||||
// Go no futher than a newline
|
||||
end = std::min(s.find_first_of('\n', idx) + 1, s.find_first_of(')', idx) + 1);
|
||||
|
||||
std::string machine_line(s.substr(start, end - start));
|
||||
|
||||
if (Strings::case_insensitive_ascii_find(machine_line, expected_architecture) != machine_line.end())
|
||||
{
|
||||
binaries_with_no_architecture.erase(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
binaries_with_invalid_architecture.push_back({f, machine_line});
|
||||
break; // If one erroneous entry is found, we can abort this file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,7 +327,20 @@ namespace vcpkg
|
||||
for (const file_and_arch& b : binaries_with_invalid_architecture)
|
||||
{
|
||||
System::println(" %s", b.file.generic_string());
|
||||
System::println("Expected %s, but was:\n %s", expected_architecture, b.actual_arch);
|
||||
System::println("Expected %s, but was: %s", expected_architecture, b.actual_arch);
|
||||
}
|
||||
System::println("");
|
||||
|
||||
return lint_status::ERROR;
|
||||
}
|
||||
|
||||
if (!binaries_with_no_architecture.empty())
|
||||
{
|
||||
System::println(System::color::warning, "Unable to detect architecture in the following files:");
|
||||
System::println("");
|
||||
for (const fs::path& b : binaries_with_no_architecture)
|
||||
{
|
||||
System::println(" %s", b.generic_string());
|
||||
}
|
||||
System::println("");
|
||||
|
||||
|
@ -90,20 +90,20 @@ namespace vcpkg {namespace System
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Stopwatch::start()
|
||||
void Stopwatch2::start()
|
||||
{
|
||||
static_assert(sizeof(start_time) == sizeof(LARGE_INTEGER), "");
|
||||
|
||||
QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&start_time));
|
||||
}
|
||||
|
||||
void Stopwatch::stop()
|
||||
void Stopwatch2::stop()
|
||||
{
|
||||
QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&end_time));
|
||||
QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(&freq));
|
||||
}
|
||||
|
||||
double Stopwatch::microseconds() const
|
||||
double Stopwatch2::microseconds() const
|
||||
{
|
||||
return (reinterpret_cast<const LARGE_INTEGER*>(&end_time)->QuadPart -
|
||||
reinterpret_cast<const LARGE_INTEGER*>(&start_time)->QuadPart) * 1000000.0 / reinterpret_cast<const LARGE_INTEGER*>(&freq)->QuadPart;
|
||||
|
@ -120,6 +120,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\Stopwatch.cpp" />
|
||||
<ClCompile Include="..\src\vcpkg_Checks.cpp" />
|
||||
<ClCompile Include="..\src\vcpkg_Files.cpp" />
|
||||
<ClCompile Include="..\src\vcpkg_Strings.cpp" />
|
||||
@ -128,6 +129,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\expected.h" />
|
||||
<ClInclude Include="..\include\opt_bool.h" />
|
||||
<ClInclude Include="..\include\Stopwatch.h" />
|
||||
<ClInclude Include="..\include\vcpkg_Checks.h" />
|
||||
<ClInclude Include="..\include\vcpkg_Files.h" />
|
||||
<ClInclude Include="..\include\vcpkg_Graphs.h" />
|
||||
|
@ -27,6 +27,9 @@
|
||||
<ClCompile Include="..\src\vcpkg_Files.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\Stopwatch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\vcpkg_Checks.h">
|
||||
@ -56,5 +59,8 @@
|
||||
<ClInclude Include="..\include\vcpkg_Sets.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\Stopwatch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user