Adds the ENABLE_SHARED_LIBRARIES CMake option.
The use of shared libraries makes compilation debug versions faster but results in extra shared libraries. For installation this is not practical since the libraries need to be given SONAMES and kept in sync. Therefore installation is not supported for this option and will probably fail. The statistics for the change are: Static build: - Normal: real 20m51.604s user 19m47.838s sys 1m5.100s size 94MB - Debug: real 24m48.577s user 23m3.114s sys 1m22.305s size 1.9GB Shared build: - Normal: real 21m5.141s user 19m56.879s sys 1m7.692s size 29MB - Debug: real 24m24.239s user 22m55.278s sys 1m20.193s size 596MB So the build times don't change that much but the sizes do. When rebuilding after changing a file the build times start to improve for the shared build, but not timing done.
This commit is contained in:
parent
9679d734f1
commit
f42e941975
3 changed files with 21 additions and 3 deletions
|
@ -80,6 +80,13 @@ option(ENABLE_NLS "Enable building of translations" ON)
|
|||
option(ENABLE_LOW_MEM "Reduce memory usage by removing extra functionality" OFF)
|
||||
option(ENABLE_OMP "Enables OpenMP, and has additional dependencies" OFF)
|
||||
|
||||
# The use of shared libraries makes compilation debug versions faster but
|
||||
# results in extra shared libraries. For installation this is not practical
|
||||
# since the libraries need to be given SONAMES and kept in sync. Therefore
|
||||
# installation is not supported for this option and will probably fail.
|
||||
set(ENABLE_SHARED_LIBRARIES OFF CACHE BOOL "Enables shared libraries, this option is meant for development only, installation is *NOT* supported")
|
||||
mark_as_advanced(on ENABLE_SHARED_LIBRARIES)
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT CYGWIN)
|
||||
option(ENABLE_DESKTOP_ENTRY "enable installation of desktop entry files" ON)
|
||||
set(ICONDIR "${DATAROOTDIR}/pixmaps" CACHE STRING "Sets the icon directory for desktop entry to a non-default location.")
|
||||
|
|
|
@ -309,6 +309,7 @@ Version 1.11.0-svn:
|
|||
* Added: Helper code to make it easier to write enumerate stream operators.
|
||||
* Added: UNREACHABLE_CODE macro.
|
||||
* Added: TELEPORT animation macros usable by any units
|
||||
* Added: CMake option ENABLE_SHARED_LIBRARIES.
|
||||
|
||||
Version 1.10.0:
|
||||
* Campaigns:
|
||||
|
|
|
@ -202,6 +202,16 @@ if(MSVC)
|
|||
endif(MSVC)
|
||||
|
||||
|
||||
|
||||
########### Set Library mode ###############
|
||||
|
||||
if(ENABLE_SHARED_LIBRARIES)
|
||||
set(LIBRARY_TYPE SHARED)
|
||||
else(ENABLE_SHARED_LIBRARIES)
|
||||
set(LIBRARY_TYPE STATIC)
|
||||
endif(ENABLE_SHARED_LIBRARIES)
|
||||
|
||||
|
||||
########### libwesnoth-core ###############
|
||||
|
||||
set(libwesnoth-core_STAT_SRC
|
||||
|
@ -228,7 +238,7 @@ set(libwesnoth-core_STAT_SRC
|
|||
|
||||
# a 'lib' is automatically set in front when creating the library (as in the filename)
|
||||
# internal reference is the name given here
|
||||
add_library(wesnoth-core STATIC EXCLUDE_FROM_ALL ${libwesnoth-core_STAT_SRC})
|
||||
add_library(wesnoth-core ${LIBRARY_TYPE} EXCLUDE_FROM_ALL ${libwesnoth-core_STAT_SRC})
|
||||
|
||||
if(UPDATE_REVISION)
|
||||
add_dependencies(wesnoth-core update_revision)
|
||||
|
@ -283,7 +293,7 @@ endif(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
|||
|
||||
# a 'lib' is automatically set in front when creating the library (as in the filename)
|
||||
# internal reference is the name given here
|
||||
add_library(wesnoth-lua STATIC EXCLUDE_FROM_ALL ${libwesnoth-lua_STAT_SRC})
|
||||
add_library(wesnoth-lua ${LIBRARY_TYPE} EXCLUDE_FROM_ALL ${libwesnoth-lua_STAT_SRC})
|
||||
|
||||
|
||||
########### Old style cast flags ###############
|
||||
|
@ -711,7 +721,7 @@ endif(ENABLE_GAME AND ENABLE_TESTS)
|
|||
|
||||
# a 'lib' is automatically set in front when creating the library (as in the filename)
|
||||
# internal reference is the name given here
|
||||
add_library(wesnoth-game STATIC EXCLUDE_FROM_ALL ${libwesnoth-game_STAT_SRC})
|
||||
add_library(wesnoth-game ${LIBRARY_TYPE} EXCLUDE_FROM_ALL ${libwesnoth-game_STAT_SRC})
|
||||
|
||||
if(ENABLE_GAME AND ENABLE_TESTS)
|
||||
target_link_libraries(wesnoth-game
|
||||
|
|
Loading…
Add table
Reference in a new issue