Skip to content

Commit

Permalink
make compilation work on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
qbojj committed Sep 14, 2022
1 parent f54ebbe commit c891579
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
20 changes: 10 additions & 10 deletions 4dGraphics/GameCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,23 @@ bool GameEngine::Start()
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 4 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 6 );
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
//glfwWindowHint( GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE );
glfwWindowHint( GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE );

const GLFWvidmode *mode = glfwGetVideoMode( glfwGetPrimaryMonitor() );

glfwWindowHint( GLFW_REFRESH_RATE, mode->refreshRate );
glfwWindowHint( GLFW_REFRESH_RATE, GLFW_DONT_CARE );

glfwWindowHint( GLFW_RED_BITS, mode->redBits );
glfwWindowHint( GLFW_GREEN_BITS, mode->greenBits );
glfwWindowHint( GLFW_BLUE_BITS, mode->blueBits );
glfwWindowHint( GLFW_RED_BITS, GLFW_DONT_CARE );
glfwWindowHint( GLFW_GREEN_BITS, GLFW_DONT_CARE );
glfwWindowHint( GLFW_BLUE_BITS, GLFW_DONT_CARE );

glfwWindowHint( GLFW_ALPHA_BITS, 0 );
glfwWindowHint( GLFW_ALPHA_BITS, GLFW_DONT_CARE );

glfwWindowHint( GLFW_DEPTH_BITS, 0 );
glfwWindowHint( GLFW_STENCIL_BITS, 0 );
glfwWindowHint( GLFW_DEPTH_BITS, GLFW_DONT_CARE );
glfwWindowHint( GLFW_STENCIL_BITS, GLFW_DONT_CARE );

//glfwWindowHint( GLFW_SAMPLES, 4 );
//glfwWindowHint( GLFW_SRGB_CAPABLE, GLFW_TRUE );
glfwWindowHint( GLFW_SAMPLES, GLFW_DONT_CARE );
glfwWindowHint( GLFW_SRGB_CAPABLE, GLFW_TRUE );

GLFWwindow *window = glfwCreateWindow( mode->width, mode->height, "GameEngine", NULL, NULL );
if( !window ) { TRACE( DebugLevel::FatalError, "Cannot create window\n" ); return false; }
Expand Down
6 changes: 3 additions & 3 deletions CMake/FixBundle.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ set(dirs
"@VCPKG_INSTALLED_DIR@/@VCPKG_TARGET_TRIPLET@/lib"
"@VCPKG_INSTALLED_DIR@/@VCPKG_TARGET_TRIPLET@/debug/bin"
"@VCPKG_INSTALLED_DIR@/@VCPKG_TARGET_TRIPLET@/debug/lib"
"@CMAKE_INSTALL_PREFIX@/bin/"
"@CMAKE_INSTALL_PREFIX@/lib/"
"@CMAKE_INSTALL_PREFIX@/bin"
"@CMAKE_INSTALL_PREFIX@/lib"
)

set(NewBundleDir "${CMAKE_INSTALL_PREFIX}/4dG.app/")
set(NewBundleDir "${CMAKE_INSTALL_PREFIX}/4dG.app/bin")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${NewBundleDir}")
set(NewBundlePath "${NewBundleDir}/4dGraphics@CMAKE_EXECUTABLE_SUFFIX@" )
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${bundle}" "${NewBundlePath}")
Expand Down
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
cmake_minimum_required (VERSION 3.21)
cmake_minimum_required (VERSION 3.21)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;RelWithDebInfo;MinSizeRel" CACHE STRING "Configuration types for multi-configuration buildsystems")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build configuration for single-configuration buildsystems")

set(CMAKE_MACOSX_RPATH True)
list(APPEND CMAKE_INSTALL_RPATH
"$<$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${APPLE}>>>:$ORIGIN/>." )

if( APPLE )
list(APPEND CMAKE_INSTALL_RPATH "@executable_path/../lib" )
else()
list(APPEND CMAKE_INSTALL_RPATH "${ORIGIN}/../lib" )
endif()

project( 4DG )

Expand Down

0 comments on commit c891579

Please sign in to comment.