Skip to content
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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

MacOS #488

wants to merge 15 commits into from

Conversation

AnastaZIuk
Copy link
Member

No description provided.

Arkadiusz Lachowicz and others added 12 commits April 14, 2023 18:57
… 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
…on MacOS ARM builds - fix building of zlibstatic and aesGladman targets
…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)
… 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
@AnastaZIuk AnastaZIuk changed the base branch from master to newBuiltinResources April 23, 2023 17:04
Comment on lines +248 to +272
# 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()

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?


-msse4.2
-mfpmath=sse
$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:-maes>

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")

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?

Comment on lines +177 to +182
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;

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

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__)

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?

Comment on lines +13 to +16
#if defined(__clang__)
#include <boost/math/special_functions/bessel.hpp>
#endif //__clang__

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

Comment on lines +270 to +373
}

~SRequestType() {}

//! SRequestParams_READ to SRequestType because of std::variant type-safe union

SRequestType(SRequestParams_READ& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_READ));
}

SRequestType(const SRequestParams_READ& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_READ));
}

SRequestType& operator=(SRequestParams_READ& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_READ));
return *this;
}

SRequestType& operator=(const SRequestParams_READ& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_READ));
return *this;
}

//! SRequestParams_WRITE to SRequestType because of std::variant type-safe union

SRequestType(SRequestParams_WRITE& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_WRITE));
}

SRequestType(const SRequestParams_WRITE& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_WRITE));
}

SRequestType& operator=(SRequestParams_WRITE& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_WRITE));
return *this;
}

SRequestType& operator=(const SRequestParams_WRITE& copy)
{
std::memmove(this, &copy, 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, &copy, sizeof(SRequestParams_CREATE_FILE));
}

SRequestType(const SRequestParams_CREATE_FILE& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_CREATE_FILE));
}

SRequestType& operator=(SRequestParams_CREATE_FILE& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_CREATE_FILE));
return *this;
}

SRequestType& operator=(const SRequestParams_CREATE_FILE& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_CREATE_FILE));
return *this;
}

//! SRequestParams_NOOP to SRequestType because of std::variant type-safe union

SRequestType(SRequestParams_NOOP& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_NOOP));
}

SRequestType(const SRequestParams_NOOP& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_NOOP));
}

SRequestType& operator=(SRequestParams_NOOP& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_NOOP));
return *this;
}

SRequestType& operator=(const SRequestParams_NOOP& copy)
{
std::memmove(this, &copy, sizeof(SRequestParams_NOOP));
return *this;
}

Choose a reason for hiding this comment

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

oh god, please no

Comment on lines +558 to +561
# 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()

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

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)

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?

Comment on lines +19 to +29
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)

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);

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

@devshgraphicsprogramming
Copy link
Member

btw did you make DXC compile on macOS?

Base automatically changed from newBuiltinResources to master May 27, 2023 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants