Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
ccbc16f3
Commit
ccbc16f3
authored
Mar 15, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: clean unreferenced functions from OpenCV modules too
parent
ec469b55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
OpenCVCompilerOptions.cmake
cmake/OpenCVCompilerOptions.cmake
+18
-6
No files found.
cmake/OpenCVCompilerOptions.cmake
View file @
ccbc16f3
...
@@ -179,12 +179,24 @@ if(CV_GCC OR CV_CLANG)
...
@@ -179,12 +179,24 @@ if(CV_GCC OR CV_CLANG)
string
(
REPLACE
"-ffunction-sections"
""
${
flags
}
"
${${
flags
}}
"
)
string
(
REPLACE
"-ffunction-sections"
""
${
flags
}
"
${${
flags
}}
"
)
string
(
REPLACE
"-fdata-sections"
""
${
flags
}
"
${${
flags
}}
"
)
string
(
REPLACE
"-fdata-sections"
""
${
flags
}
"
${${
flags
}}
"
)
endforeach
()
endforeach
()
elseif
(
NOT
((
IOS OR ANDROID
)
AND NOT BUILD_SHARED_LIBS
)
AND NOT MSVC
)
else
()
# Remove unreferenced functions: function level linking
if
(
MSVC
)
add_extra_compiler_option
(
-ffunction-sections
)
# TODO: Clang/C2 is not supported
add_extra_compiler_option
(
-fdata-sections
)
elseif
(((
IOS OR ANDROID
)
AND NOT BUILD_SHARED_LIBS
)
AND NOT OPENCV_FORCE_FUNCTIONS_SECTIONS
)
if
(
NOT APPLE AND NOT OPENCV_SKIP_GC_SECTIONS
)
# don't create separate sections for functions/data, reduce package size
set
(
OPENCV_EXTRA_EXE_LINKER_FLAGS
"
${
OPENCV_EXTRA_EXE_LINKER_FLAGS
}
-Wl,--gc-sections"
)
else
()
# Remove unreferenced functions: function level linking
add_extra_compiler_option
(
-ffunction-sections
)
add_extra_compiler_option
(
-fdata-sections
)
if
(
NOT OPENCV_SKIP_GC_SECTIONS
)
if
(
APPLE
)
set
(
OPENCV_EXTRA_EXE_LINKER_FLAGS
"
${
OPENCV_EXTRA_EXE_LINKER_FLAGS
}
-Wl,-dead_strip"
)
set
(
OPENCV_EXTRA_SHARED_LINKER_FLAGS
"
${
OPENCV_EXTRA_SHARED_LINKER_FLAGS
}
-Wl,-dead_strip"
)
else
()
set
(
OPENCV_EXTRA_EXE_LINKER_FLAGS
"
${
OPENCV_EXTRA_EXE_LINKER_FLAGS
}
-Wl,--gc-sections"
)
set
(
OPENCV_EXTRA_SHARED_LINKER_FLAGS
"
${
OPENCV_EXTRA_SHARED_LINKER_FLAGS
}
-Wl,--gc-sections"
)
endif
()
endif
()
endif
()
endif
()
endif
()
endif
()
...
...
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