Mac OS

Discussion related to the LuxCore functionality, implementations and API.
Post Reply
jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe »

I dependencies.cmake there is:

Code: Select all

# OpenGL
find_package(OpenGL)

if (OPENGL_FOUND)
	include_directories(BEFORE SYSTEM ${OPENGL_INCLUDE_PATH})
endif()
This must succed. If in doubt check the module inside cmake.app, see what it tries to search there.
I am not aware how far cmake adapted to eventually 10.13 changes.
jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe »

patrickwalker wrote: Mon Jan 29, 2018 5:35 pm
jensverwiebe wrote: Mon Jan 29, 2018 5:26 pm Oh, none ?
Thats the root problem then.
Try find out how cmake can find ogl

Jens
Should be easy enough, which is probably why it will take me forever to get done. But here goes...

Code: Select all

set(OPENGL_SEARCH_PATH        "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/opengl.framework")
set(OPENGL_INCLUDE_PATH       "${OPENGL_SEARCH_PATH}")
Added those to Config_OSX.cmake. Not showing up in the cmake screen as OpenCL is. Was hoping they would.
Nope, those are cmake included modules, the don't accept root or search_path.

You can still hardcode, but automatic find is preferred.

The lookup goes like follows:

Code: Select all

elseif (APPLE)

  # The OpenGL.framework provides both gl and glu
  find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X")
  find_library(OPENGL_glu_LIBRARY OpenGL DOC
    "GLU library for OS X (usually same as OpenGL library)")
  find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X")
  list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
Jens
patrickwalker
Posts: 28
Joined: Sun Jan 28, 2018 2:10 pm
Location: Canada

Re: Mac OS

Post by patrickwalker »

jensverwiebe wrote: Mon Jan 29, 2018 5:50 pm You can still hardcode, but automatic find is preferred.
Indeed.

Inside of Config_OSX, I've added:

Code: Select all

find_path(OPENGL_SEARCH_PATH 	OpenGL.h 	PATHS "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/opengl.framework" )
find_path(OPENGL_INCLUDE_PATH 	OpenGL.h 	PATHS "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/opengl.framework" )
A bit superfluous but the keys are showing up in CMAKE with the appropriate and correct paths to the header files, particularly OpenGL.h, gl.h, and even CGLContext.h. Not sure if the symlink should really affect anything, but I tried both the symlinked version and unsymlinkedb versions of the header file directory inside Xcode.app. No change.

The error involving CGLGetContext() remains. It only goes away if the preprocessor #include is ... well ... included.

I only know enough about cmake to get me into trouble. ;)
jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe »

hihi :P

I rerun on 10.11 again just for the record and every piece is found ootb.
Could it be headers changed in ogl framework ?
Did you checked the cmd-line sdk and xcode sdk are same ? Typically cmd-line
stuff are only shim's to the xcode sdk.
Did you found any hints in the cmake log ? There should be mentioned which
find module fails and why.

Its again the yearly new macOS fu.. i know from my maintainer times. SIGH

I think, if you get a bit more comfortable with cmake as time goes by, you will
get this sorted out. Check failing components etc.

For me 10.13 is way too immature, so i will stay with 10.11 for my music stuff
that only runs on macOS. 10.13 breaks most of this anyway.

Am glad again i switched to Linux in mid 2015 8-)

I hope my hints brought you far enough to get rid of the last bits. From here i must pass
as i 'am a bit rare with time atm..

If you need still a special help, pm me. Will answer then asap.

Jens
patrickwalker
Posts: 28
Joined: Sun Jan 28, 2018 2:10 pm
Location: Canada

Re: Mac OS

Post by patrickwalker »

I doubt the headers really changed all that much. The paths are clearly set, yet looks more and more like the header files are not even loaded for device.cpp, leading to the CGLGetContext() error.

The only guaranteed file to be included in device.cpp doesn't include headers as well. Also, if it was a pathing error, wouldn't the original error have been something along the lines of "file not found?"

I cannot see getting around placing an #include <OpenGL/OpenGL.h> The only thing that I can see going on is that a header file that used to reference OpenGL no longer does. I did a quick look through the other header files that are in device.cpp and none seem to reference OpenGL.

That's why my suggestion is to add the following to device.cpp:

Code: Select all

#if defined(__APPLE__)
    #include <OpenGL/OpenGL.h>
#endif
I know it doesn't do versioning, but if the file path determination in cmake functions, then it shouldn't matter which version of macOS being compiled on.
Last edited by patrickwalker on Mon Jan 29, 2018 10:25 pm, edited 2 times in total.
jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe »

Should not harm.

Jens
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Mac OS

Post by Dade »

patrickwalker wrote: Mon Jan 29, 2018 10:16 pm That's why my suggestion is to add the following to device.cpp:

Code: Select all

#if defined(__APPLE__)
    #include <OpenGL/OpenGL.h>
#endif
Done.
Support LuxCoreRender project with salts and bounties
patrickwalker
Posts: 28
Joined: Sun Jan 28, 2018 2:10 pm
Location: Canada

Re: Mac OS

Post by patrickwalker »

I think it probably would a good idea to but a little inline comment for future clarity, such as:

Code: Select all

#include <OpenGL/OpenGL.h> // Header file required for CGLGetCurrentContext();
As for the macOS repository, are there any files in there that are long required?
jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe »

No comment needed. If one includes a file he does for a reason and the headername is almost hinting enough ;)
I bet Dade may throw the whole interop anyway any time soon.

An now for something completely different :o
Did you enlarged "covered" mac systems in platformspecific cmake ?
I mean :

Code: Select all

	########## OS and hardware detection ###########

	execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version

	if(${MAC_SYS} MATCHES 15)
		set(OSX_SYSTEM 10.11)
		cmake_minimum_required(VERSION 3.0.0) # throw an error here, older cmake cannot handle 2 digit subversion !
		set(QT_BINARY_DIR /usr/local/bin) # workaround for the locked /usr/bin install Qt ti /usr/local !
	elseif(${MAC_SYS} MATCHES 14)
		set(OSX_SYSTEM 10.10)
		cmake_minimum_required(VERSION 3.0.0) # throw an error here, older cmake cannot handle 2 digit subversion !
	elseif(${MAC_SYS} MATCHES 13)
		set(OSX_SYSTEM 10.9)
	elseif(${MAC_SYS} MATCHES 12)
		set(OSX_SYSTEM 10.8)
	elseif(${MAC_SYS} MATCHES 11)
		set(OSX_SYSTEM 10.7)
	elseif(${MAC_SYS} MATCHES 10)
		set(OSX_SYSTEM 10.6)
	else()
		set(OSX_SYSTEM unsupported)
	endif()
Add darwin 16 and 17 on top here too pls + eventually quirks for that sys. Whatever this may be.

Jens
patrickwalker
Posts: 28
Joined: Sun Jan 28, 2018 2:10 pm
Location: Canada

Re: Mac OS

Post by patrickwalker »

Code: Select all

########## OS and hardware detection ###########

	execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version

	if(${MAC_SYS} MATCHES 17)
		set(OSX_SYSTEM 10.13)
	elseif(${MAC_SYS} MATCHES 16)
		set(OSX_SYSTEM 10.12)		
	elseif(${MAC_SYS} MATCHES 15)
		set(OSX_SYSTEM 10.11)
		cmake_minimum_required(VERSION 3.0.0) # throw an error here, older cmake cannot handle 2 digit subversion !
		set(QT_BINARY_DIR /usr/local/bin) # workaround for the locked /usr/bin install Qt ti /usr/local !
	elseif(${MAC_SYS} MATCHES 14)
		set(OSX_SYSTEM 10.10)
		cmake_minimum_required(VERSION 3.0.0) # throw an error here, older cmake cannot handle 2 digit subversion !
	elseif(${MAC_SYS} MATCHES 13)
		set(OSX_SYSTEM 10.9)
	elseif(${MAC_SYS} MATCHES 12)
		set(OSX_SYSTEM 10.8)
	elseif(${MAC_SYS} MATCHES 11)
		set(OSX_SYSTEM 10.7)
	elseif(${MAC_SYS} MATCHES 10)
		set(OSX_SYSTEM 10.6)
	else()
		set(OSX_SYSTEM unsupported)
	endif()

MESSAGE(STATUS "macOS version detected: ${OSX_SYSTEM}")
That has been added in. Confirms OS detected properly.
Post Reply