Skip to content

Commit

Permalink
Use gcc-10 in linux workflow
Browse files Browse the repository at this point in the history
Link with -ldl on linux
  • Loading branch information
kaizhangNV committed Feb 14, 2024
1 parent 40db068 commit 7f6bec1
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 17 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: select gcc 10
run: |
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-10 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-10 \
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-10
- uses: actions/checkout@v3
- name: Install prerequisite
run: sudo apt-get install ninja-build
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: select gcc 10
run: |
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-10 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-10 \
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-10
- uses: actions/checkout@v3
- name: Install prerequisite
run: sudo apt-get install ninja-build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ jobs:
id: build
run: |
echo "build app"
cmake --build build/windows-ninja-msvc --config Release
cmake --build build/windows-ninja-msvc --config Release --verbose
$tagName = & git describe --tags
$binArchive = "falcor_perf_test-$tagName-win-64.zip"
echo "package name=$binArchive"
cd build/windows-ninja-msvc
7z a "$binArchive" bin/Release/*
echo "FALCOR_PERF_TEST_PACKAGE=build/windows-ninja-msvc/$binArchive" >> $env:GITHUB_OUTPUT
- name: UploadBinary
uses: softprops/action-gh-release@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/win64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: configure
run: cmake --preset windows-ninja-msvc
- name: make
run: cmake --build build/windows-ninja-msvc
run: cmake --build build/windows-ninja-msvc --verbose
4 changes: 2 additions & 2 deletions dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<remote name="github-slang-windows" type="https" packageLocation="github.com/shader-slang/slang/releases/download/v${version}/slang-${version}-win64.zip"/>
<remote name="github-slang-linux" type="https" packageLocation="github.com/shader-slang/slang/releases/download/v${version}/slang-${version}-linux-x86_64.zip"/>
<dependency name="slang" linkPath="external/packman/slang">
<package name="slang" version="2024.0.4" remotes="github-slang-windows" platforms="windows-x86_64"/>
<package name="slang" version="2024.0.4" remotes="github-slang-linux" platforms="linux-x86_64" />
<package name="slang" version="2024.0.6" remotes="github-slang-windows" platforms="windows-x86_64"/>
<package name="slang" version="2024.0.6" remotes="github-slang-linux" platforms="linux-x86_64" />
</dependency>
<remote name="vulkan-headers" type="https" packageLocation="github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v${version}.zip"/>
<dependency name="vulkan-headers" linkPath="external/packman/vulkan">
Expand Down
7 changes: 6 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_executable(falcor_perftest)

target_sources(falcor_perftest PRIVATE
# simplest.cpp
main.cpp
Object.cpp
path-tracer.cpp
Expand Down Expand Up @@ -115,8 +116,12 @@ target_compile_definitions(falcor_perftest

target_link_libraries(falcor_perftest
PUBLIC
slang slang-gfx
slang
slang-gfx
external_includes
$<$<PLATFORM_ID:Linux>:dl>
$<$<PLATFORM_ID:Windows>:-static-libgcc>
$<$<PLATFORM_ID:Windows>:-static-libstdc++>
)

set_target_properties(falcor_perftest PROPERTIES
Expand Down
12 changes: 3 additions & 9 deletions source/DeviceWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

Device::Device()
{
printf("slang: create global session\n");
slang::createGlobalSession(m_slangGlobalSession.writeRef());
m_pProgramManager = std::make_unique<ProgramManager>(this);

Expand All @@ -12,15 +13,7 @@ Device::Device()
gfxDesc.shaderCache.maxEntryCount = 1000;
gfxDesc.shaderCache.shaderCachePath = nullptr;

std::vector<void*> extendedDescs;
// Add extended desc for root parameter attribute.
gfx::D3D12DeviceExtendedDesc extDesc = {};
extDesc.rootParameterShaderAttributeName = "root";
extendedDescs.push_back(&extDesc);

gfxDesc.extendedDescCount = extendedDescs.size();
gfxDesc.extendedDescs = extendedDescs.data();

printf("gfx:: get GPU adapters\n");
gfx::AdapterList adapters = gfx::gfxGetAdapters(gfxDesc.deviceType);
if (adapters.getCount() == 0)
{
Expand All @@ -33,6 +26,7 @@ Device::Device()
mpAPIDispatcher.reset(new PipelineCreationAPIDispatcher());
gfxDesc.apiCommandDispatcher = static_cast<ISlangUnknown*>(mpAPIDispatcher.get());

printf("gfx create device\n");
if (SLANG_FAILED(gfx::gfxCreateDevice(&gfxDesc, m_gfxDevice.writeRef())))
{
printf("Failed to create device on GPU 0 (%s).", adapters.getAdapters()[0].name);
Expand Down
3 changes: 2 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ void TestCase(ref<Device>& device)

int main(int argc, char* argv[])
{
printf("Starting creating device\n");
ref<Device> device = make_ref<Device>();
TestCase(device);
// TestCase(device);

return 0;
}
16 changes: 16 additions & 0 deletions source/simplest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>
#include <slang.h>
#include <slang-com-ptr.h>

int main(int argc, char* argv[])
{
printf("Starting creating device\n");
SlangSession* globalSession = spCreateSession();
printf("C API: slang session: %p\n", globalSession);


Slang::ComPtr<slang::IGlobalSession> slangGlobalSession;
slang::createGlobalSession(slangGlobalSession.writeRef());
printf("C++ API: slang session: %p\n", slangGlobalSession.get());
return 0;
}

0 comments on commit 7f6bec1

Please sign in to comment.