mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-09 22:00:06 +00:00
Use obj targets for faster CPU/GPU lib builds
Further leverage cmake object libraries to share object files for CPU and GPU OSD libraries, avoiding duplicate complation for dynamic/static build passes. CMake restricts object library inputs to header and source files, so the .inc files were renamed to .gen.h (which seems like a better name anyway) to make CMake happy. Also updated the .gitignore file to ignore .gen.h files. Conflicts: opensubdiv/osd/CMakeLists.txt
This commit is contained in:
parent
94d2408c15
commit
eb09b9e14c
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
# ignore stringified kernels
|
||||
*.inc
|
||||
*.inc.rule
|
||||
*.gen.h
|
||||
|
||||
# ignore build files
|
||||
/build*
|
||||
|
@ -446,7 +446,7 @@ foreach(kernel_file ${KERNEL_FILES})
|
||||
|
||||
if(NOT ${extension} STREQUAL "cu")
|
||||
|
||||
string(REGEX REPLACE "(.*)[.].*" "\\1.inc" inc_file ${kernel_file})
|
||||
string(REGEX REPLACE "(.*)[.].*" "\\1.gen.h" inc_file ${kernel_file})
|
||||
list(APPEND INC_FILES ${inc_file})
|
||||
|
||||
add_custom_command(
|
||||
@ -479,6 +479,7 @@ if (NOT NO_LIB)
|
||||
${GPU_SOURCE_FILES}
|
||||
${PRIVATE_HEADER_FILES}
|
||||
${PUBLIC_HEADER_FILES}
|
||||
${INC_FILES}
|
||||
)
|
||||
|
||||
# Build static libs ------------------------------------
|
||||
@ -498,7 +499,6 @@ if (NOT NO_LIB)
|
||||
STATIC
|
||||
$<TARGET_OBJECTS:osd_gpu_obj>
|
||||
${KERNEL_FILES}
|
||||
${INC_FILES}
|
||||
)
|
||||
set_target_properties(osd_static_gpu PROPERTIES OUTPUT_NAME osdGPU CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
@ -538,9 +538,8 @@ if (NOT NO_LIB)
|
||||
|
||||
_add_possibly_cuda_library(osd_dynamic_gpu
|
||||
SHARED
|
||||
$<TARGET_OBJECTS:osd_gpu_obj>
|
||||
${KERNEL_FILES}
|
||||
${INC_FILES}
|
||||
$<TARGET_OBJECTS:osd_gpu_obj>
|
||||
${KERNEL_FILES}
|
||||
)
|
||||
|
||||
set_target_properties(osd_dynamic_gpu
|
||||
|
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
static const char *clSource =
|
||||
#include "clKernel.inc"
|
||||
#include "clKernel.gen.h"
|
||||
;
|
||||
|
||||
#define CL_CHECK_ERROR(x, ...) { \
|
||||
|
@ -43,19 +43,19 @@ OsdD3D11DrawConfig::~OsdD3D11DrawConfig()
|
||||
}
|
||||
|
||||
static const char *commonShaderSource =
|
||||
#include "hlslPatchCommon.inc"
|
||||
#include "hlslPatchCommon.gen.h"
|
||||
;
|
||||
static const char *ptexShaderSource =
|
||||
#include "hlslPtexCommon.inc"
|
||||
#include "hlslPtexCommon.gen.h"
|
||||
;
|
||||
static const char *bsplineShaderSource =
|
||||
#include "hlslPatchBSpline.inc"
|
||||
#include "hlslPatchBSpline.gen.h"
|
||||
;
|
||||
static const char *gregoryShaderSource =
|
||||
#include "hlslPatchGregory.inc"
|
||||
#include "hlslPatchGregory.gen.h"
|
||||
;
|
||||
static const char *transitionShaderSource =
|
||||
#include "hlslPatchTransition.inc"
|
||||
#include "hlslPatchTransition.gen.h"
|
||||
;
|
||||
|
||||
OsdD3D11DrawRegistryBase::~OsdD3D11DrawRegistryBase() {}
|
||||
|
@ -40,7 +40,7 @@ namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
static const char *shaderSource =
|
||||
#include "../osd/hlslComputeKernel.inc"
|
||||
#include "../osd/hlslComputeKernel.gen.h"
|
||||
;
|
||||
|
||||
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
||||
|
@ -39,19 +39,19 @@ OsdGLDrawConfig::~OsdGLDrawConfig()
|
||||
|
||||
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
|
||||
static const char *commonShaderSource =
|
||||
#include "glslPatchCommon.inc"
|
||||
#include "glslPatchCommon.gen.h"
|
||||
;
|
||||
static const char *ptexShaderSource =
|
||||
#include "glslPtexCommon.inc"
|
||||
#include "glslPtexCommon.gen.h"
|
||||
;
|
||||
static const char *bsplineShaderSource =
|
||||
#include "glslPatchBSpline.inc"
|
||||
#include "glslPatchBSpline.gen.h"
|
||||
;
|
||||
static const char *gregoryShaderSource =
|
||||
#include "glslPatchGregory.inc"
|
||||
#include "glslPatchGregory.gen.h"
|
||||
;
|
||||
static const char *transitionShaderSource =
|
||||
#include "glslPatchTransition.inc"
|
||||
#include "glslPatchTransition.gen.h"
|
||||
;
|
||||
#endif
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
static const char *shaderSource =
|
||||
#include "../osd/glslComputeKernel.inc"
|
||||
#include "../osd/glslComputeKernel.gen.h"
|
||||
;
|
||||
|
||||
OsdGLSLComputeKernelBundle::OsdGLSLComputeKernelBundle()
|
||||
|
@ -45,7 +45,7 @@ namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
static const char *shaderSource =
|
||||
#include "../osd/glslTransformFeedbackKernel.inc"
|
||||
#include "../osd/glslTransformFeedbackKernel.gen.h"
|
||||
;
|
||||
|
||||
static const char *shaderDefines = ""
|
||||
|
Loading…
Reference in New Issue
Block a user