tx00100xt / SeriousSamClassic-VK

Open source game engine version developed by Croteam for Serious Sam Classic with Vulkan support (Windows, Linux, FreeBSD, OpenBSD, macOS, Raspberry Pi OS). Based on https://github.com/sultim-t/Serious-Engine-Vk and linux port https://github.com/icculus/Serious-Engine
GNU General Public License v2.0
101 stars 12 forks source link

Not build on MacOS ! #4

Closed Heic0 closed 2 years ago

Heic0 commented 2 years ago

Build log https://pastebin.com/raw/y3PW0QzM

include <vulkan/vulkan.h>

I`m fix it add find package vulkan

if(NOT USE_SYSTEM_Vulkan) find_package(Vulkan REQUIRED) if(Vulkan_FOUND) include_directories(${Vulkan_INCLUDE_DIR}) else() message(FATAL_ERROR "Error USE_SYSTEM_Vulkan is set but neccessary developer files are missing") endif() endif()

I have else one problem is it

https://github.com/tx00100xt/SeriousSamClassic-VK/blob/95c69ce0070ba57c0ac1e0ee2b2d30c88f95a110/SamTSE/Sources/Engine/Base/Types.h#L266

tx00100xt commented 2 years ago

I`m fix it add find package vulkan

Ready: https://github.com/tx00100xt/SeriousSamClassic-VK/commit/8205ea59dac85f00a30f439bf728444b9f25911e

I have else one problem is it

Maybe: typedef uint64_t __uint64;

if (!defined __INTEL_COMPILER) && (!defined PLATFORM_MACOSX)

typedef int64_t __int64;

elif (defined PLATFORM_MACOSX)

typedef long long int __int64;

endif

or
typedef uint64_t __uint64;

if (!defined __INTEL_COMPILER) && (!defined PLATFORM_MACOSX)

typedef int64_t __int64;

elif (defined PLATFORM_MACOSX)

typedef long long __int64;

endif

If it works, I'll make a commit.

Heic0 commented 2 years ago

I have next errors https://pastebin.com/raw/htQi08P7

tx00100xt commented 2 years ago

What helped the "typedef long long int64;" or the "typedef long long int int64;"?

I have next errors https://pastebin.com/raw/htQi08P7

it's easy. We look on Linux /usr//include/vulkan/vulkan_core.h. On linux file /usr//include/vulkan/vulkan_core.h contains

define VK_NULL_HANDLE 0

We add a redefinition of VK_NULL_HANDLE in three files

if (defined PLATFORM_MACOSX)

ifdef VK_NULL_HANDLE

undef VK_NULL_HANDLE

define VK_NULL_HANDLE 0

endif

endif // PLATFORM_MACOSX

in vk_mem_alloc.h, SvkMain.h, VulkanInclude.h mac_vulkan.patch.txt

Heic0 commented 2 years ago

next errors https://pastebin.com/raw/VKkL2LSP

tx00100xt commented 2 years ago

try this

if(MACOSX) if(NOT USE_SYSTEM_Vulkan) find_package(Vulkan REQUIRED) if(Vulkan_FOUND) include_directories(${Vulkan_INCLUDE_DIR}) else() message(FATAL_ERROR "Error USE_SYSTEM_Vulkan is set but neccessary developer files are missing") endif() endif() set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif()

or in comman line --DCMAKE_CXX_FLAGS=-std=c++11

or --DCMAKE_CXX_FLAGS=-std=gnu++11

Heic0 commented 2 years ago

hmm both variants don't work build stopped on eighty eight precents there are`t errors !

I'm receive warrnings warning: typedef requires a name [-Wmissing-declarations] typedef long long __int64; ^~~~~~~~~

Heic0 commented 2 years ago

I checked type in to Clang with command

clang -dM -E -x c++ /dev/null | grep INT64_TYPE

define __INT64_TYPE__ long long int << true for macs

define __UINT64_TYPE__ long long unsigned int

tx00100xt commented 2 years ago

I see, so we need "typedef long long int __int64;"

hmm both variants don't work build stopped on eighty eight precents there are`t errors !

you can try make -j1 and see where the build fails. And see what files managed to compile. library libEngine.so are there among the compiled files?

tx00100xt commented 2 years ago

next errors https://pastebin.com/raw/VKkL2LSP

In general, I found a solution.

you don't need to use --DCMAKE_CXX_FLAGS=-std=c++11 or --DCMAKE_CXX_FLAGS=-std=gnu++11 or set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON). There is another way. Clang is capricious as I understand it. He needs to feed the filled structures. Try using the file I attached

mo_gfx_vulkan.patch.txt

Heic0 commented 2 years ago

https://pastebin.com/raw/wTr8NDPf

tx00100xt commented 2 years ago

https://pastebin.com/raw/wTr8NDPf

vk_mem_alloc.h - this is standart file from https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/blob/master/include/vk_mem_alloc.h

Try different version from https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/commits/master/include/vk_mem_alloc.h

This is not problem with this file. This is clang problem.

tx00100xt commented 2 years ago

This problem similarly https://stackoverflow.com/questions/48653124/why-is-auto-not-allowed-in-lambda-parameter I took an earlier version of the file vk_mem_alloc.h (commit a850ffbe469af2fdde53f74c28a290455d97d98e https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/commit/a850ffbe469af2fdde53f74c28a290455d97d98e), and build on linux. All ok.

A patch for Mac OS has been attached, including the previous fixes. Try it out and write the result here. mac_vulkan_3.patch.txt

tx00100xt commented 2 years ago

I have no plans to use the MacOS. And I don't see your interest in continuing this topic. I'm closing this topic