Skip to content
Open
Show file tree
Hide file tree
Changes from 15 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
15 changes: 12 additions & 3 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ if (NOT NO_ISA_EXTENSIONS)
endif()
endif()
if(WIN32)
add_compile_options(/arch:AVX2)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(-mavx2)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/arch:AVX2)
endif()
endif()
endif()

Expand All @@ -30,15 +34,20 @@ endif()

if(WIN32)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
add_compile_options(/MP)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/MP)
endif()
endif()

if(EMSCRIPTEN)
add_compile_options(-pthread -DIMGUI_IMPL_OPENGL_ES2)
endif()

if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT EMSCRIPTEN)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
# gcc on windows can't handle section count resulting during compilation of profiler/src/profiler/TracyMicroArchitecture.cpp
if(NOT WIN32 OR (WIN32 AND NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")))
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif()
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
Expand Down
3 changes: 3 additions & 0 deletions cmake/server.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ list(TRANSFORM TRACY_SERVER_SOURCES PREPEND "${TRACY_SERVER_DIR}/")
add_library(TracyServer STATIC EXCLUDE_FROM_ALL ${TRACY_COMMON_SOURCES} ${TRACY_SERVER_SOURCES})
target_include_directories(TracyServer PUBLIC ${TRACY_COMMON_DIR} ${TRACY_SERVER_DIR})
target_link_libraries(TracyServer PUBLIC TracyCapstone libzstd PPQSort::PPQSort)
if(WIN32)
target_link_libraries(TracyServer PRIVATE Ws2_32)
endif()
if(NO_STATISTICS)
target_compile_definitions(TracyServer PUBLIC TRACY_NO_STATISTICS)
endif()
4 changes: 3 additions & 1 deletion import/src/import-chrome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
#include <unordered_map>
#include <zstd.h>

#ifdef _MSC_VER
#if defined _MSC_VER || (defined _WIN32 && defined __GNUC__)
// all checked compilers contain _stat64
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This changes behavior on non-win32 platforms.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will fix it.

# define stat64 _stat64
#endif

#if defined __APPLE__
# define stat64 stat
#endif
Expand Down
5 changes: 3 additions & 2 deletions import/src/import-fuchsia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#include <variant>
#include <zstd.h>

#ifdef _MSC_VER
#define stat64 _stat64
#if defined _MSC_VER || (defined _WIN32 && defined __GNUC__)
// all checked compilers contain _stat64
# define stat64 _stat64
#endif
#if defined __APPLE__
#define stat64 stat
Expand Down
18 changes: 9 additions & 9 deletions import/src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16799,7 +16799,7 @@ class binary_writer

void write_compact_float(const number_float_t n, detail::input_format_t format)
{
#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
Expand All @@ -16819,7 +16819,7 @@ class binary_writer
: get_msgpack_float_prefix(n));
write_number(n);
}
#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
}
Expand Down Expand Up @@ -17981,7 +17981,7 @@ char* to_chars(char* first, const char* last, FloatType value)
*first++ = '-';
}

#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
Expand All @@ -17993,7 +17993,7 @@ char* to_chars(char* first, const char* last, FloatType value)
*first++ = '0';
return first;
}
#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif

Expand Down Expand Up @@ -21187,7 +21187,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
detail::negation<std::is_same<ValueType, typename string_t::value_type>>,
detail::negation<detail::is_basic_json<ValueType>>,
detail::negation<std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>>,
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))
detail::negation<std::is_same<ValueType, std::string_view>>,
#endif
#if defined(JSON_HAS_CPP_17) && JSON_HAS_STATIC_RTTI
Expand Down Expand Up @@ -22983,13 +22983,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
bool operator==(const_reference rhs) const noexcept
{
#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
const_reference lhs = *this;
JSON_IMPLEMENT_OPERATOR( ==, true, false, false)
#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
}
Expand Down Expand Up @@ -23087,12 +23087,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
{
#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
JSON_IMPLEMENT_OPERATOR( ==, true, false, false)
#ifdef __GNUC__
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
}
Expand Down
14 changes: 8 additions & 6 deletions profiler/src/stb_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch
#ifndef STBI_NO_THREAD_LOCALS
#if defined(__cplusplus) && __cplusplus >= 201103L
#define STBI_THREAD_LOCAL thread_local
#elif defined(__GNUC__) && __GNUC__ < 5
#elif defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
#define STBI_THREAD_LOCAL __thread
#elif defined(_MSC_VER)
#define STBI_THREAD_LOCAL __declspec(thread)
Expand All @@ -631,7 +631,7 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch
#endif

#ifndef STBI_THREAD_LOCAL
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(__clang__)
#define STBI_THREAD_LOCAL __thread
#endif
#endif
Expand Down Expand Up @@ -660,11 +660,13 @@ typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1];
#endif

#ifdef _MSC_VER
#define STBI_HAS_LROTL
#endif

#ifdef STBI_HAS_LROTL
#define stbi_lrot(x,y) _lrotl(x,y)
#elif defined __clang__
// 32bit version of function as stb image uses this function to rotate 32bit integers
#define stbi_lrot(x,y) __builtin_rotateleft32(x,y)
#elif defined __GNUC__
// gcc built-in is type-generic with first argument being any unsigned integer and second any signed or unsigned integer or char
#define stbi_lrot(x,y) __builtin_stdc_rotate_left(x,y)
#else
#define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (-(y) & 31)))
#endif
Expand Down
1 change: 1 addition & 0 deletions public/TracyClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#endif

#ifdef _MSC_VER
// for gcc and clang added with linker options
# pragma comment(lib, "ws2_32.lib")
# pragma comment(lib, "dbghelp.lib")
# pragma comment(lib, "advapi32.lib")
Expand Down
Loading