Skip to content

Commit

Permalink
Do no link binaries with Qt where it's not used
Browse files Browse the repository at this point in the history
Define components_qt static library with all qt dependent components that also
depends on other components. Link only cs, wizard and launcher with qt
dependent components.
  • Loading branch information
elsid committed Aug 20, 2021
1 parent 6360bdc commit e9b8933
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Bug #5379: Wandering NPCs falling through cantons
Bug #5453: Magic effect VFX are offset for creatures
Bug #5483: AutoCalc flag is not used to calculate spells cost
Bug #5508: Engine binary links to Qt without using it
Bug #5755: Active grid object paging - disappearing textures
Bug #5788: Texture editing parses the selected indexes wrongly
Bug #5842: GetDisposition adds temporary disposition change from different actors
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ endif()

# Components
add_subdirectory (components)
target_compile_definitions(components PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")

# Apps and tools
if (BUILD_OPENMW)
Expand Down
2 changes: 1 addition & 1 deletion apps/launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ endif (WIN32)
target_link_libraries(openmw-launcher
${SDL2_LIBRARY_ONLY}
${OPENAL_LIBRARY}
components
components_qt
)

target_link_libraries(openmw-launcher Qt5::Widgets Qt5::Core)
Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ target_link_libraries(openmw-cs
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
components
components_qt
)

if(OSG_STATIC)
Expand Down
2 changes: 1 addition & 1 deletion apps/wizard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ openmw_add_executable(openmw-wizard
)

target_link_libraries(openmw-wizard
components
components_qt
)

target_link_libraries(openmw-wizard Qt5::Widgets Qt5::Core)
Expand Down
2 changes: 1 addition & 1 deletion cmake/OpenMWMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ foreach (u ${ARGN})
file (GLOB ALL "${dir}/${u}.[ch]pp")
foreach (f ${ALL})
list (APPEND files "${f}")
list (APPEND COMPONENT_FILES "${f}")
list (APPEND COMPONENT_QT_FILES "${f}")
endforeach (f)
file (GLOB MOC_H "${dir}/${u}.hpp")
foreach (fi ${MOC_H})
Expand Down
8 changes: 5 additions & 3 deletions components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ if (USE_QT)
processinvoker
)

add_component_dir (misc
add_component_qt_dir (misc
helpviewer
)

Expand All @@ -233,7 +233,7 @@ endif ()

include_directories(${BULLET_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})

add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR})
add_library(components STATIC ${COMPONENT_FILES})

target_link_libraries(components
# CMake's built-in OSG finder does not use pkgconfig, so we have to
Expand Down Expand Up @@ -276,7 +276,9 @@ if (WIN32)
endif()

if (USE_QT)
target_link_libraries(components Qt5::Widgets Qt5::Core)
add_library(components_qt STATIC ${COMPONENT_QT_FILES} ${MOC_SRCS} ${ESM_UI_HDR})
target_link_libraries(components_qt components Qt5::Widgets Qt5::Core)
target_compile_definitions(components_qt PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
endif()

if (GIT_CHECKOUT)
Expand Down

0 comments on commit e9b8933

Please sign in to comment.