Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct include dir for libslang #5539

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmake/LLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function(fetch_or_build_slang_llvm)
LINK_WITH_PRIVATE core compiler-core llvm-dep clang-dep
# We include slang.h, but don't need to link with it
INCLUDE_FROM_PRIVATE slang
# We include tools/slang-test/filecheck.h, but don't need to link
# with it and it might not be a target if SLANG_ENABLE_TESTS is
# false, so just include the directory manually here
INCLUDE_DIRECTORIES_PRIVATE ${slang_SOURCE_DIR}/tools
# This uses the SLANG_DLL_EXPORT macro from slang.h, so make sure to set
# SLANG_DYNAMIC and SLANG_DYNAMIC_EXPORT
EXPORT_MACRO_PREFIX SLANG
Expand Down
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ if(SLANG_ENABLE_EXAMPLES)
slang
gfx
platform
stb
$<$<BOOL:${SLANG_ENABLE_CUDA}>:CUDA::cuda_driver>
FOLDER examples
)
Expand Down
6 changes: 3 additions & 3 deletions examples/autodiff-texture/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "platform/vector-math.h"
#include "platform/window.h"
#include "slang-com-ptr.h"
#include "slang-gfx.h"
#include "slang.h"
#include "source/core/slang-basic.h"
#include "tools/platform/vector-math.h"
#include "tools/platform/window.h"

using namespace gfx;
using namespace Slang;
Expand Down
2 changes: 1 addition & 1 deletion examples/example-base/example-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#endif

#define STB_IMAGE_IMPLEMENTATION
#include "external/stb/stb_image.h"
#include "stb_image.h"

using namespace Slang;
using namespace gfx;
Expand Down
6 changes: 3 additions & 3 deletions examples/example-base/example-base.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "core/slang-basic.h"
#include "core/slang-io.h"
#include "platform/window.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "source/core/slang-io.h"
#include "test-base.h"
#include "tools/platform/window.h"

#ifdef _WIN32
void _Win32OutputDebugString(const char* str);
Expand Down
2 changes: 1 addition & 1 deletion examples/example-base/test-base.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "core/slang-string-util.h"
#include "slang-com-ptr.h"
#include "slang.h"
#include "source/core/slang-string-util.h"

using Slang::ComPtr;

Expand Down
4 changes: 2 additions & 2 deletions examples/gpu-printing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#include <string>
using Slang::ComPtr;

#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "gpu-printing.h"
#include "platform/window.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/platform/window.h"

using namespace gfx;

Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// The goal is to demonstrate how to use the Slang API to cross compile
// shader code.
//
#include "core/slang-string-util.h"
#include "examples/example-base/example-base.h"
#include "examples/example-base/test-base.h"
#include "slang-com-ptr.h"
#include "slang.h"
#include "source/core/slang-string-util.h"
#include "vulkan-api.h"

using Slang::ComPtr;
Expand Down
10 changes: 5 additions & 5 deletions examples/model-viewer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
// and parameter binding.
//
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "platform/gui.h"
#include "platform/model.h"
#include "platform/vector-math.h"
#include "platform/window.h"
#include "slang-gfx.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/platform/gui.h"
#include "tools/platform/model.h"
#include "tools/platform/vector-math.h"
#include "tools/platform/window.h"

#include <map>
#include <sstream>
Expand Down
4 changes: 2 additions & 2 deletions examples/nv-aftermath-example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#include "../../source/core/slang-io.h"
#include "GFSDK_Aftermath.h"
#include "GFSDK_Aftermath_GpuCrashDump.h"
#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "platform/window.h"
#include "slang-com-ptr.h"
#include "slang-gfx.h"
#include "slang.h"
#include "source/core/slang-basic.h"
#include "tools/platform/window.h"

using namespace gfx;
using namespace Slang;
Expand Down
2 changes: 1 addition & 1 deletion examples/platform-test/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "examples/example-base/example-base.h"
#include "platform/window.h"
#include "slang.h"
#include "tools/platform/window.h"

using namespace gfx;
using namespace Slang;
Expand Down
6 changes: 3 additions & 3 deletions examples/ray-tracing-pipeline/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// This file implements an example of hardware ray-tracing using
// Slang shaders and the `gfx` graphics API.

#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "platform/vector-math.h"
#include "platform/window.h"
#include "slang-com-ptr.h"
#include "slang-gfx.h"
#include "slang.h"
#include "source/core/slang-basic.h"
#include "tools/platform/vector-math.h"
#include "tools/platform/window.h"

using namespace gfx;
using namespace Slang;
Expand Down
6 changes: 3 additions & 3 deletions examples/ray-tracing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// This file implements an example of hardware ray-tracing using
// Slang shaders and the `gfx` graphics API.

#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "platform/vector-math.h"
#include "platform/window.h"
#include "slang-com-ptr.h"
#include "slang-gfx.h"
#include "slang.h"
#include "source/core/slang-basic.h"
#include "tools/platform/vector-math.h"
#include "tools/platform/window.h"

using namespace gfx;
using namespace Slang;
Expand Down
2 changes: 1 addition & 1 deletion examples/shader-object/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "slang.h"
using Slang::ComPtr;

#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"

using namespace gfx;

Expand Down
8 changes: 4 additions & 4 deletions examples/shader-toy/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ using Slang::ComPtr;
// this layer is *not* required or assumed when using the Slang language,
// compiler, and API.
//
#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "platform/performance-counter.h"
#include "platform/window.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/platform/performance-counter.h"
#include "tools/platform/window.h"

#include <chrono>

Expand Down
4 changes: 2 additions & 2 deletions examples/triangle/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
// with Slang may depend on an application/engine making certain
// design choices in their abstraction layer.
//
#include "core/slang-basic.h"
#include "examples/example-base/example-base.h"
#include "gfx-util/shader-cursor.h"
#include "platform/window.h"
#include "slang-com-ptr.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/platform/window.h"

using namespace gfx;
using namespace Slang;
Expand Down
6 changes: 5 additions & 1 deletion external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ endif()
add_library(imgui INTERFACE)
target_include_directories(imgui INTERFACE "${CMAKE_CURRENT_LIST_DIR}/imgui")

# stb
add_library(stb INTERFACE)
target_include_directories(stb INTERFACE "${CMAKE_CURRENT_LIST_DIR}/stb")

# slang-rhi
if(SLANG_ENABLE_SLANG_RHI)
# slang-rhi
set(SLANG_RHI_BINARY_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>/bin)
set(SLANG_RHI_SLANG_INCLUDE_DIR ${slang_SOURCE_DIR}/include)
set(SLANG_RHI_SLANG_BINARY_DIR ${CMAKE_BINARY_DIR})
Expand Down
2 changes: 1 addition & 1 deletion source/slang-llvm/slang-llvm-filecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <llvm/ADT/SmallString.h>
#include <llvm/FileCheck/FileCheck.h>
#include <llvm/Support/raw_ostream.h>
#include <tools/slang-test/filecheck.h>
#include <slang-test/filecheck.h>

namespace slang_llvm
{
Expand Down
7 changes: 1 addition & 6 deletions source/slang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,7 @@ set(slang_link_args
slang-lookup-tables
SPIRV-Headers
)
set(slang_interface_args
# slang.h is in the project root, so include that directory in the interface
# for slang
INCLUDE_DIRECTORIES_PUBLIC
${slang_SOURCE_DIR}
)
set(slang_interface_args INCLUDE_DIRECTORIES_PUBLIC ${slang_SOURCE_DIR}/include)
set(slang_public_lib_args
PUBLIC_HEADERS
${slang_SOURCE_DIR}/include/slang*.h
Expand Down
11 changes: 9 additions & 2 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ if(SLANG_ENABLE_GFX)
LINK_WITH_PRIVATE
core
imgui
stb
$<$<BOOL:${SLANG_ENABLE_XLIB}>:X11::X11>
"$<$<PLATFORM_ID:Darwin>:-framework Cocoa>"
"$<$<PLATFORM_ID:Darwin>:-framework QuartzCore>"
Expand All @@ -106,7 +107,7 @@ if(SLANG_ENABLE_GFX)
EXTRA_COMPILE_DEFINITIONS_PRIVATE
$<$<BOOL:${SLANG_ENABLE_XLIB}>:SLANG_ENABLE_XLIB=1>
INCLUDE_FROM_PRIVATE gfx
INCLUDE_DIRECTORIES_PUBLIC platform
INCLUDE_DIRECTORIES_PUBLIC . platform
EXPORT_MACRO_PREFIX SLANG_PLATFORM
)

Expand All @@ -122,6 +123,7 @@ if(SLANG_ENABLE_GFX)
slang
Vulkan-Headers
metal-cpp
stb
$<$<BOOL:${SLANG_ENABLE_XLIB}>:X11::X11>
$<$<BOOL:${SLANG_ENABLE_CUDA}>:CUDA::cuda_driver>
LINK_WITH_FRAMEWORK Foundation Cocoa QuartzCore Metal
Expand Down Expand Up @@ -182,6 +184,7 @@ if(SLANG_ENABLE_TESTS)
EXECUTABLE
EXCLUDE_FROM_ALL
LINK_WITH_PRIVATE core compiler-core slang
INCLUDE_FROM_PRIVATE unit-test
FOLDER test
)
slang_add_target(
Expand All @@ -196,10 +199,12 @@ if(SLANG_ENABLE_TESTS)
slang-test
EXECUTABLE
USE_FEWER_WARNINGS
INCLUDE_DIRECTORIES_PUBLIC .
LINK_WITH_PRIVATE
core
compiler-core
slang
stb
${CMAKE_DL_LIBS}
Threads::Threads
REQUIRES
Expand Down Expand Up @@ -241,6 +246,7 @@ if(SLANG_ENABLE_TESTS)
unit-test
OBJECT
EXCLUDE_FROM_ALL
INCLUDE_DIRECTORIES_PUBLIC .
INCLUDE_FROM_PRIVATE slang core
INCLUDE_DIRECTORIES_PRIVATE ${slang_SOURCE_DIR}/include
FOLDER test
Expand All @@ -254,7 +260,7 @@ if(SLANG_ENABLE_TESTS)
EXCLUDE_FROM_ALL
EXTRA_COMPILE_DEFINITIONS_PRIVATE SLANG_SHARED_LIBRARY_TOOL
USE_FEWER_WARNINGS
LINK_WITH_PRIVATE core slang unit-test gfx gfx-util platform
LINK_WITH_PRIVATE core slang unit-test gfx gfx-util platform stb
OUTPUT_NAME gfx-unit-test-tool
REQUIRED_BY slang-test
FOLDER test/tools
Expand All @@ -272,6 +278,7 @@ if(SLANG_ENABLE_TESTS)
slang
slang-rhi
platform
stb
$<$<BOOL:${SLANG_ENABLE_CUDA}>:CUDA::cuda_driver>
EXTRA_COMPILE_DEFINITIONS_PRIVATE
$<$<BOOL:${SLANG_ENABLE_CUDA}>:RENDER_TEST_CUDA>
Expand Down
6 changes: 3 additions & 3 deletions tools/gfx-unit-test/buffer-barrier-test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "core/slang-basic.h"
#include "gfx-test-util.h"
#include "gfx-util/shader-cursor.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/unit-test/slang-unit-test.h"
#include "unit-test/slang-unit-test.h"

using namespace gfx;

Expand Down
6 changes: 3 additions & 3 deletions tools/gfx-unit-test/clear-texture-test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "core/slang-basic.h"
#include "gfx-test-util.h"
#include "gfx-util/shader-cursor.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/unit-test/slang-unit-test.h"
#include "unit-test/slang-unit-test.h"

using namespace Slang;
using namespace gfx;
Expand Down
6 changes: 3 additions & 3 deletions tools/gfx-unit-test/compute-smoke.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "core/slang-basic.h"
#include "gfx-test-util.h"
#include "gfx-util/shader-cursor.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/unit-test/slang-unit-test.h"
#include "unit-test/slang-unit-test.h"

using namespace gfx;

Expand Down
6 changes: 3 additions & 3 deletions tools/gfx-unit-test/compute-trivial.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "core/slang-basic.h"
#include "gfx-test-util.h"
#include "gfx-util/shader-cursor.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/unit-test/slang-unit-test.h"
#include "unit-test/slang-unit-test.h"

using namespace gfx;

Expand Down
6 changes: 3 additions & 3 deletions tools/gfx-unit-test/copy-texture-tests.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "core/slang-basic.h"
#include "gfx-test-texture-util.h"
#include "gfx-test-util.h"
#include "gfx-util/shader-cursor.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/unit-test/slang-unit-test.h"
#include "unit-test/slang-unit-test.h"

#if SLANG_WINDOWS_FAMILY
#include <d3d12.h>
Expand Down
6 changes: 3 additions & 3 deletions tools/gfx-unit-test/create-buffer-from-handle.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "core/slang-basic.h"
#include "gfx-test-util.h"
#include "gfx-util/shader-cursor.h"
#include "slang-gfx.h"
#include "source/core/slang-basic.h"
#include "tools/gfx-util/shader-cursor.h"
#include "tools/unit-test/slang-unit-test.h"
#include "unit-test/slang-unit-test.h"

using namespace gfx;

Expand Down
Loading
Loading