@@ -10,32 +10,69 @@ def get_extensions():
10
10
extension = CppExtension
11
11
12
12
extra_link_args = []
13
- extra_compile_args = {
14
- "cxx" : [
15
- "-O3" ,
16
- "-std=c++17" ,
17
- "-fdiagnostics-color=always" ,
18
- ]
19
- }
20
- debug_mode = os .getenv ("DEBUG" , "0" ) == "1"
21
- if debug_mode :
22
- logging .info ("Compiling in debug mode" )
13
+
14
+ # Debug output
15
+ print (f"DEBUG: Platform detected: { sys .platform } " )
16
+ print (f"DEBUG: Platform == 'win32': { sys .platform == 'win32' } " )
17
+
18
+ # Platform-specific compiler flags
19
+ if sys .platform == "win32" :
20
+ print ("DEBUG: Using MSVC flags for Windows" )
21
+ # MSVC flags for Windows
22
+ extra_compile_args = {
23
+ "cxx" : [
24
+ "/O2" , # Optimization level 2 (equivalent to -O3)
25
+ "/std:c++17" , # C++17 standard
26
+ "/EHsc" , # Exception handling model
27
+ ]
28
+ }
29
+ debug_mode = os .getenv ("DEBUG" , "0" ) == "1"
30
+ if debug_mode :
31
+ logging .info ("Compiling in debug mode" )
32
+ extra_compile_args = {
33
+ "cxx" : [
34
+ "/Od" , # No optimization (equivalent to -O0)
35
+ "/Zi" , # Generate debug info
36
+ "/std:c++17" , # C++17 standard
37
+ "/EHsc" , # Exception handling model
38
+ ]
39
+ }
40
+ extra_link_args = ["/DEBUG" ]
41
+ else :
42
+ print ("DEBUG: Using GCC/Clang flags for Unix-like systems" )
43
+ # GCC/Clang flags for Unix-like systems
23
44
extra_compile_args = {
24
45
"cxx" : [
25
- "-O0" ,
26
- "-fno-inline" ,
27
- "-g" ,
46
+ "-O3" ,
28
47
"-std=c++17" ,
29
48
"-fdiagnostics-color=always" ,
30
49
]
31
50
}
32
- extra_link_args = ["-O0" , "-g" ]
51
+ debug_mode = os .getenv ("DEBUG" , "0" ) == "1"
52
+ if debug_mode :
53
+ logging .info ("Compiling in debug mode" )
54
+ extra_compile_args = {
55
+ "cxx" : [
56
+ "-O0" ,
57
+ "-fno-inline" ,
58
+ "-g" ,
59
+ "-std=c++17" ,
60
+ "-fdiagnostics-color=always" ,
61
+ ]
62
+ }
63
+ extra_link_args = ["-O0" , "-g" ]
64
+
65
+ print (f"DEBUG: Extra compile args: { extra_compile_args } " )
66
+ print (f"DEBUG: Extra link args: { extra_link_args } " )
33
67
34
68
extensions_dir = "torchrl/csrc"
35
69
36
70
# Get just the filenames, not full paths
37
71
cpp_files = glob .glob (os .path .join (extensions_dir , "*.cpp" ))
38
72
sources = [os .path .relpath (f ) for f in cpp_files ]
73
+ print (f"DEBUG: C++ source files: { sources } " )
74
+ print (f"DEBUG: Extensions directory exists: { os .path .exists (extensions_dir )} " )
75
+ print (f"DEBUG: Contents of { extensions_dir } : { os .listdir (extensions_dir ) if os .path .exists (extensions_dir ) else 'Directory not found' } " )
39
76
40
77
include_dirs = ["." ]
41
78
python_include_dir = os .getenv ("PYTHON_INCLUDE_DIR" )
@@ -51,14 +88,23 @@ def get_extensions():
51
88
)
52
89
]
53
90
91
+ print (f"DEBUG: Extension modules: { ext_modules } " )
54
92
return ext_modules
55
93
56
94
def main ():
95
+ print ("DEBUG: Starting setup.py main function" )
57
96
setup_kwargs = {
58
97
"ext_modules" : get_extensions (),
59
98
"cmdclass" : {"build_ext" : BuildExtension .with_options ()},
99
+ "packages" : ["torchrl" ],
100
+ "package_data" : {
101
+ "torchrl" : ["version.py" ],
102
+ },
103
+ "include_package_data" : True ,
104
+ "zip_safe" : False ,
60
105
}
61
106
107
+ print (f"DEBUG: Setup kwargs: { setup_kwargs } " )
62
108
setup (** setup_kwargs )
63
109
64
110
if __name__ == "__main__" :
0 commit comments