Skip to content

Commit d14726e

Browse files
committed
cmake - improve NO_ENCRYPT flag
1 parent 24fb85b commit d14726e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ include(${CMAKE_SOURCE_DIR}/contrib/Orochi/Orochi/enable_cuew.cmake)
247247

248248
# Base output directory
249249
set(BASE_OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dist/bin)
250+
file(MAKE_DIRECTORY "${BASE_OUTPUT_DIR}/Debug")
251+
file(MAKE_DIRECTORY "${BASE_OUTPUT_DIR}/Release")
250252

251253
# Set output directories for each build configuration
252254
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} Debug Release RelWithDebInfo MinSizeRel)
@@ -293,6 +295,9 @@ endif()
293295

294296
if(NOT NO_ENCRYPT)
295297
target_compile_definitions(${HIPRT_NAME} PRIVATE HIPRT_ENCRYPT )
298+
set(ENV{HIPRT_NO_ENCRYPT} "OFF")
299+
else()
300+
set(ENV{HIPRT_NO_ENCRYPT} "ON")
296301
endif()
297302

298303
if(HIPRT_PREFER_HIP_5)

tools/stringify.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
defines = {}
1111
replaced = []
1212

13+
# A classic usage is to have this optional temporary env var created during the cmake process (through the 'NO_ENCRYPT' cmake option) before calling this python script.
14+
# If this env var is ON, it overides the encyption and disable it.
15+
no_encrypt = os.getenv('HIPRT_NO_ENCRYPT') == 'ON'
16+
1317
def encrypt(message, key):
1418
file = open('./tmp.txt',mode='w')
1519
file.write(message)
@@ -81,7 +85,7 @@ def printfile(filename, ans, enablePrint, api):
8185
if( ekey != '' ):
8286
b = a
8387
else:
84-
b = ('"'+a.replace("\"", "\\\"").replace("'", "\\'") + '\\n"')
88+
b = ('"'+a.replace("\\", "\\\\").replace("\"", "\\\"").replace("'", "\\'") + '\\n"')
8589
ans += ''+b+'\n'
8690
return ans
8791

@@ -109,6 +113,9 @@ def stringify(filename, stringname, api):
109113

110114
if len(argvs) >= 3:
111115
ekey = argvs[2]
116+
if no_encrypt:
117+
ekey = ''
118+
112119

113120
#files = ['IntegratorGpuLightSamplerTestKernel.cl','Math.cl']
114121

0 commit comments

Comments
 (0)