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

Fix MacOS Build #114

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions src/engine/net/include/halley/net/session/network_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "network_session_messages.h"
#include "shared_data.h"
#include "network_session_control_messages.h"
#include "connection/network_service.h"
#include "../connection/network_service.h"

namespace Halley {
class NetworkService;
Expand Down Expand Up @@ -50,7 +50,7 @@ namespace Halley {
virtual void onHosting();
virtual void onConnected(int peerId);
virtual void onDisconnected(int peerId);

private:
NetworkService& service;
NetworkSessionType type = NetworkSessionType::Undefined;
Expand Down Expand Up @@ -79,7 +79,7 @@ namespace Halley {

void checkForOutboundStateChanges(int ownerId);
OutboundNetworkPacket makeUpdateSharedDataPacket(int ownerId);

OutboundNetworkPacket doMakeControlPacket(NetworkSessionControlMessageType msgType, OutboundNetworkPacket packet);

void onConnection(NetworkService::Acceptor& acceptor);
Expand All @@ -95,7 +95,7 @@ namespace Halley {
{
return static_cast<SessionSharedDataType&>(doGetMutableSessionSharedData());
}

const SessionSharedDataType& getSessionSharedData() const
{
return static_cast<const SessionSharedDataType&>(doGetSessionSharedData());
Expand All @@ -121,7 +121,7 @@ namespace Halley {
{
return std::make_unique<SessionSharedDataType>();
}

std::unique_ptr<SharedData> makePeerSharedData() override final
{
return std::make_unique<PeerSharedDataType>();
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/metal/src/metal_painter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using namespace Halley;

MetalPainter::MetalPainter(MetalVideo& video, Resources& resources)
: Painter(resources)
: Painter(video, resources)
, video(video)
, indexBuffer(nil)
{}
Expand Down Expand Up @@ -43,7 +43,8 @@
[encoder setRenderPipelineState:pipelineState];

// Metal requires the global material to be bound for each material pass, as it has no 'global' state.
static_cast<MetalMaterialConstantBuffer&>(halleyGlobalMaterial->getDataBlocks().front().getConstantBuffer()).bindVertex(encoder, 0);
// static_cast<MetalMaterialConstantBuffer&>(halleyGlobalMaterial->getDataBlocks().front().getConstantBuffer()).bindVertex(encoder, 0);
static_cast<MetalMaterialConstantBuffer&>(getConstantBuffer(halleyGlobalMaterial->getDataBlocks().front())).bindVertex(encoder, 0);

// Bind textures
int texIndex = 0;
Expand Down Expand Up @@ -127,7 +128,7 @@
void MetalPainter::setMaterialData(const Material& material) {
for (auto& dataBlock : material.getDataBlocks()) {
if (dataBlock.getType() != MaterialDataBlockType::SharedExternal) {
static_cast<MetalMaterialConstantBuffer&>(dataBlock.getConstantBuffer()).bindFragment(encoder, 0);
static_cast<MetalMaterialConstantBuffer&>(getConstantBuffer(dataBlock)).bindFragment(encoder, 0);
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/tools/editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set (editor_sources
"src/assets/graph/graph_editor.cpp"
"src/assets/graph/render_graph_editor.cpp"
"src/assets/graph/ui_graph_node.cpp"

"src/project/core_api_wrapper.cpp"

"src/scene/choose_window.cpp"
Expand Down Expand Up @@ -115,7 +115,7 @@ set (editor_headers
"src/scene/gizmos/scripting/scripting_gizmo_toolbar.h"
"src/scene/gizmos/scripting/scripting_gizmo.h"
"src/scene/gizmos/scripting/scripting_node_editor.h"

"src/ui/console_window.h"
"src/ui/ecs_window.h"
"src/ui/editor_settings_window.h"
Expand Down Expand Up @@ -143,8 +143,10 @@ set (editor_gen_definitions
)


if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND USE_METAL EQUAL 1)
set(EXTRA_LIBS bz2 z halley-metal)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(EXTRA_LIBS bz2 z)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(EXTRA_LIBS pthread)
endif()
Expand All @@ -153,7 +155,7 @@ include_directories(${FREETYPE_INCLUDE_DIR} "../tools/include")

halleyProjectCodegen(halley-editor "${editor_sources}" "${editor_headers}" "${editor_resources}" "${editor_gen_definitions}" ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin)
add_dependencies(halley-editor halley-cmd halley-core halley-net halley-sdl halley-opengl)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND USE_METAL EQUAL 1)
add_dependencies(halley-editor halley-metal)
endif()

Expand Down
8 changes: 4 additions & 4 deletions src/tools/editor/src/halley_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ int HalleyEditor::initPlugins(IPluginRegistry &registry)

#ifdef _WIN32
initDX11Plugin(registry);
#elif __APPLE__
#elif defined(__APPLE__) && defined(USE_METAL)
initMetalPlugin(registry);
#else
initOpenGLPlugin(registry);
#endif

return HalleyAPIFlags::Video | HalleyAPIFlags::Audio | HalleyAPIFlags::Input | HalleyAPIFlags::Network;
}

Expand Down Expand Up @@ -138,7 +138,7 @@ std::unique_ptr<Project> HalleyEditor::loadProject(Path path)
project->loadGameResources(getAPI());

preferences->addRecent(path.string());

return project;
}

Expand All @@ -153,7 +153,7 @@ std::unique_ptr<Project> HalleyEditor::createProject(Path path)
}

preferences->addRecent(path.string());

return project;
}

Expand Down
6 changes: 4 additions & 2 deletions src/tools/launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ set (launcher_gen_definitions
)


if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND USE_METAL EQUAL 1)
set(EXTRA_LIBS bz2 z halley-metal)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(EXTRA_LIBS bz2 z)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(EXTRA_LIBS pthread)
endif()
Expand All @@ -45,7 +47,7 @@ include_directories(${FREETYPE_INCLUDE_DIR} "../tools/include")

halleyProjectCodegen(halley-launcher "${launcher_sources}" "${launcher_headers}" "" "${launcher_gen_definitions}" ${CMAKE_CURRENT_SOURCE_DIR}/bin)
add_dependencies(halley-launcher halley-cmd halley-core halley-net halley-sdl halley-opengl)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND USE_METAL EQUAL 1)
add_dependencies(halley-launcher halley-metal)
endif()

Expand Down