Skip to content

Commit bf1d6fa

Browse files
committed
Python - fixes for Linux
1 parent 290b526 commit bf1d6fa

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

python/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,42 @@ include_directories(
1919
../RadeonProRender/inc
2020
)
2121

22+
23+
24+
if (WIN32)
25+
message("link_directories for WIN32")
2226
link_directories(
2327
../RadeonProRender/libWin64
2428
)
29+
endif (WIN32)
30+
31+
if (LINUX)
32+
message("link_directories for LINUX")
33+
link_directories(
34+
../RadeonProRender/binUbuntu20
35+
)
36+
endif (LINUX)
37+
2538

2639

2740
nanobind_add_module(rpr bind_rpr.cpp bind_common.cpp bind_common.h)
2841
nanobind_add_module(rprs bind_rprs.cpp bind_common.cpp bind_common.h)
2942
nanobind_add_module(rprgltf bind_rprgltf.cpp bind_common.cpp bind_common.h)
3043

44+
45+
if (WIN32)
3146
target_link_libraries(rpr PUBLIC RadeonProRender64.lib)
3247
target_link_libraries(rprs PUBLIC RprLoadStore64.lib)
3348
target_link_libraries(rprgltf PUBLIC ProRenderGLTF.lib)
49+
endif (WIN32)
50+
51+
52+
if (LINUX)
53+
target_link_libraries(rpr PUBLIC RadeonProRender64)
54+
target_link_libraries(rprs PUBLIC RprLoadStore64)
55+
target_link_libraries(rprgltf PUBLIC ProRenderGLTF)
56+
endif (LINUX)
57+
58+
59+
3460

python/bind_rpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ enum class CreationFlags : rpr_creation_flags {
7575
ENABLE_GPU15 = (1 << 18) ,
7676
ENABLE_HIP = (1 << 19) ,
7777
ENABLE_OPENCL = (1 << 20) ,
78-
ENABLE_DEBUG = (1 << 31) ,
78+
ENABLE_DEBUG = (uint32_t)(1 << 31) ,
7979
};
8080
enum class FilterType : rpr_aa_filter {
8181
NONE = 0x0 ,

python/test/test_script_gltf.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,25 @@
99
import sys
1010
import os
1111

12+
binFolder = ""
13+
if sys.platform == "linux":
14+
binFolder = "binUbuntu20"
15+
elif sys.platform == "win32":
16+
binFolder = "binWin64"
17+
else:
18+
binFolder = "binMacOS"
19+
20+
1221
# add the RPR Python library folder in order to import the rpr,rprs,rprgltf modules.
13-
sys.path.insert(1, '../../python/build/Release')
22+
if sys.platform == "win32":
23+
sys.path.insert(1, '../../python/build/Release')
24+
1425

1526
# we need to add the RPR DLLs
16-
os.add_dll_directory( os.path.abspath(os.path.dirname(__file__) + '../../../RadeonProRender/binWin64') )
27+
if sys.platform == "win32":
28+
os.add_dll_directory( os.path.abspath(os.path.dirname(__file__) + '../../../RadeonProRender/' + binFolder ) )
1729

30+
1831
import rpr
1932
import rprs
2033
import rprgltf
@@ -35,7 +48,7 @@ def RPRCHECK(retCode):
3548

3649

3750

38-
plugin_id = rpr.RegisterPlugin((str("../../RadeonProRender/binWin64/Northstar64.dll")))
51+
plugin_id = rpr.RegisterPlugin((str("../../RadeonProRender/" + binFolder + "/Northstar64.dll")))
3952
if ( plugin_id == -1 ):
4053
print(f"RPR ERROR: plugin not found.")
4154
exit()

python/test/test_script_rpr.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,25 @@
99
import sys
1010
import os
1111

12+
binFolder = ""
13+
if sys.platform == "linux":
14+
binFolder = "binUbuntu20"
15+
elif sys.platform == "win32":
16+
binFolder = "binWin64"
17+
else:
18+
binFolder = "binMacOS"
19+
20+
1221
# add the RPR Python library folder in order to import the rpr,rprs,rprgltf modules.
13-
sys.path.insert(1, '../../python/build/Release')
22+
if sys.platform == "win32":
23+
sys.path.insert(1, '../../python/build/Release')
24+
1425

1526
# we need to add the RPR DLLs
16-
os.add_dll_directory( os.path.abspath(os.path.dirname(__file__) + '../../../RadeonProRender/binWin64') )
27+
if sys.platform == "win32":
28+
os.add_dll_directory( os.path.abspath(os.path.dirname(__file__) + '../../../RadeonProRender/' + binFolder ) )
1729

30+
1831
import rpr
1932
import rprs
2033
import ctypes
@@ -34,7 +47,7 @@ def RPRCHECK(retCode):
3447

3548

3649

37-
plugin_id = rpr.RegisterPlugin((str("../../RadeonProRender/binWin64/Northstar64.dll")))
50+
plugin_id = rpr.RegisterPlugin((str("../../RadeonProRender/"+binFolder+"/Northstar64.dll")))
3851
if ( plugin_id == -1 ):
3952
print(f"RPR ERROR: plugin not found.")
4053
exit()

0 commit comments

Comments
 (0)