mirror of
https://github.com/harfang3d/harfang3d.git
synced 2024-06-19 13:22:32 +00:00
-fixing macos build
This commit is contained in:
parent
1c891200b5
commit
3c6c66df0c
2
extern/CMakeLists.txt
vendored
2
extern/CMakeLists.txt
vendored
|
@ -35,7 +35,7 @@ if(HG_USE_GLFW)
|
|||
set(HG_GLFW_BACKEND "WAYLAND")
|
||||
elseif (WIN32)
|
||||
set(HG_GLFW_BACKEND "WIN32")
|
||||
elseif (HG_APPLE)
|
||||
elseif (APPLE)
|
||||
set(HG_GLFW_BACKEND "COCOA")
|
||||
elseif (UNIX)
|
||||
set(HG_GLFW_BACKEND "X11")
|
||||
|
|
33
extern/bgfx/bgfx.cmake
vendored
33
extern/bgfx/bgfx.cmake
vendored
|
@ -1,5 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
if( APPLE AND NOT XCODE )
|
||||
set( CMAKE_CXX_FLAGS "-ObjC++" )
|
||||
endif()
|
||||
|
||||
set( BGFX_SRCS
|
||||
bgfx/src/bgfx.cpp bgfx/src/renderer_gl.cpp
|
||||
bgfx/src/debug_renderdoc.cpp bgfx/src/renderer_gnm.cpp
|
||||
|
@ -15,6 +19,15 @@ set( BGFX_SRCS
|
|||
bgfx/src/glcontext_html5.cpp bgfx/src/renderer_agc.cpp
|
||||
)
|
||||
|
||||
if( APPLE )
|
||||
set( BGFX_SRCS
|
||||
${BGFX_SRCS}
|
||||
bgfx/src/glcontext_eagl.mm
|
||||
bgfx/src/glcontext_nsgl.mm
|
||||
bgfx/src/renderer_mtl.mm
|
||||
)
|
||||
endif()
|
||||
|
||||
set( BGFX_HDRS
|
||||
bgfx/src/bgfx_p.h bgfx/src/glimports.h
|
||||
bgfx/src/charset.h bgfx/src/nvapi.h
|
||||
|
@ -107,6 +120,26 @@ if( UNIX AND NOT APPLE AND NOT EMSCRIPTEN )
|
|||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if( ${CMAKE_SYSTEM_NAME} MATCHES iOS|tvOS )
|
||||
target_link_libraries (bgfx PUBLIC
|
||||
"-framework OpenGLES -framework Metal -framework UIKit -framework CoreGraphics -framework QuartzCore -framework IOKit -framework CoreFoundation")
|
||||
elseif( APPLE )
|
||||
find_library( COCOA_LIBRARY Cocoa )
|
||||
find_library( METAL_LIBRARY Metal )
|
||||
find_library( QUARTZCORE_LIBRARY QuartzCore )
|
||||
find_library( IOKIT_LIBRARY IOKit )
|
||||
find_library( COREFOUNDATION_LIBRARY CoreFoundation )
|
||||
mark_as_advanced( COCOA_LIBRARY )
|
||||
mark_as_advanced( METAL_LIBRARY )
|
||||
mark_as_advanced( QUARTZCORE_LIBRARY )
|
||||
mark_as_advanced( IOKIT_LIBRARY )
|
||||
mark_as_advanced( COREFOUNDATION_LIBRARY )
|
||||
target_link_libraries( bgfx PUBLIC ${COCOA_LIBRARY} ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY} ${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} )
|
||||
target_link_libraries (bgfx PUBLIC
|
||||
"-framework OpenGL")
|
||||
endif()
|
||||
|
||||
if( NOT ${OPENGL_VERSION} STREQUAL "" )
|
||||
target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_RENDERER_OPENGL=${OPENGL_VERSION})
|
||||
message(STATUS "OpenGL version: ${OPENGL_VERSION}")
|
||||
|
|
2
extern/bgfx/bx.cmake
vendored
2
extern/bgfx/bx.cmake
vendored
|
@ -73,6 +73,8 @@ target_compile_definitions( bx
|
|||
PUBLIC
|
||||
$<$<CONFIG:Debug>:BX_CONFIG_DEBUG=1>
|
||||
$<$<CONFIG:Release>:BX_CONFIG_DEBUG=0>
|
||||
$<$<CONFIG:RelWithDebInfo>:BX_CONFIG_DEBUG=0>
|
||||
$<$<CONFIG:MinSizeRel>:BX_CONFIG_DEBUG=0>
|
||||
)
|
||||
|
||||
if( UNIX AND NOT APPLE )
|
||||
|
|
|
@ -40,6 +40,10 @@ if(WIN32)
|
|||
elseif(APPLE)
|
||||
list(APPEND SRCS
|
||||
osx/platform.cpp
|
||||
posix/crash_dump.cpp
|
||||
posix/process.cpp
|
||||
posix/shared_library.cpp
|
||||
posix/thread.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND SRCS
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
#include "osx_input_system/osx_input_system.h"
|
||||
#include "osx_input_system/osx_input_keyboard.h"
|
||||
#include "osx_input_system/osx_input_mouse.h"
|
||||
#include "window_system/window_system.h"
|
||||
// #include "window_system/window_system.h"
|
||||
#include "window_system.h"
|
||||
#include "cstl/log.h"
|
||||
|
||||
namespace gs {
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "input_system/input_system.h"
|
||||
#include "input_system/input_mouse.h"
|
||||
#include "input_system/input_keyboard.h"
|
||||
#include "../input_system.h"
|
||||
|
||||
namespace gs {
|
||||
namespace input {
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
// HARFANG(R) Copyright (C) 2021 Emmanuel Julien, NWNC HARFANG. Released under GPL/LGPL/Commercial Licence, see licence.txt for details.
|
||||
|
||||
#include "platform/osx/osx_input_system.h"
|
||||
#include "platform/platform.h"
|
||||
#include <string>
|
||||
|
||||
namespace hg {
|
||||
|
||||
bool InitPlatform() { return true; }
|
||||
|
||||
bool OpenFileDialog(const std::string &title, const std::string &filter, std::string &OUTPUT, const std::string &initial_dir) { return false; }
|
||||
bool SaveFileDialog(const std::string &title, const std::string &filter, std::string &OUTPUT, const std::string &initial_dir) { return false; }
|
||||
bool OpenFolderDialog(const std::string &title, std::string &OUTPUT, const std::string &initial_dir) { return false; }
|
||||
bool OpenFolderDialog(const std::string &title, std::string &output, const std::string &initial_dir) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OpenFileDialog(const std::string &title, const std::vector<hg::FileFilter> &filters, std::string &output, const std::string &initial_dir) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SaveFileDialog(const std::string &title, const std::vector<hg::FileFilter> &filters, std::string &output, const std::string &initial_dir) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DebugBreak() { /* STUB */ }
|
||||
|
||||
|
|
|
@ -19,7 +19,11 @@ add_library(hg_lua SHARED
|
|||
target_include_directories(hg_lua PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../extern/lua/src)
|
||||
target_link_libraries(hg_lua engine foundation platform)
|
||||
set_target_properties(hg_lua PROPERTIES OUTPUT_NAME "harfang" PREFIX "" DEBUG_POSTFIX "")
|
||||
if(APPLE)
|
||||
set_target_properties(hg_lua PROPERTIES SUFFIX ".so")
|
||||
endif()
|
||||
set_target_properties(hg_lua PROPERTIES FOLDER "harfang/languages")
|
||||
|
||||
add_dependencies(hg_lua lua)
|
||||
|
||||
if(WIN32)
|
||||
|
|
|
@ -22,6 +22,9 @@ if(WIN32)
|
|||
set_target_properties(hg_python PROPERTIES COMPILE_FLAGS /bigobj)
|
||||
else()
|
||||
set_target_properties(hg_python PROPERTIES OUTPUT_NAME harfang PREFIX "")
|
||||
if(APPLE)
|
||||
set_target_properties(hg_python PROPERTIES SUFFIX ".so")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Python libs: " ${Python3_LIBRARIES})
|
||||
|
|
|
@ -962,7 +962,7 @@ void Texture(std::map<std::string, Hash> &hashes, std::string path) {
|
|||
}
|
||||
|
||||
//
|
||||
if (api == "DX12" || api == "DX11" || api == "GL" || api == "GLES" || api == "VK") {
|
||||
if (api == "DX12" || api == "DX11" || api == "GL" || api == "GLES" || api == "VK" || api == "MTL" ) {
|
||||
const auto src = FullInputPath(in_path);
|
||||
|
||||
if (type == "Copy") {
|
||||
|
@ -1164,6 +1164,8 @@ static void BuildComputeShader(std::map<std::string, Hash> &hashes, const std::s
|
|||
// no profile => essl
|
||||
} else if (api == "VK") {
|
||||
cs_profile = "spirv";
|
||||
} else if (api == "MTL") {
|
||||
cs_profile = "metal";
|
||||
} else {
|
||||
const json json_err = {{"type", "UnsupportedComputeAPI"}, {"api", api}};
|
||||
log_error(json_err);
|
||||
|
@ -1231,6 +1233,8 @@ static void BuildShader(std::map<std::string, Hash> &hashes, const std::string &
|
|||
// no profile => essl
|
||||
} else if (api == "VK") {
|
||||
vs_profile = fs_profile = "spirv";
|
||||
} else if (api == "MTL") {
|
||||
vs_profile = fs_profile = "metal";
|
||||
} else {
|
||||
const json json_err = {{"type", "UnsupportedShaderAPI"}, {"api", api}};
|
||||
log_error(json_err);
|
||||
|
|
Loading…
Reference in New Issue
Block a user