Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
e9888429
Unverified
Commit
e9888429
authored
Apr 13, 2021
by
Paul Fultz II
Committed by
GitHub
Apr 13, 2021
Browse files
Create .o files in the build directory (#796)
parent
6d937d80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
cmake/Embed.cmake
cmake/Embed.cmake
+8
-7
No files found.
cmake/Embed.cmake
View file @
e9888429
...
...
@@ -54,19 +54,20 @@ const std::unordered_map<std::string, std::pair<const char*,const char*>>& ${EMB
endfunction
()
function
(
embed_file OUTPUT_FILE OUTPUT_SYMBOL FILE
)
set
(
${
OUTPUT_FILE
}
"
${
FILE
}
.o"
PARENT_SCOPE
)
set
(
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
set
(
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
# Glob is used to compute the relative path
get_filename_component
(
OUTPUT_FILE_DIR
"
${
FILE
}
"
DIRECTORY
)
file
(
MAKE_DIRECTORY
"
${
WORKING_DIRECTORY
}
/
${
OUTPUT_FILE_DIR
}
"
)
file
(
GLOB FILES RELATIVE
${
WORKING_DIRECTORY
}
${
FILE
}
)
foreach
(
REL_FILE
${
FILES
}
)
string
(
MAKE_C_IDENTIFIER
"
${
REL_FILE
}
"
SYMBOL
)
get_filename_component
(
OUTPUT_FILE_DIR
"
${
REL_FILE
}
"
DIRECTORY
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
OUTPUT_FILE_DIR
}
"
)
set
(
OUT_FILE
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
REL_FILE
}
.o"
)
set
(
${
OUTPUT_SYMBOL
}
${
SYMBOL
}
PARENT_SCOPE
)
set
(
${
OUTPUT_FILE
}
"
${
OUT_FILE
}
"
PARENT_SCOPE
)
add_custom_command
(
OUTPUT
"
${
FILE
}
.o
"
COMMAND
${
EMBED_LD
}
-r -o
"
${
FILE
}
.o
"
-z noexecstack --format=binary
"
${
REL_FILE
}
"
COMMAND
${
EMBED_OBJCOPY
}
--rename-section .data=.rodata,alloc,load,readonly,data,contents
"
${
FILE
}
.o
"
OUTPUT
"
${
OUT_
FILE
}
"
COMMAND
${
EMBED_LD
}
-r -o
"
${
OUT_
FILE
}
"
-z noexecstack --format=binary
"
${
REL_FILE
}
"
COMMAND
${
EMBED_OBJCOPY
}
--rename-section .data=.rodata,alloc,load,readonly,data,contents
"
${
OUT_
FILE
}
"
WORKING_DIRECTORY
${
WORKING_DIRECTORY
}
DEPENDS
${
FILE
}
VERBATIM
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment