-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS #488
base: master
Are you sure you want to change the base?
MacOS #488
Conversation
… set CMP0042 policy to NEW (MACOSX_RPATH) and correct top CMakeLists file to not throw warning of unknown compiler - make CMake generate with Sublime Text 2 Ninja generator
…CMAKE_HOST_SYSTEM_PROCESSOR
…on MacOS ARM builds - fix building of zlibstatic and aesGladman targets
…amming/Nabla into MacOSX
…rated header into declaration of an explicit template specialization, get rid of AppleClang compile errors on builtin resource targets
…uilds (missing bessel special functions implementation in shipped libc++ by Xcode), update CMakeLists with clang build corrections, add missing typename keywords and fix some compile errors)
…dation of CMake generator toolset
… AppleClang. Temporary disable installation of tbb targets - TODO. Fix Nabla execution header related errors. Update CMake files. Make a SBuildInfo struct MoveInsertable and eliminate emplate_back errors
…operators to nbl::system::ISystem::SRequestType because of std::variant type-safe union defined as a member and elimiante some of compile errors
…acOS defines, update CMake files
# MacOS patches | ||
if(APPLE) | ||
set(_NBL_MACOS_PATCH_INCLUDE_ "${CMAKE_CURRENT_BINARY_DIR}/macos/include" CACHE INTERNAL "") | ||
|
||
set(_NBL_MACOS_BYTESWAP_H_ | ||
"#if defined(__APPLE__)\n\ | ||
// Mac OS X / Darwin features\n\ | ||
#include <libkern/OSByteOrder.h>\n\n\ | ||
#define bswap_16(x) OSSwapInt16(x)\n\ | ||
#define bswap_32(x) OSSwapInt32(x)\n\ | ||
#define bswap_64(x) OSSwapInt64(x)\n\ | ||
#endif // __APPLE__" | ||
) | ||
|
||
set(_NBL_MACOS_ENDIAN_H_ | ||
"#if defined(__APPLE__)\n\ | ||
#include <machine/endian.h>\n\ | ||
#endif // __APPLE__" | ||
) | ||
|
||
file(WRITE "${_NBL_MACOS_PATCH_INCLUDE_}/byteswap.h" "${_NBL_MACOS_BYTESWAP_H_}") | ||
file(WRITE "${_NBL_MACOS_PATCH_INCLUDE_}/endian.h" "${_NBL_MACOS_ENDIAN_H_}") | ||
|
||
include_directories(BEFORE SYSTEM "${_NBL_MACOS_PATCH_INCLUDE_}") | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both ARM and x86 are little-endian
we're not going to support PowerPC cause its freaking ancient
what dependency even needs this?
CMakeLists.txt
Outdated
|
||
-msse4.2 | ||
-mfpmath=sse | ||
$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:-maes> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do we need AES for?
|
||
if("${CMAKE_GENERATOR}" STREQUAL "Xcode") | ||
if(NOT "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "buildsystem=1") | ||
message("Nabla build isn't supported with new Xcode buildsystem, you must specify CMake generator toolset as '-T buildsystem=1' in order to use legacy Xcode build system") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the new Xcode buildsystem?
SBuildInfo(uint32_t _binding, core::bitflag<typename SBinding::E_CREATE_FLAGS> _createFlags, core::bitflag<IShader::E_SHADER_STAGE> _stageFlags, uint32_t _count) | ||
: binding(_binding), createFlags(_createFlags), stageFlags(_stageFlags), count(_count) {} | ||
SBuildInfo(SBuildInfo&& other) | ||
: binding(other.binding), createFlags(other.createFlags), stageFlags(other.stageFlags), count(other.count) {} | ||
|
||
SBuildInfo& operator=(const SBuildInfo& other) = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need these?
@@ -19,7 +19,7 @@ | |||
// this actually includes file depending on build type (Debug/Release) | |||
#include "BuildConfigOptions.h" | |||
|
|||
#if defined(_NBL_PLATFORM_LINUX_) || defined(_NBL_PLATFORM_ANDROID_) | |||
#if defined(_NBL_PLATFORM_LINUX_) || defined(_NBL_PLATFORM_ANDROID_) || defined(_NBL_PLATFORM_MACOS_) | |||
# define _NBL_POSIX_API_ // Android is not 100% POSIX, but it's close enough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment
@@ -5,7 +5,7 @@ | |||
#ifndef _NBL_CORE_EXECUTION_H_INCLUDED_ | |||
#define _NBL_CORE_EXECUTION_H_INCLUDED_ | |||
|
|||
#if __has_include (<execution>) | |||
#if __has_include (<execution>) and not defined(__clang__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pollend does the regular Linux Clang have execution policies?
#if defined(__clang__) | ||
#include <boost/math/special_functions/bessel.hpp> | ||
#endif //__clang__ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might be breaking stuff for @pollend , best you check for AppleClang instead
} | ||
|
||
~SRequestType() {} | ||
|
||
//! SRequestParams_READ to SRequestType because of std::variant type-safe union | ||
|
||
SRequestType(SRequestParams_READ& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_READ)); | ||
} | ||
|
||
SRequestType(const SRequestParams_READ& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_READ)); | ||
} | ||
|
||
SRequestType& operator=(SRequestParams_READ& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_READ)); | ||
return *this; | ||
} | ||
|
||
SRequestType& operator=(const SRequestParams_READ& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_READ)); | ||
return *this; | ||
} | ||
|
||
//! SRequestParams_WRITE to SRequestType because of std::variant type-safe union | ||
|
||
SRequestType(SRequestParams_WRITE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_WRITE)); | ||
} | ||
|
||
SRequestType(const SRequestParams_WRITE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_WRITE)); | ||
} | ||
|
||
SRequestType& operator=(SRequestParams_WRITE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_WRITE)); | ||
return *this; | ||
} | ||
|
||
SRequestType& operator=(const SRequestParams_WRITE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_WRITE)); | ||
return *this; | ||
} | ||
|
||
//! SRequestParams_CREATE_FILE to SRequestType because of std::variant type-safe union | ||
|
||
SRequestType(SRequestParams_CREATE_FILE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_CREATE_FILE)); | ||
} | ||
|
||
SRequestType(const SRequestParams_CREATE_FILE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_CREATE_FILE)); | ||
} | ||
|
||
SRequestType& operator=(SRequestParams_CREATE_FILE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_CREATE_FILE)); | ||
return *this; | ||
} | ||
|
||
SRequestType& operator=(const SRequestParams_CREATE_FILE& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_CREATE_FILE)); | ||
return *this; | ||
} | ||
|
||
//! SRequestParams_NOOP to SRequestType because of std::variant type-safe union | ||
|
||
SRequestType(SRequestParams_NOOP& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_NOOP)); | ||
} | ||
|
||
SRequestType(const SRequestParams_NOOP& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_NOOP)); | ||
} | ||
|
||
SRequestType& operator=(SRequestParams_NOOP& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_NOOP)); | ||
return *this; | ||
} | ||
|
||
SRequestType& operator=(const SRequestParams_NOOP& copy) | ||
{ | ||
std::memmove(this, ©, sizeof(SRequestParams_NOOP)); | ||
return *this; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh god, please no
src/nbl/CMakeLists.txt
Outdated
# Clang special math functions (libc++ shipped on MacOSes doesnt implement some of the special functions) | ||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") | ||
target_include_directories(Nabla PUBLIC "${THIRD_PARTY_SOURCE_DIR}/boost/standalone/math/include") | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't check for Clang, only AppleClang
src/nbl/builtin/builtinHeaderGen.py
Outdated
outp.write('\n\t\textern template const std::pair<const uint8_t*, size_t> get_resource<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("%s")>();' % x) | ||
outp.write('\n\t\ttemplate<> const std::pair<const uint8_t*, size_t> get_resource<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("%s")>();' % x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure this doesn't break windows build and examples now?
message(FATAL_ERROR "oneDPL submodule requires valid ONETBB_INSTALL_DIR!") | ||
endif() | ||
|
||
set(TBB_DIR ${ONETBB_INSTALL_DIR}/lib/cmake/TBB CACHE INTERNAL "" FORCE) | ||
set(ONEDPL_BACKEND tbb CACHE STRING "" FORCE) | ||
set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH ON CACHE BOOL "") | ||
set(ONE_DPL_INSTALL_OVERRIDE "${CMAKE_CURRENT_BINARY_DIR}/output" CACHE STRING "" FORCE) | ||
find_package(Threads REQUIRED) | ||
|
||
add_subdirectory(oneDPL oneDPL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you need to compile OneDPL for AppleClang to support parallel execution policies?
#if defined(__APPLE__) | ||
int createFlags = (writeAccess ? O_CREAT:0); | ||
#else | ||
int createFlags = O_LARGEFILE|(writeAccess ? O_CREAT:0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we even need O_LARGEFILE
, git blame doesn't tell me much
btw did you make DXC compile on macOS? |
a07e79f
to
ffbd843
Compare
…ubmit all commands within the file to prevent OS wide issues with chmod (which turns out doesn't work even if FILE(CHMOD <..>) is used properly, it may be a CMake bug), temporary disable NBL_UPDATE_GIT_SUBMODULE_NO_SEPARATE_SHELL usage, will bring it back in following commit
…ake and update flags.cmake
No description provided.