Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ec97ac41
Commit
ec97ac41
authored
Mar 06, 2014
by
Leif Walsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added optimization for normal static libraries Tokutek/mongo#983
parent
92eae38a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
14 deletions
+29
-14
cmake/merge_archives_unix.cmake.in
cmake/merge_archives_unix.cmake.in
+29
-14
No files found.
cmake/merge_archives_unix.cmake.in
View file @
ec97ac41
...
@@ -40,23 +40,38 @@ FOREACH(LIB ${STATIC_LIBS})
...
@@ -40,23 +40,38 @@ FOREACH(LIB ${STATIC_LIBS})
)
)
STRING(REGEX REPLACE "\n" ";" LIB_OBJ_LIST "${LIB_OBJS}")
STRING(REGEX REPLACE "\n" ";" LIB_OBJ_LIST "${LIB_OBJS}")
STRING(REGEX REPLACE ";$" "" LIB_OBJ_LIST "${LIB_OBJ_LIST}")
STRING(REGEX REPLACE ";$" "" LIB_OBJ_LIST "${LIB_OBJ_LIST}")
LIST(SORT LIB_OBJ_LIST)
SET(SAME_OBJ_COUNT 1)
LIST(LENGTH LIB_OBJ_LIST LENGTH_WITH_DUPS)
SET(LAST_OBJ_NAME)
SET(LIB_OBJ_LIST_NO_DUPS ${LIB_OBJ_LIST})
FOREACH(OBJ ${LIB_OBJ_LIST})
LIST(REMOVE_DUPLICATES LIB_OBJ_LIST_NO_DUPS)
IF(OBJ STREQUAL LAST_OBJ_NAME)
LIST(LENGTH LIB_OBJ_LIST_NO_DUPS LENGTH_WITHOUT_DUPS)
GET_FILENAME_COMPONENT(OBJ_NO_EXT ${OBJ} NAME_WE)
FILE(RENAME "${TEMP_SUBDIR}/${OBJ}" "${TEMP_SUBDIR}/${OBJ_NO_EXT}.${SAME_OBJ_COUNT}.o")
IF(LENGTH_WITH_DUPS EQUAL LENGTH_WITHOUT_DUPS)
MATH(EXPR SAME_OBJ_COUNT "${SAME_OBJ_COUNT}+1")
# Optimization for when lib doesn't actually have duplicate object
ELSE()
# names, we can just extract everything.
SET(SAME_OBJ_COUNT 1)
ENDIF()
SET(LAST_OBJ_NAME "${OBJ}")
EXECUTE_PROCESS(
EXECUTE_PROCESS(
COMMAND ${CMAKE_AR} -x
N ${SAME_OBJ_COUNT} ${LIB} ${OBJ
}
COMMAND ${CMAKE_AR} -x
${LIB
}
WORKING_DIRECTORY ${TEMP_SUBDIR}
WORKING_DIRECTORY ${TEMP_SUBDIR}
)
)
ENDFOREACH()
ELSE()
LIST(SORT LIB_OBJ_LIST)
SET(SAME_OBJ_COUNT 1)
SET(LAST_OBJ_NAME)
FOREACH(OBJ ${LIB_OBJ_LIST})
IF(OBJ STREQUAL LAST_OBJ_NAME)
GET_FILENAME_COMPONENT(OBJ_NO_EXT ${OBJ} NAME_WE)
FILE(RENAME "${TEMP_SUBDIR}/${OBJ}" "${TEMP_SUBDIR}/${OBJ_NO_EXT}.${SAME_OBJ_COUNT}.o")
MATH(EXPR SAME_OBJ_COUNT "${SAME_OBJ_COUNT}+1")
ELSE()
SET(SAME_OBJ_COUNT 1)
ENDIF()
SET(LAST_OBJ_NAME "${OBJ}")
EXECUTE_PROCESS(
COMMAND ${CMAKE_AR} -xN ${SAME_OBJ_COUNT} ${LIB} ${OBJ}
WORKING_DIRECTORY ${TEMP_SUBDIR}
)
ENDFOREACH()
ENDIF()
FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*.o")
FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*.o")
SET(OBJECTS ${OBJECTS} ${LIB_OBJECTS})
SET(OBJECTS ${OBJECTS} ${LIB_OBJECTS})
...
...
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