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 13, 2024
1 parent 40db068 commit 3ea0f26
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 23 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
15 changes: 5 additions & 10 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
add_executable(falcor_perftest)

target_sources(falcor_perftest PRIVATE
main.cpp
Object.cpp
path-tracer.cpp
Program.cpp
ProgramManager.cpp
ProgramReflection.cpp
ProgramVersion.cpp
DeviceWrapper.cpp
simplest.cpp
)

target_copy_shaders(falcor_perftest ./shaders .)
Expand Down Expand Up @@ -115,8 +108,10 @@ target_compile_definitions(falcor_perftest

target_link_libraries(falcor_perftest
PUBLIC
slang slang-gfx
external_includes
slang
# slang-gfx
# external_includes
# $<$<PLATFORM_ID:Linux>:dl>
)

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
5 changes: 3 additions & 2 deletions 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[])
{
ref<Device> device = make_ref<Device>();
TestCase(device);
printf("Starting creating device\n");
// ref<Device> device = make_ref<Device>();
// TestCase(device);

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

int main(int argc, char* argv[])
{
printf("Starting creating device\n");

Slang::ComPtr<slang::IGlobalSession> m_slangGlobalSession;
slang::createGlobalSession(m_slangGlobalSession.writeRef());
return 0;
}

0 comments on commit 3ea0f26

Please sign in to comment.