Skip to content

Commit

Permalink
Now including headers in generated projects for Kraken
Browse files Browse the repository at this point in the history
  • Loading branch information
kearwood committed Jan 21, 2024
1 parent 2925ea3 commit a0de671
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 86 deletions.
30 changes: 26 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,28 @@ macro (add_public_header)
endif()
endmacro()

macro (add_private_headers)
file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
foreach (_src ${ARGN})
if (_relPath)
list (APPEND KRAKEN_PRIVATE_HEADERS "${_relPath}/${_src}")
else()
list (APPEND KRAKEN_PRIVATE_HEADERS "${_src}")
endif()
endforeach()
if (_relPath)
# propagate KRAKEN_PRIVATE_HEADERS to parent directory
set (KRAKEN_PRIVATE_HEADERS ${KRAKEN_PRIVATE_HEADERS} PARENT_SCOPE)
endif()
endmacro()

macro (add_source_and_header)
foreach (_src ${ARGN})
add_sources("${_src}.cpp")
add_private_headers("${_src}.h")
endforeach()
endmacro()

IF(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations -Wno-c++11-extensions")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated -Wno-deprecated-declarations -Wno-c++11-extensions")
Expand Down Expand Up @@ -186,24 +208,24 @@ endif()
include_directories(3rdparty/spirv-reflect)
add_sources(3rdparty/spirv-reflect/spirv_reflect.c)

add_library(kraken STATIC ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
add_library(kraken STATIC ${SRCS} ${KRAKEN_PUBLIC_HEADERS} ${KRAKEN_PRIVATE_HEADERS})
TARGET_LINK_LIBRARIES( kraken ${EXTRA_LIBS} )
SET_TARGET_PROPERTIES(
kraken
PROPERTIES
PUBLIC_HEADER "${KRAKEN_PUBLIC_HEADERS}"
PRIVATE_HEADER "${PRIVATE_HEADER_FILES}"
PRIVATE_HEADER "${KRAKEN_PRIVATE_HEADERS}"
ARCHIVE_OUTPUT_DIRECTORY "lib${LIB_SUFFIX}"
OUTPUT_NAME kraken_static
)

add_library(kraken_dynamic SHARED ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
add_library(kraken_dynamic SHARED ${SRCS} ${KRAKEN_PUBLIC_HEADERS} ${KRAKEN_PRIVATE_HEADERS})
TARGET_LINK_LIBRARIES( kraken_dynamic ${EXTRA_LIBS} )
SET_TARGET_PROPERTIES(
kraken_dynamic
PROPERTIES
PUBLIC_HEADER "${KRAKEN_PUBLIC_HEADERS}"
PRIVATE_HEADER "${PRIVATE_HEADER_FILES}"
PRIVATE_HEADER "${KRAKEN_PRIVATE_HEADERS}"
ARCHIVE_OUTPUT_DIRECTORY "lib${LIB_SUFFIX}"
OUTPUT_NAME kraken
)
Expand Down
166 changes: 84 additions & 82 deletions kraken/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,89 +1,91 @@
include_directories(public)
add_subdirectory(public)
set(KRAKEN_PUBLIC_HEADERS "${KRAKEN_PUBLIC_HEADERS}" PARENT_SCOPE)
set(KRAKEN_PRIVATE_HEADERS "${KRAKEN_PRIVATE_HEADERS}" PARENT_SCOPE)

# Private Implementation
add_sources(kraken.cpp)
add_sources(KRAmbientZone.cpp)
add_sources(KRAnimation.cpp)
add_sources(KRAnimationAttribute.cpp)
add_sources(KRAnimationCurve.cpp)
add_sources(KRAnimationCurveManager.cpp)
add_sources(KRAnimationLayer.cpp)
add_sources(KRAnimationManager.cpp)
add_sources(KRAudioBuffer.cpp)
add_sources(KRAudioManager.cpp)
add_sources(KRAudioSample.cpp)
add_sources(KRAudioSource.cpp)
add_sources(KRBehavior.cpp)
add_sources(KRBone.cpp)
add_sources(KRBundle.cpp)
add_sources(KRBundleManager.cpp)
add_sources(KRCamera.cpp)
add_sources(KRCollider.cpp)
add_sources(KRContext.cpp)
add_sources(KRUniformBuffer.cpp)
add_sources(KRUniformBufferManager.cpp)
add_sources(KRDevice.cpp)
add_sources(KRDeviceManager.cpp)
add_sources(KRRenderPass.cpp)
add_sources(KRSurface.cpp)
add_sources(KRSurfaceManager.cpp)
add_sources(KRStreamerThread.cpp)
add_sources(KRSwapchain.cpp)
add_sources(KRContextObject.cpp)
add_sources(KRDirectionalLight.cpp)
add_sources(KRHelpers.cpp)
add_sources(KRLight.cpp)
add_sources(KRLocator.cpp)
add_sources(KRLODGroup.cpp)
add_sources(KRLODSet.cpp)
add_sources(KRMaterial.cpp)
add_sources(KRMaterialManager.cpp)
add_sources(KRMesh.cpp)
add_sources(KRMeshCube.cpp)
add_sources(KRMeshManager.cpp)
add_sources(KRMeshQuad.cpp)
add_sources(KRMeshSphere.cpp)
add_sources(KRModel.cpp)
add_sources(KRNode.cpp)
add_sources(KROctree.cpp)
add_sources(KROctreeNode.cpp)
add_sources(KRParticleSystem.cpp)
add_sources(KRParticleSystemNewtonian.cpp)
add_sources(KRPointLight.cpp)
add_sources(KRPresentationThread.cpp)
add_sources(KRRenderGraph.cpp)
add_sources(KRRenderSettings.cpp)
add_sources(KRResource+blend.cpp)
# add_sources(KRResource+fbx.cpp) # TODO - Locate FBX SDK dependencies
add_source_and_header(KRAmbientZone)
add_source_and_header(KRAnimation)
add_source_and_header(KRAnimationAttribute)
add_source_and_header(KRAnimationCurve)
add_source_and_header(KRAnimationCurveManager)
add_source_and_header(KRAnimationLayer)
add_source_and_header(KRAnimationManager)
add_source_and_header(KRAudioBuffer)
add_source_and_header(KRAudioManager)
add_source_and_header(KRAudioSample)
add_source_and_header(KRAudioSource)
add_source_and_header(KRBehavior)
add_source_and_header(KRBone)
add_source_and_header(KRBundle)
add_source_and_header(KRBundleManager)
add_source_and_header(KRCamera)
add_source_and_header(KRCollider)
add_source_and_header(KRContext)
add_source_and_header(KRUniformBuffer)
add_source_and_header(KRUniformBufferManager)
add_source_and_header(KRDevice)
add_source_and_header(KRDeviceManager)
add_source_and_header(KRRenderPass)
add_source_and_header(KRSurface)
add_source_and_header(KRSurfaceManager)
add_source_and_header(KRStreamerThread)
add_source_and_header(KRSwapchain)
add_source_and_header(KRContextObject)
add_source_and_header(KRDirectionalLight)
add_source_and_header(KRHelpers)
add_source_and_header(KRLight)
add_source_and_header(KRLocator)
add_source_and_header(KRLODGroup)
add_source_and_header(KRLODSet)
add_source_and_header(KRMaterial)
add_source_and_header(KRMaterialManager)
add_source_and_header(KRMesh)
add_source_and_header(KRMeshCube)
add_source_and_header(KRMeshManager)
add_source_and_header(KRMeshQuad)
add_source_and_header(KRMeshSphere)
add_source_and_header(KRModel)
add_source_and_header(KRNode)
add_source_and_header(KROctree)
add_source_and_header(KROctreeNode)
add_source_and_header(KRParticleSystem)
add_source_and_header(KRParticleSystemNewtonian)
add_source_and_header(KRPointLight)
add_source_and_header(KRPresentationThread)
add_source_and_header(KRRenderGraph)
add_source_and_header(KRRenderSettings)
add_sources(KRResource+blend)
# add_source(KRResource+fbx.cpp) # TODO - Locate FBX SDK dependencies
add_sources(KRResource+obj.cpp)
add_sources(KRResource.cpp)
add_sources(KRResourceManager.cpp)
add_sources(KRReverbZone.cpp)
add_sources(KRScene.cpp)
add_sources(KRSceneManager.cpp)
add_sources(KRShader.cpp)
add_sources(KRShaderManager.cpp)
add_sources(KRSource.cpp)
add_sources(KRSourceManager.cpp)
add_sources(KRPipeline.cpp)
add_sources(KRPipelineManager.cpp)
add_sources(KRSampler.cpp)
add_sources(KRSamplerManager.cpp)
add_sources(KRSpotLight.cpp)
add_sources(KRSprite.cpp)
add_sources(KRTexture.cpp)
add_sources(KRTexture2D.cpp)
add_sources(KRTextureAnimated.cpp)
add_sources(KRTextureCube.cpp)
add_sources(KRTextureKTX.cpp)
add_sources(KRTextureKTX2.cpp)
add_sources(KRTextureManager.cpp)
add_sources(KRTexturePVR.cpp)
add_sources(KRTextureTGA.cpp)
add_sources(KRUnknown.cpp)
add_sources(KRUnknownManager.cpp)
add_sources(KRViewport.cpp)
add_sources(../3rdparty/tinyxml2/tinyxml2.cpp)
add_sources(../3rdparty/forsyth/forsyth.cpp)
add_private_headers(KRResource.h)
add_source_and_header(KRResource)
add_source_and_header(KRResourceManager)
add_source_and_header(KRReverbZone)
add_source_and_header(KRScene)
add_source_and_header(KRSceneManager)
add_source_and_header(KRShader)
add_source_and_header(KRShaderManager)
add_source_and_header(KRSource)
add_source_and_header(KRSourceManager)
add_source_and_header(KRPipeline)
add_source_and_header(KRPipelineManager)
add_source_and_header(KRSampler)
add_source_and_header(KRSamplerManager)
add_source_and_header(KRSpotLight)
add_source_and_header(KRSprite)
add_source_and_header(KRTexture)
add_source_and_header(KRTexture2D)
add_source_and_header(KRTextureAnimated)
add_source_and_header(KRTextureCube)
add_source_and_header(KRTextureKTX)
add_source_and_header(KRTextureKTX2)
add_source_and_header(KRTextureManager)
add_source_and_header(KRTexturePVR)
add_source_and_header(KRTextureTGA)
add_source_and_header(KRUnknown)
add_source_and_header(KRUnknownManager)
add_source_and_header(KRViewport)
add_source_and_header(../3rdparty/tinyxml2/tinyxml2)
add_source_and_header(../3rdparty/forsyth/forsyth)

0 comments on commit a0de671

Please sign in to comment.