Browse Source

Add cotire (compile time reducer) to CMake

https://github.com/sakra/cotire

Currently we only use it for precompiled headers for Audacity src.
There is a 'unity' build, but it needs work by us to fix it for duplicate
definition.
au-ny-api
James Crook 4 years ago
parent
commit
94a731982d
  1. 3
      CMakeLists.txt
  2. 4190
      cmake-proxies/cmake-modules/cotire.cmake
  3. 33
      src/CMakeLists.txt

3
CMakeLists.txt

@ -5,6 +5,9 @@ cmake_policy(SET CMP0043 NEW) # just hide an annoying warning in 3.0.2
# There must be a symbol for this already, surely?
set( top_dir ${CMAKE_SOURCE_DIR} )
set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake-proxies/cmake-modules)
include(cotire)
# These stop the results being mixed in with our source tree.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

4190
cmake-proxies/cmake-modules/cotire.cmake
File diff suppressed because it is too large
View File

33
src/CMakeLists.txt

@ -80,11 +80,11 @@ add_compile_options(/wd4996)
set( SOURCE
${CMAKE_SOURCE_DIRECTORY}AudacityHeaders.cpp #first so cotire can precompile
${CMAKE_SOURCE_DIRECTORY}AboutDialog.cpp
${CMAKE_SOURCE_DIRECTORY}AColor.cpp
${CMAKE_SOURCE_DIRECTORY}AudacityApp.cpp
${CMAKE_SOURCE_DIRECTORY}AudacityException.cpp
${CMAKE_SOURCE_DIRECTORY}AudacityHeaders.cpp
${CMAKE_SOURCE_DIRECTORY}AudacityLogger.cpp
${CMAKE_SOURCE_DIRECTORY}AudioIO.cpp
${CMAKE_SOURCE_DIRECTORY}AutoRecovery.cpp
@ -488,4 +488,33 @@ set( SOURCE
add_executable( Audacity ${SOURCE} )
target_link_libraries(Audacity ${wxWidgets_LIBRARIES})
target_link_libraries(Audacity ${wxWidgets_LIBRARIES})
#Use cotire to get precompiled headers, and a unity build.
set_target_properties(Audacity
PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT
"AudacityHeaders.h")
cotire(Audacity)
# (commented out) Debugging info for the curious about Cotire.
#[[
# cotire sets the following properties
get_target_property(_unitySource Audacity COTIRE_CXX_UNITY_SOURCE)
get_target_property(_prefixHeader Audacity COTIRE_CXX_PREFIX_HEADER)
get_target_property(_precompiledHeader Audacity COTIRE_CXX_PRECOMPILED_HEADER)
get_target_property(_unityTargetName Audacity COTIRE_UNITY_TARGET_NAME)
if (_unitySource)
message(STATUS "Audacity unity source: ${_unitySource}")
endif()
if (_prefixHeader)
message(STATUS "Audacity prefix header: ${_prefixHeader}")
endif()
if (_precompiledHeader)
message(STATUS "Audacity precompiled header: ${_precompiledHeader}")
endif()
if (TARGET ${_unityTargetName})
message(STATUS "Audacity unity target: ${_unityTargetName}")
endif()
]]#
Loading…
Cancel
Save