Mac OS

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

Re: Mac OS

Post by jensverwiebe » Mon Jan 29, 2018 1:58 pm

Nono, forget embree 2.8 ( custom ) and get embree-2.17.1

Then place libs in your ${OSX_DEPENDENCY_ROOT}/lib/embree2 and headers in ${OSX_DEPENDENCY_ROOT}/include/embree2
For distribution i recommend to change the id's and rpath to loader_path.
Change to SET(EMBREE_LIBRARY ${OSX_DEPENDENCY_ROOT}/lib/embree2/libembree.2.dylib), you will see embree comes with
symlinks libembree.dylib -> libembree.2.dylib -> libembree.2.8.0.dylib, so thats more universal but major version agnostic.

Preferred way:
Another way could be not to hardcode but use find_embree module, Dade just fixed it to lookup embree_root first.
Aka: SET(EMBREE_SEARCH_PATH "${OSX_DEPENDENCY_ROOT}") and comment out hardcoded pathes.
This should also fix you header not found problem.

Jens

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

Re: Mac OS

Post by patrickwalker » Mon Jan 29, 2018 2:35 pm

So, going the preferred route, the macOS dependency archive would have to include the embree2 library and header files for 2.17.2.

So, I commented out the EMBREE entries and added in the EMBREE_SEARCH_PATH.

The CGLGetCurrentContext() error remains. I guess I just have to somehow find where/which header file the prototype is defined in and place that include at the top of device.cpp.

------

Xcode command line tools adds in a bunch of header files, and it's needed to install MacPorts, and MacPorts is needed to (easily) install TBB.

I added this:
#include "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/CGLCurrent.h"
to to the top of devices.cpp and the error disappeared. These headers were the first to show up on my HDD search. Bit of a kludge, but it seems to have worked.

The headers are also found inside Xcode at "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers", so I guess that could be used too.

Got through the compilation stage, but linking seems to be taking longer than expected. I can't tell from the progress bar if it stalled or not.
Last edited by patrickwalker on Mon Jan 29, 2018 2:56 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 » Mon Jan 29, 2018 2:39 pm

patrickwalker wrote:
Mon Jan 29, 2018 2:35 pm
So, going the preferred route, the macOS dependency archive would have to include the embree2 library and header files for 2.17.2.

So, I commented out the EMBREE entries and added in the EMBREE_SEARCH_PATH.

The CGLGetCurrentContext() error remains. I guess I just have to somehow find where/which header file the prototype is defined in and place that include at the top of device.cpp.
Looks like you did not properly commented out or it still resides in the cmake cache.
Can you post the block ?

Jens

jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe » Mon Jan 29, 2018 2:55 pm

Yes, linking can take a while cause i enabled LTO.

Jens

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

Re: Mac OS

Post by patrickwalker » Mon Jan 29, 2018 2:59 pm

Code: Select all

###########################################################################
#
# Configuration ( Jens Verwiebe )
#
###########################################################################

MESSAGE(STATUS "Using OSX Configuration settings")

# Allow for the location of OSX_DEPENDENCY_ROOT to be set from the command line
IF( NOT OSX_DEPENDENCY_ROOT )
  set(OSX_DEPENDENCY_ROOT ${CMAKE_SOURCE_DIR}) # can be macos or usr/local for example
#  set(OSX_DEPENDENCY_ROOT ${CMAKE_SOURCE_DIR}/../macos) # can be macos or usr/local for example
ENDIF()

MESSAGE(STATUS "OSX_DEPENDENCY_ROOT : " ${OSX_DEPENDENCY_ROOT})
set(OSX_SEARCH_PATH     ${OSX_DEPENDENCY_ROOT})

set(LUXCORE_DISABLE_EMBREE_BVH_BUILDER ON)
MESSAGE(STATUS "Disabling Embree BVH builder - no custom Embree used")

# Libs present in system ( /usr )
SET(SYS_LIBRARIES z )

# Libs that have find_package modules
set(OPENIMAGEIO_ROOT_DIR "${OSX_SEARCH_PATH}")

set(BOOST_SEARCH_PATH         "${OSX_SEARCH_PATH}")
set(BOOST_LIBRARYDIR          "${BOOST_SEARCH_PATH}/lib")

set(OPENCL_SEARCH_PATH        "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/opencl.framework")
set(OPENCL_INCLUDE_PATH       "${OPENCL_SEARCH_PATH}")
#set(OPENCL_LIBRARYDIR         "${OPENCL_SEARCH_PATH}")


#
# Changed for macOS High Sierra
#

set(EMBREE_SEARCH_PATH 				"{OSX_DEPENDENCY_ROOT}")

set(GLEW_SEARCH_PATH          "${OSX_SEARCH_PATH}")
find_path(GLEW_INCLUDE_DIR glew.h PATHS ${OSX_SEARCH_PATH}/include/GL )
find_library(GLEW_LIBRARY libGLEW.a PATHS ${OSX_SEARCH_PATH}/lib )
set(GLEW_FOUND 1)

set(GLUT_SEARCH_PATH          "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/glut.framework")
set(GLUT_INCLUDE_PATH 		"${GLUT_SEARCH_PATH}/Headers")
#set(GLUT_LIBRARYDIR           "${GLUT_SEARCH_PATH}")

SET(OPENEXR_ROOT "${OSX_SEARCH_PATH}")

# Libs with hardcoded pathes ( macos repo )
SET(TIFF_LIBRARIES ${OSX_DEPENDENCY_ROOT}/lib/libtiff.a)
SET(TIFF_INCLUDE_DIR ${OSX_DEPENDENCY_ROOT}/include/tiff)
SET(TIFF_FOUND ON)
SET(JPEG_LIBRARIES ${OSX_DEPENDENCY_ROOT}/lib/libjpeg.a)
SET(JPEG_INCLUDE_DIR ${OSX_DEPENDENCY_ROOT}/include/jpeg)
SET(JPEG_FOUND ON)
SET(PNG_LIBRARIES ${OSX_DEPENDENCY_ROOT}/lib/libpng.a ${SYS_LIBRARIES})
SET(PNG_INCLUDE_DIR ${OSX_DEPENDENCY_ROOT}/include/png)
SET(PNG_FOUND ON)
#SET(EMBREE_LIBRARY 				${OSX_DEPENDENCY_ROOT}/lib/embree2/libembree.2.17.2.dylib)
#SET(EMBREE_INCLUDE_PATH 	${OSX_DEPENDENCY_ROOT}/include/embree2)
SET(EMBREE_FOUND ON)

# use Blender python libs for static compiling !
SET(PYTHON_LIBRARIES ${OSX_DEPENDENCY_ROOT}/lib/BF_pythonlibs/py34_intel64/libbf_python_ext.a ${OSX_DEPENDENCY_ROOT}/lib/BF_pythonlibs/py34_intel64/libbf_python.a)
SET(PYTHON_INCLUDE_DIRS ${OSX_DEPENDENCY_ROOT}/include/Python3.4m)
SET(PYTHONLIBS_FOUND ON)
What I don't understand is why the OS_DEPENDENCY_ROOT doesn't work with the '..'

luxCOREconsole and luxcoreui compile and start. Don't have a test file for it ready to go but it compiled and linked so they should work.

Also going to take a guess here, but can we change the OPENCL_SEARCH_PATH to a folder inside Xcode? Not sure why we couldn't if Xcode is being used. I guess that's sort of related to that whole OpenGL thing... can't be for GLUT because that's for luxcoreui I think.

jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe » Mon Jan 29, 2018 3:14 pm

Proposed diff:

Code: Select all

--- /home/jensverwiebe/Schreibtisch/old	2018-01-29 16:08:44.836788392 +0100
+++ /home/jensverwiebe/Schreibtisch/new	2018-01-29 16:07:38.290620334 +0100
@@ -8,16 +8,12 @@ MESSAGE(STATUS "Using OSX Configuration
 
 # Allow for the location of OSX_DEPENDENCY_ROOT to be set from the command line
 IF( NOT OSX_DEPENDENCY_ROOT )
-  set(OSX_DEPENDENCY_ROOT ${CMAKE_SOURCE_DIR}) # can be macos or usr/local for example
-#  set(OSX_DEPENDENCY_ROOT ${CMAKE_SOURCE_DIR}/../macos) # can be macos or usr/local for example
+  set(OSX_DEPENDENCY_ROOT ${CMAKE_SOURCE_DIR}/../macos) # can be macos or usr/local for example
 ENDIF()
 
 MESSAGE(STATUS "OSX_DEPENDENCY_ROOT : " ${OSX_DEPENDENCY_ROOT})
 set(OSX_SEARCH_PATH     ${OSX_DEPENDENCY_ROOT})
 
-set(LUXCORE_DISABLE_EMBREE_BVH_BUILDER ON)
-MESSAGE(STATUS "Disabling Embree BVH builder - no custom Embree used")
-
 # Libs present in system ( /usr )
 SET(SYS_LIBRARIES z )
 
@@ -31,12 +27,7 @@ set(OPENCL_SEARCH_PATH        "${CMAKE_O
 set(OPENCL_INCLUDE_PATH       "${OPENCL_SEARCH_PATH}")
 #set(OPENCL_LIBRARYDIR         "${OPENCL_SEARCH_PATH}")
 
-
-#
-# Changed for macOS High Sierra
-#
-
-set(EMBREE_SEARCH_PATH 				"{OSX_DEPENDENCY_ROOT}")
+set(EMBREE_SEARCH_PATH 		"{OSX_DEPENDENCY_ROOT}")
 
 set(GLEW_SEARCH_PATH          "${OSX_SEARCH_PATH}")
 find_path(GLEW_INCLUDE_DIR glew.h PATHS ${OSX_SEARCH_PATH}/include/GL )
@@ -59,9 +50,6 @@ SET(JPEG_FOUND ON)
 SET(PNG_LIBRARIES ${OSX_DEPENDENCY_ROOT}/lib/libpng.a ${SYS_LIBRARIES})
 SET(PNG_INCLUDE_DIR ${OSX_DEPENDENCY_ROOT}/include/png)
 SET(PNG_FOUND ON)
-#SET(EMBREE_LIBRARY 				${OSX_DEPENDENCY_ROOT}/lib/embree2/libembree.2.17.2.dylib)
-#SET(EMBREE_INCLUDE_PATH 	${OSX_DEPENDENCY_ROOT}/include/embree2)
-SET(EMBREE_FOUND ON)
 
 # use Blender python libs for static compiling !
 SET(PYTHON_LIBRARIES ${OSX_DEPENDENCY_ROOT}/lib/BF_pythonlibs/py34_intel64/libbf_python_ext.a ${OSX_DEPENDENCY_ROOT}/lib/BF_pythonlibs/py34_intel64/libbf_python.a)
-You must have a library repo somewhere, either discrete aka "macos" ( preferred ) or /usr/local or opt/ whatever.
-Respect the categories i made:

Code: Select all

# Libs present in system ( /usr )
...
 Libs that have find_package modules
...
# Libs with hardcoded pathes ( macos repo )
.. way more overlook then.

-Embree special bvh_build option is obsolete since its in embree master now
Also going to take a guess here, but can we change the OPENCL_SEARCH_PATH to a folder inside Xcode? Not sure why we couldn't if Xcode is being used. I guess that's sort of related to that whole OpenGL thing... can't be for GLUT because that's for luxcoreui I think.
SDKpathes are never a problem, cause you can assume a given structure ( unless Apple reinvented the wheel again )
This is take care by cmake itself, see: ${CMAKE_OSX_SYSROOT} which always reflects the highestmost sdk found inside xcode.

Underrstood ?
set(OPENCL_SEARCH_PATH "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/opencl.framework")
means really /Applications/XCode.app/blablabla/blablabla/System/Library/Frameworks/opencl.framework"), see ?

BTW: did you put the opencl c++ bindings into cl framework headers ?

Jens

User avatar
Dade
Developer
Posts: 1343
Joined: Mon Dec 04, 2017 8:36 pm

Re: Mac OS

Post by Dade » Mon Jan 29, 2018 3:26 pm

patrickwalker wrote:
Mon Jan 29, 2018 2:59 pm
luxCOREconsole and luxcoreui compile and start. Don't have a test file for it ready to go but it compiled and linked so they should work.
Just run, form LuxCore directory, something like:

Code: Select all

./bin/luxcoreui scenes/luxball/luxball-hdr.cfg
There are hundreds of test scenes under the scenes directory.
Support LuxCoreRender project with salts and bounties

jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe » Mon Jan 29, 2018 3:28 pm

Furthermore..

CGL mean Core GL and possibly those files are moved into the CoreVideo framework now.
Either try linking this or follow Dade's proposal to just comment out for now, cause opengl interop is not used anymore ( really ? )

The proper way would be to #if defined (__APPLE__) && ( versioncheck)
cause on 10.12 sdk it still works as expected

Jens

jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Mac OS

Post by jensverwiebe » Mon Jan 29, 2018 3:29 pm

Dade wrote:
Mon Jan 29, 2018 3:26 pm
patrickwalker wrote:
Mon Jan 29, 2018 2:59 pm
luxCOREconsole and luxcoreui compile and start. Don't have a test file for it ready to go but it compiled and linked so they should work.
Just run, form LuxCore directory, something like:

Code: Select all

./bin/luxcoreui scenes/luxball/luxball-hdr.cfg
There are hundreds of test scenes under the scenes directory.
Its Apple:

Code: Select all

./bin/Release/luxcoreui scenes/luxball/luxball-hdr.cfg
:lol:

Jens

User avatar
Dade
Developer
Posts: 1343
Joined: Mon Dec 04, 2017 8:36 pm

Re: Mac OS

Post by Dade » Mon Jan 29, 2018 3:31 pm

jensverwiebe wrote:
Mon Jan 29, 2018 3:28 pm
Either try linking this or follow Dade's proposal to just comment out for now, cause opengl interop is not used anymore ( really ? )
It hasn't been used for years: too many broken drivers released by vendors.
Support LuxCoreRender project with salts and bounties

Post Reply