Switched PoyVox to build as a static library.

This commit is contained in:
David Williams
2011-04-20 23:25:32 +01:00
parent a5f37d7a3a
commit ef52b906e6
21 changed files with 71 additions and 86 deletions

View File

@ -79,7 +79,8 @@ SET(IMPL_INC_FILES
include/PolyVoxImpl/Utility.h
)
ADD_DEFINITIONS(-DPOLYVOXCORE_EXPORT) #Export symbols in the .dll
#NOTE: The following line should be uncommented when building shared libs.
#ADD_DEFINITIONS(-DPOLYVOX_SHARED_EXPORTS) #Export symbols in the .dll
#"Sources" and "Headers" are the group names in Visual Studio.
#They may have other uses too...
@ -94,7 +95,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
#Core
#Build
ADD_LIBRARY(PolyVoxCore SHARED ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES})
ADD_LIBRARY(PolyVoxCore STATIC ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES})
SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR})
IF(MSVC)
SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "/wd4251") #Disable warning on STL exports

View File

@ -38,9 +38,9 @@ namespace PolyVox
const float sqrt_2 = 1.4143f;
const float sqrt_3 = 1.7321f;
extern const POLYVOXCORE_API Vector3DInt32 arrayPathfinderFaces[6];
extern const POLYVOXCORE_API Vector3DInt32 arrayPathfinderEdges[12];
extern const POLYVOXCORE_API Vector3DInt32 arrayPathfinderCorners[8];
extern const POLYVOX_API Vector3DInt32 arrayPathfinderFaces[6];
extern const POLYVOX_API Vector3DInt32 arrayPathfinderEdges[12];
extern const POLYVOX_API Vector3DInt32 arrayPathfinderCorners[8];
/// This function provides the default method for checking whether a given voxel
/// is vaid for the path computed by the AStarPathfinder.

View File

@ -53,7 +53,7 @@ namespace PolyVox
/// behind it may appear complex. For reference, it is based upon the article here:
/// http://www.drdobbs.com/cpp/184401319/
////////////////////////////////////////////////////////////////////////////////
class POLYVOXCORE_API ArraySizes
class POLYVOX_API ArraySizes
{
typedef const uint32_t (&UIntArray1)[1];

View File

@ -55,8 +55,8 @@ namespace PolyVox
template <typename VoxelType>
Vector3DFloat computeSmoothSobelGradient(VolumeSampler<VoxelType>& volIter);
POLYVOXCORE_API void computeNormalsForVertices(Volume<uint8_t>* volumeData, SurfaceMesh<PositionMaterialNormal>& mesh, NormalGenerationMethod normalGenerationMethod);
POLYVOXCORE_API Vector3DFloat computeNormal(Volume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API void computeNormalsForVertices(Volume<uint8_t>* volumeData, SurfaceMesh<PositionMaterialNormal>& mesh, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API Vector3DFloat computeNormal(Volume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
}
#include "GradientEstimators.inl"

View File

@ -45,7 +45,7 @@ namespace PolyVox
LS_ERROR
};
POLYVOXCORE_API extern void (*logHandler)(std::string, int severity);
POLYVOX_API extern void (*logHandler)(std::string, int severity);
}
//Debug severity messages are only used if we are a debug build

View File

@ -28,8 +28,8 @@ freely, subject to the following restrictions:
namespace PolyVox
{
extern POLYVOXCORE_API int edgeTable[256];
extern POLYVOXCORE_API int triTable[256][16];
extern POLYVOX_API int edgeTable[256];
extern POLYVOX_API int triTable[256][16];
}
#endif

View File

@ -28,7 +28,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
extern POLYVOXCORE_API const Vector3DFloat randomUnitVectors[];
extern POLYVOX_API const Vector3DFloat randomUnitVectors[];
}
#endif //__PolyVox_RandomUnitVectors_H__

View File

@ -28,7 +28,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
extern POLYVOXCORE_API const Vector3DFloat randomVectors[];
extern POLYVOX_API const Vector3DFloat randomVectors[];
}
#endif //__PolyVox_RandomVectors_H__

View File

@ -25,18 +25,39 @@ freely, subject to the following restrictions:
#define __PolyVox_TypeDef_H__
//Definitions needed to make library functions accessable
#ifdef _MSC_VER
//We are using a Microsoft compiler.
#ifdef POLYVOXCORE_EXPORT
#define POLYVOXCORE_API __declspec(dllexport)
#else
#define POLYVOXCORE_API __declspec(dllimport)
#endif
// See http://gcc.gnu.org/wiki/Visibility for more info.
#if defined _WIN32 || defined __CYGWIN__
#define POLYVOX_HELPER_IMPORT __declspec(dllimport)
#define POLYVOX_HELPER_EXPORT __declspec(dllexport)
#define POLYVOX_HELPER_LOCAL
#else
//Assume a GNU compiler.
#define POLYVOXCORE_API __attribute__ ((visibility("default")))
#if __GNUC__ >= 4
#define POLYVOX_HELPER_IMPORT __attribute__ ((visibility("default")))
#define POLYVOX_HELPER_EXPORT __attribute__ ((visibility("default")))
#define POLYVOX_HELPER_LOCAL __attribute__ ((visibility("hidden")))
#else
#define POLYVOX_HELPER_IMPORT
#define POLYVOX_HELPER_EXPORT
#define POLYVOX_HELPER_LOCAL
#endif
#endif
// Now we use the generic helper definitions above to define POLYVOX_API and POLYVOX_LOCAL.
// POLYVOX_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build)
// POLYVOX_LOCAL is used for non-api symbols.
#ifdef POLYVOX_SHARED // defined if FOX is compiled as a DLL
#ifdef POLYVOX_SHARED_EXPORTS // defined if we are building the FOX DLL (instead of using it)
#define POLYVOX_API POLYVOX_HELPER_EXPORT
#else
#define POLYVOX_API POLYVOX_HELPER_IMPORT
#endif // POLYVOX_SHARED_EXPORTS
#define POLYVOX_LOCAL POLYVOX_HELPER_LOCAL
#else // POLYVOX_SHARED is not defined: this means FOX is a static lib.
#define POLYVOX_API
#define POLYVOX_LOCAL
#endif // POLYVOX_SHARED
//Check which compiler we are using and work around unsupported features as necessary.
#if defined(_MSC_VER) && (_MSC_VER < 1600)
//To support old (pre-vc2010) Microsoft compilers we use boost to replace the

View File

@ -30,8 +30,8 @@ freely, subject to the following restrictions:
namespace PolyVox
{
POLYVOXCORE_API uint8_t logBase2(uint32_t uInput);
POLYVOXCORE_API bool isPowerOf2(uint32_t uInput);
POLYVOX_API uint8_t logBase2(uint32_t uInput);
POLYVOX_API bool isPowerOf2(uint32_t uInput);
template <typename Type>
Type trilinearlyInterpolate(

View File

@ -32,7 +32,7 @@ namespace PolyVox
#ifdef SWIG
class Region
#else
class POLYVOXCORE_API Region
class POLYVOX_API Region
#endif
{
public:

View File

@ -35,7 +35,7 @@ namespace PolyVox
#ifdef SWIG
class PositionMaterial
#else
class POLYVOXCORE_API PositionMaterial
class POLYVOX_API PositionMaterial
#endif
{
public:
@ -56,7 +56,7 @@ namespace PolyVox
#ifdef SWIG
class PositionMaterialNormal
#else
class POLYVOXCORE_API PositionMaterialNormal
class POLYVOX_API PositionMaterialNormal
#endif
{
public:

View File

@ -5,7 +5,7 @@
namespace PolyVox
{
template<>
POLYVOXCORE_API void MeshDecimator<PositionMaterial>::fillInitialVertexMetadata(std::vector<InitialVertexMetadata>& vecVertexMetadata)
POLYVOX_API void MeshDecimator<PositionMaterial>::fillInitialVertexMetadata(std::vector<InitialVertexMetadata>& vecVertexMetadata)
{
vecVertexMetadata.clear();
vecVertexMetadata.resize(m_pOutputMesh->m_vecVertices.size());
@ -77,7 +77,7 @@ namespace PolyVox
}
template<>
POLYVOXCORE_API void MeshDecimator<PositionMaterialNormal>::fillInitialVertexMetadata(std::vector<InitialVertexMetadata>& vecVertexMetadata)
POLYVOX_API void MeshDecimator<PositionMaterialNormal>::fillInitialVertexMetadata(std::vector<InitialVertexMetadata>& vecVertexMetadata)
{
vecVertexMetadata.clear();
vecVertexMetadata.resize(m_pOutputMesh->m_vecVertices.size());
@ -130,7 +130,7 @@ namespace PolyVox
}
template<>
POLYVOXCORE_API bool MeshDecimator<PositionMaterialNormal>::canCollapseNormalEdge(uint32_t uSrc, uint32_t uDst)
POLYVOX_API bool MeshDecimator<PositionMaterialNormal>::canCollapseNormalEdge(uint32_t uSrc, uint32_t uDst)
{
if(m_vecInitialVertexMetadata[uSrc].normal.dot(m_vecInitialVertexMetadata[uDst].normal) < m_fMinDotProductForCollapse)
{
@ -142,7 +142,7 @@ namespace PolyVox
}
template<>
POLYVOXCORE_API bool MeshDecimator<PositionMaterial>::canCollapseNormalEdge(uint32_t uSrc, uint32_t uDst)
POLYVOX_API bool MeshDecimator<PositionMaterial>::canCollapseNormalEdge(uint32_t uSrc, uint32_t uDst)
{
//We don't actually use the normal here, because we want to allow face
//vertices to collapse onto edge vertices. Simply checking whether anything