Fix compilation on Windows
There are still a bunch of warning that we should remove.
This commit is contained in:
parent
583e9a8f3c
commit
944b60fb75
|
@ -29,6 +29,13 @@ function(SetPIC Target)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
# Define NOMINMAX to prevent conflics between std::min/max and the min/max macros in WinDef.h
|
||||||
|
add_definitions(-DNOMINMAX)
|
||||||
|
# Remove compile error where the mock NXT creates too many sections for the old obj format.
|
||||||
|
add_compile_options("/bigobj")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(third_party)
|
add_subdirectory(third_party)
|
||||||
add_subdirectory(generator)
|
add_subdirectory(generator)
|
||||||
|
|
||||||
|
|
|
@ -210,12 +210,12 @@ class PreprocessingLoader(jinja2.BaseLoader):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
# The capture in the regex adds one element per block start or end so we divide by two
|
# The capture in the regex adds one element per block start or end so we divide by two
|
||||||
# there is also an extra line chunk corresponding to the line end, so we substract it.
|
# there is also an extra line chunk corresponding to the line end, so we substract it.
|
||||||
numends = (len(self.blockend.split(line)) - 1) / 2
|
numends = (len(self.blockend.split(line)) - 1) // 2
|
||||||
indentation_level -= numends
|
indentation_level -= numends
|
||||||
|
|
||||||
result.append(self.remove_indentation(line, indentation_level))
|
result.append(self.remove_indentation(line, indentation_level))
|
||||||
|
|
||||||
numstarts = (len(self.blockstart.split(line)) - 1) / 2
|
numstarts = (len(self.blockstart.split(line)) - 1) // 2
|
||||||
indentation_level += numstarts
|
indentation_level += numstarts
|
||||||
|
|
||||||
return '\n'.join(result)
|
return '\n'.join(result)
|
||||||
|
@ -456,6 +456,7 @@ def main():
|
||||||
[os.path.abspath(args.json[0])] +
|
[os.path.abspath(args.json[0])] +
|
||||||
[os.path.realpath(__file__)]
|
[os.path.realpath(__file__)]
|
||||||
)
|
)
|
||||||
|
dependencies = [dependency.replace('\\', '/') for dependency in dependencies]
|
||||||
sys.stdout.write(output_separator.join(dependencies))
|
sys.stdout.write(output_separator.join(dependencies))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -463,6 +464,7 @@ def main():
|
||||||
outputs = set(
|
outputs = set(
|
||||||
[os.path.abspath(args.output_dir + os.path.sep + render.output) for render in renders]
|
[os.path.abspath(args.output_dir + os.path.sep + render.output) for render in renders]
|
||||||
)
|
)
|
||||||
|
outputs = [output.replace('\\', '/') for output in outputs]
|
||||||
sys.stdout.write(output_separator.join(outputs))
|
sys.stdout.write(output_separator.join(outputs))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <nxt/nxt.h>
|
#include <nxt/nxt.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
// An abstract base class representing a proc table so that API calls can be mocked. Most API calls
|
// An abstract base class representing a proc table so that API calls can be mocked. Most API calls
|
||||||
// are directly represented by a delete virtual method but others need minimal state tracking to be
|
// are directly represented by a delete virtual method but others need minimal state tracking to be
|
||||||
// useful as mocks.
|
// useful as mocks.
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "Math.h"
|
#include "Math.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
|
@ -14,23 +14,34 @@
|
||||||
|
|
||||||
#include "Math.h"
|
#include "Math.h"
|
||||||
|
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
#include "Forward.h"
|
#include "Forward.h"
|
||||||
|
|
||||||
namespace backend {
|
namespace backend {
|
||||||
|
|
||||||
unsigned long ScanForward(unsigned long bits) {
|
uint32_t ScanForward(uint32_t bits) {
|
||||||
ASSERT(bits != 0);
|
ASSERT(bits != 0);
|
||||||
// TODO(cwallez@chromium.org): handle non-posix platforms
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
// unsigned long firstBitIndex = 0ul;
|
unsigned long firstBitIndex = 0ul;
|
||||||
// unsigned char ret = _BitScanForward(&firstBitIndex, bits);
|
unsigned char ret = _BitScanForward(&firstBitIndex, bits);
|
||||||
// ASSERT(ret != 0);
|
ASSERT(ret != 0);
|
||||||
// return firstBitIndex;
|
return firstBitIndex;
|
||||||
return static_cast<unsigned long>(__builtin_ctzl(bits));
|
#else
|
||||||
|
return static_cast<unsigned long>(__builtin_ctz(bits));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Log2(uint32_t value) {
|
uint32_t Log2(uint32_t value) {
|
||||||
ASSERT(value != 0);
|
ASSERT(value != 0);
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
unsigned long firstBitIndex = 0ul;
|
||||||
|
unsigned char ret = _BitScanReverse(&firstBitIndex, value);
|
||||||
|
ASSERT(ret != 0);
|
||||||
|
return firstBitIndex;
|
||||||
|
#else
|
||||||
return 31 - __builtin_clz(value);
|
return 31 - __builtin_clz(value);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPowerOfTwo(size_t n) {
|
bool IsPowerOfTwo(size_t n) {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
namespace backend {
|
namespace backend {
|
||||||
|
|
||||||
// The following are not valid for 0
|
// The following are not valid for 0
|
||||||
unsigned long ScanForward(unsigned long bits);
|
uint32_t ScanForward(uint32_t bits);
|
||||||
uint32_t Log2(uint32_t value);
|
uint32_t Log2(uint32_t value);
|
||||||
bool IsPowerOfTwo(size_t n);
|
bool IsPowerOfTwo(size_t n);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue