Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #99 from DavidBluecame/mac_os_2
Browse files Browse the repository at this point in the history
Patches to allow building for Mac OSX
  • Loading branch information
DarkTide committed Nov 8, 2015
2 parents 150dea7 + 26daa53 commit ee254c6
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 36 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ option(FAST_TRIG "Enable trigonometric approximations to make code faster" ON)

###### Packages and Definitions #########

SET(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk")

# Load user configurations if available
include(CMakeConfig/UserConfig.txt OPTIONAL)

Expand Down
30 changes: 16 additions & 14 deletions CMakeModules/FindYafPythonLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,23 @@ ENDIF(Python_FRAMEWORKS)
# library. We now set the variables listed by the documentation for this
# module.
if(WITH_OSX_ADDON)
# for Blender2.5 OSX we need to link to the BF_python libs build by blender ! added a switch for a choice "blender-/general use" - Jens
if (NOT YAF_OSX_PYTHON_INCLUDE_DIR)
SET(PYTHON_INCLUDE_DIRS ${YAF_USER_INCLUDE_DIRS}/python3.2)
else (NOT YAF_OSX_PYTHON_LIB)
SET(PYTHON_INCLUDE_DIR ${YAF_OSX_PYTHON_INCLUDE_DIR})
endif (NOT YAF_OSX_PYTHON_INCLUDE_DIR)
if (NOT YAF_OSX_PYTHON_LIB)
SET(PYTHON_LIBRARIES ${YAF_USER_LIBRARY_DIRS}/BF_pythonlibs/libbf_python_ext.a ${YAF_USER_LIBRARY_DIRS}/BF_pythonlibs/libbf_python.a)
else (NOT YAF_OSX_PYTHON_LIB)
SET(PYTHON_LIBRARIES ${YAF_OSX_PYTHON_LIB})
endif (NOT YAF_OSX_PYTHON_LIB)
# for Blender2.5 OSX we need to link to the BF_python libs build by blender ! added a switch for a choice "blender-/general use" - Jens
SET(PYTHON_INCLUDE_DIR ${YAF_USER_INCLUDE_DIRS}/Python${YAF_PY_VERSION} CACHE PATH "" FORCE)
SET(PYTHON_LIBRARIES ${YAF_USER_LIBRARY_DIRS}/BF_pythonlibs/libbf_python_ext.a ${YAF_USER_LIBRARY_DIRS}/BF_pythonlibs/libbf_python.a)
# if (NOT YAF_OSX_PYTHON_INCLUDE_DIR)
# SET(PYTHON_INCLUDE_DIRS ${YAF_USER_INCLUDE_DIRS}/python3.2)
# else (NOT YAF_OSX_PYTHON_LIB)
# SET(PYTHON_INCLUDE_DIR ${YAF_OSX_PYTHON_INCLUDE_DIR})
# endif (NOT YAF_OSX_PYTHON_INCLUDE_DIR)
# if (NOT YAF_OSX_PYTHON_LIB)
# SET(PYTHON_LIBRARIES ${YAF_USER_LIBRARY_DIRS}/BF_pythonlibs/libbf_python_ext.a ${YAF_USER_LIBRARY_DIRS}/BF_pythonlibs/libbf_python.a)
# else (NOT YAF_OSX_PYTHON_LIB)
# SET(PYTHON_LIBRARIES ${YAF_OSX_PYTHON_LIB})
# endif (NOT YAF_OSX_PYTHON_LIB)
else(WITH_OSX_ADDON)
SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
endif(WITH_OSX_ADDON)


Expand Down
2 changes: 1 addition & 1 deletion include/core_api/integrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ __BEGIN_YAFRAY
*/

class imageFilm_t;
class renderArea_t;
struct renderArea_t;

class YAFRAYCORE_EXPORT integrator_t
{
Expand Down
2 changes: 1 addition & 1 deletion include/core_api/light.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

__BEGIN_YAFRAY

class surfacePoint_t;
struct surfacePoint_t;
class background_t;

enum { LIGHT_NONE = 0, LIGHT_DIRACDIR = 1, LIGHT_SINGULAR = 1<<1 }; // "LIGHT_DIRACDIR" *must* be same as "BSDF_SPECULAR" (material.h)!
Expand Down
4 changes: 2 additions & 2 deletions include/core_api/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class YAFRAYCORE_EXPORT BSDF_t
};
*/

class surfacePoint_t;
class renderState_t;
struct surfacePoint_t;
struct renderState_t;
class volumeHandler_t;

enum bsdfFlags_t
Expand Down
2 changes: 1 addition & 1 deletion include/core_api/object3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ __BEGIN_YAFRAY

class light_t;
class primitive_t;
class surfacePoint_t;
struct surfacePoint_t;

class YAFRAYCORE_EXPORT object3d_t
{
Expand Down
4 changes: 2 additions & 2 deletions include/core_api/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class material_t;
class object3d_t;
class triangleObject_t;
class meshObject_t;
class surfacePoint_t;
struct surfacePoint_t;
class ray_t;
class primitive_t;
class triKdTree_t;
Expand All @@ -43,7 +43,7 @@ class light_t;
class surfaceIntegrator_t;
class volumeIntegrator_t;
class imageFilm_t;
class renderArea_t;
struct renderArea_t;
class random_t;

typedef unsigned int objID_t;
Expand Down
4 changes: 2 additions & 2 deletions include/core_api/volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

__BEGIN_YAFRAY

class renderState_t;
class pSample_t;
struct renderState_t;
struct pSample_t;
class light_t;


Expand Down
8 changes: 8 additions & 0 deletions include/utilities/mathOptimizations.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ inline float asmSqrt(float n)
fsqrt
fstp r
}
#elif defined (__APPLE__)
asm(
"flds %0;"
"fsqrt;"
"fstps %0"
:"=m" (r)
:"m" (r)
);
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
asm(
"fld %0;"
Expand Down
2 changes: 1 addition & 1 deletion include/yafraycore/kdtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ __BEGIN_YAFRAY

extern int Kd_inodes, Kd_leaves, _emptyKd_leaves, Kd_prims;

class renderState_t;
struct renderState_t;

#define PRIM_DAT_SIZE 32

Expand Down
2 changes: 1 addition & 1 deletion include/yafraycore/ray_kdtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ __BEGIN_YAFRAY

extern int Kd_inodes, Kd_leaves, _emptyKd_leaves, Kd_prims, _clip, _bad_clip, _null_clip, _early_out;

class renderState_t;
struct renderState_t;

#define PRIM_DAT_SIZE 32

Expand Down
2 changes: 1 addition & 1 deletion src/image_handlers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ endif(WITH_PNG)

if(WITH_TIFF)
add_library(tifHandler SHARED tifHandler.cc)
target_link_libraries(tifHandler yafaraycore ${TIFF_LIBRARY})
target_link_libraries(tifHandler yafaraycore -Wl,-undefined -Wl,dynamic_lookup ${TIFF_LIBRARY})
endif(WITH_TIFF)

add_library(tgaHandler SHARED tgaHandler.cc)
Expand Down
4 changes: 2 additions & 2 deletions src/volumes/ExpDensityVolume.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

__BEGIN_YAFRAY

class renderState_t;
class pSample_t;
struct renderState_t;
struct pSample_t;

class ExpDensityVolume : public DensityVolume {
public:
Expand Down
4 changes: 2 additions & 2 deletions src/volumes/GridVolume.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

__BEGIN_YAFRAY

class renderState_t;
class pSample_t;
struct renderState_t;
struct pSample_t;

class GridVolume : public DensityVolume {
public:
Expand Down
4 changes: 2 additions & 2 deletions src/volumes/NoiseVolume.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

__BEGIN_YAFRAY

class renderState_t;
class pSample_t;
struct renderState_t;
struct pSample_t;

class NoiseVolume : public DensityVolume {
public:
Expand Down
4 changes: 2 additions & 2 deletions src/volumes/SkyVolume.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

__BEGIN_YAFRAY

class renderState_t;
class pSample_t;
struct renderState_t;
struct pSample_t;

class SkyVolume : public VolumeRegion {
public:
Expand Down
4 changes: 2 additions & 2 deletions src/volumes/UniformVolume.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

__BEGIN_YAFRAY

class renderState_t;
class pSample_t;
struct renderState_t;
struct pSample_t;

class UniformVolume : public VolumeRegion {
public:
Expand Down
4 changes: 4 additions & 0 deletions src/yafraycore/mcintegrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include <yafraycore/spectrum.h>
#include <utilities/mcqmc.h>

#ifdef __clang__
#define inline // aka inline removal
#endif

__BEGIN_YAFRAY

#define allBSDFIntersect (BSDF_GLOSSY | BSDF_DIFFUSE | BSDF_DISPERSIVE | BSDF_REFLECT | BSDF_TRANSMIT);
Expand Down
4 changes: 4 additions & 0 deletions src/yafraycore/triangle.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include <cassert>
#include <yafraycore/meshtypes.h>

#ifdef __clang__
#define inline // aka inline removal
#endif

__BEGIN_YAFRAY

int triBoxClip(const double b_min[3], const double b_max[3], const double triverts[3][3], bound_t &box, void* n_dat);
Expand Down

0 comments on commit ee254c6

Please sign in to comment.