Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes in CMake build in Linux devcontainer #68300

Merged
merged 4 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \

# [Optional] Uncomment this section to install additional packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends libsdl2-dev libsdl2-ttf-dev \
libsdl2-image-dev libsdl2-mixer-dev libfreetype6-dev build-essential astyle ccache
&& apt-get -y install --no-install-recommends libsdl2-dev libsdl2-ttf-dev libharfbuzz-dev \
libsdl2-image-dev libjpeg-turbo8-dev libtiff-dev libwebp-dev libzip-dev libzstd-dev \
libsdl2-mixer-dev libflac-dev libasound2-dev libfreetype6-dev build-essential astyle ccache

# [Optional] comment out this section unless you want to compile the Object Creator. Install some QT libraries
RUN apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/Find/FindSDL2_image.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ set(SDL2IMAGE_FOUND ${SDL2_IMAGE_FOUND})

mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR)

if(NOT DYNAMIC_LINKING AND PKGCONFIG_FOUND)
if(NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
if (NOT TARGET SDL2_image:SDL2_image-static)
add_library(SDL2_image::SDL2_image-static STATIC IMPORTED)
set_property(TARGET SDL2_image::SDL2_image-static
Expand Down
22 changes: 15 additions & 7 deletions CMakeModules/Find/FindSDL2_mixer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,30 @@ set(SDL2MIXER_FOUND ${SDL2_MIXER_FOUND})

mark_as_advanced(SDL2_MIXER_LIBRARY SDL2_MIXER_INCLUDE_DIR)

if(NOT DYNAMIC_LINKING AND PKGCONFIG_FOUND)
if(NOT DYNAMIC_LINKING)
if (NOT TARGET SDL2_mixer::SDL2_mixer-static)
add_library(SDL2_mixer::SDL2_mixer-static STATIC IMPORTED)
set_property(TARGET SDL2_mixer::SDL2_mixer-static
PROPERTY IMPORTED_LOCATION ${SDL2_MIXER_LIBRARY}
)
endif()
message(STATUS "Searching for SDL_mixer deps libraries --")
pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac)
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
PkgConfig::FLAC
)
elseif(NOT TARGET SDL2_mixer::SDL2_mixer)
add_library(SDL2_mixer::SDL2_mixer STATIC IMPORTED)
set_property(TARGET SDL2_mixer::SDL2_mixer
PROPERTY IMPORTED_LOCATION ${SDL2_MIXER_LIBRARY}
)
endif()

endif()
if(PKG_CONFIG_FOUND)
message(STATUS "Searching for SDL_mixer deps libraries --")
pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac)
if(TARGET SDL2_mixer::SDL2_mixer-static)
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
PkgConfig::FLAC
)
elseif(TARGET SDL2_mixer::SDL2_mixer)
target_link_libraries(SDL2_mixer::SDL2_mixer INTERFACE
PkgConfig::FLAC
)
endif()
endif()
2 changes: 1 addition & 1 deletion CMakeModules/Find/FindSDL2_ttf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ set(SDL2TTF_FOUND ${SDL2_TTF_FOUND})

mark_as_advanced(SDL2_TTF_LIBRARY SDL2_TTF_INCLUDE_DIR)

if (NOT DYNAMIC_LINKING AND PKGCONFIG_FOUND)
if (NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
if (NOT TARGET SDL2_ttf::SDL2_ttf-static)
add_library(SDL2_ttf::SDL2_ttf-static STATIC IMPORTED)
set_property(TARGET SDL2_ttf::SDL2_ttf-static
Expand Down
3 changes: 1 addition & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"description": "Target Linux (64-bit) with the GCC development environment.",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=mold",
"DYNAMIC_LINKING": "False", "CMAKE_BUILD_TYPE": "RelWithDebInfo",
"DYNAMIC_LINKING": "True", "CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CURSES": "False", "LOCALIZE": "True", "TILES": "True", "SOUND": "True", "TESTS": "False",
"CMAKE_INSTALL_MESSAGE": "NEVER"
}
Expand Down