From 68ca5b9df69c3968f8593cde60a6f59b68f39f55 Mon Sep 17 00:00:00 2001 From: perroboc <2722773+perroboc@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:34:55 -0400 Subject: [PATCH] GCC14: Fix linux use of lib64 libraries --- .github/workflows/build.yml | 2 +- CMakeLists.txt | 83 ++++++++++++++++++---------------- docs/Development/HowToBuild.md | 4 +- 3 files changed, 48 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 081968a1fb..5363d82bf6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -134,7 +134,7 @@ jobs: wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list sudo apt-get update - sudo apt-get install -y libglfw3-dev libpulse-dev libglvnd-dev libx11-dev libopenal-dev libvulkan-dev \ + sudo apt-get install -y libpulse-dev libglvnd-dev libx11-dev libopenal-dev libvulkan-dev \ libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libgtk-3-dev ninja-build dotnet-sdk-3.1 \ xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev libxkbcommon-x11-dev zenity diff --git a/CMakeLists.txt b/CMakeLists.txt index d511f86fa1..1a18342d49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,9 +238,16 @@ if(BUILD_VIEWER) ) list(APPEND EFK_THIRDPARTY_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libpng/include) list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libpng/lib) + + if(WIN32 OR APPLE) + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libpng/lib) + else() + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libpng/lib64) + endif() if(MSVC) set(LIBPNG_LIB_DEBUG "libpng16_staticd") + set(LIBPNG_LIB_RELEASE "libpng16_static") elseif(BUILD_WITH_POSTFIX) set(LIBPNG_LIB_DEBUG "png16d") @@ -281,7 +288,12 @@ if(BUILD_VIEWER) endif() list(APPEND EFK_THIRDPARTY_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libgd/include) - list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libgd/lib) + if(WIN32 OR APPLE) + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libgd/lib) + else() + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/libgd/lib64) + endif() + # OpenSoundMixer ExternalProject_Add( @@ -311,23 +323,28 @@ endif() if(BUILD_VIEWER OR BUILD_TEST) # glew if(NOT APPLE) - ExternalProject_Add( - ExternalProject_glew - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Downloads/glew - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Build/glew - INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew - PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Dev/3rdPartyPatch/glew-CMakeLists.txt /CMakeLists.txt - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew - -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_CURRENT_SOURCE_DIR}/Dev/CFlagOverrides.cmake - -DEFK_USE_MSVC_RUNTIME_LIBRARY_DLL=${USE_MSVC_RUNTIME_LIBRARY_DLL} - -DSANITIZE_ENABLED=${SANITIZE_ENABLED} - -DBUILD_SHARED_LIBS=OFF - -DGLEW_BUILD_INFO=OFF - -DBUILD_UTILS=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true - ) - list(APPEND EFK_THIRDPARTY_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew/include) - list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew/lib) + ExternalProject_Add( + ExternalProject_glew + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Downloads/glew + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Build/glew + INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew + PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Dev/3rdPartyPatch/glew-CMakeLists.txt /CMakeLists.txt + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew + -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_CURRENT_SOURCE_DIR}/Dev/CFlagOverrides.cmake + -DEFK_USE_MSVC_RUNTIME_LIBRARY_DLL=${USE_MSVC_RUNTIME_LIBRARY_DLL} + -DSANITIZE_ENABLED=${SANITIZE_ENABLED} + -DBUILD_SHARED_LIBS=OFF + -DGLEW_BUILD_INFO=OFF + -DBUILD_UTILS=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true + ) + list(APPEND EFK_THIRDPARTY_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew/include) + if(WIN32 OR APPLE) + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew/lib) + else() + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glew/lib64) + endif() + endif() endif() @@ -350,30 +367,20 @@ if(BUILD_VIEWER OR BUILD_EXAMPLES OR BUILD_TEST) -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true ) - - - # Check for glfw3 - if(WIN32 OR APPLE) - if(BUILD_WITH_POSTFIX) - set(GLFW3_LIB_DEBUG "glfw3d") - set(GLFW3_LIB_RELEASE "glfw3") - else() - set(GLFW3_LIB_DEBUG "glfw3") - set(GLFW3_LIB_RELEASE "glfw3") - endif() - else() - find_package(PkgConfig REQUIRED) - pkg_check_modules(GLFW3 glfw3) - set(GLFW3_LIB_DEBUG ${GLFW3_LIBRARIES}) - set(GLFW3_LIB_RELEASE ${GLFW3_LIBRARIES}) - endif() - if(BUILD_WITH_POSTFIX) - set(GLFW3_LIB_DEBUG "${GLFW3_LIB_DEBUG}d") + set(GLFW3_LIB_DEBUG "glfw3d") + set(GLFW3_LIB_RELEASE "glfw3") + else() + set(GLFW3_LIB_DEBUG "glfw3") + set(GLFW3_LIB_RELEASE "glfw3") endif() list(APPEND EFK_THIRDPARTY_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glfw/include) - list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glfw/lib) + if(WIN32 OR APPLE) + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glfw/lib) + else() + list(APPEND EFK_THIRDPARTY_LIBRARY_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Install/glfw/lib64) + endif() endif() list(APPEND EFK_THIRDPARTY_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/Dev/Cpp/3rdParty/flatbuffers/include) diff --git a/docs/Development/HowToBuild.md b/docs/Development/HowToBuild.md index bef93903e9..86194b74fe 100644 --- a/docs/Development/HowToBuild.md +++ b/docs/Development/HowToBuild.md @@ -32,8 +32,8 @@ Requirements - [.Net6.0 SDK](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu) - Required packages: - - Ubuntu: `libglfw3-dev libx11-dev libgl1-mesa-dev libxrandr-dev libxi-dev x11proto-xf86vidmode-dev libx11-xcb-dev xorg-dev libglu1-mesa-dev libpulse-dev libgtk-3-dev libopenal-dev python3-distutils zenity` - - On Fedora 40: `gtk3-devel pulseaudio-libs-devel openal-soft-devel mesa-libGLU-devel libX11-devel libxcb-devel libXi-devel libXrandr-devel mesa-libGL-devel glfw-devel gd-devel python3 dotnet zenity` + - Ubuntu: `libx11-dev libgl1-mesa-dev libxrandr-dev libxi-dev x11proto-xf86vidmode-dev libx11-xcb-dev xorg-dev libglu1-mesa-dev libpulse-dev libgtk-3-dev libopenal-dev python3-distutils zenity` + - Fedora 40: `gtk3-devel pulseaudio-libs-devel openal-soft-devel mesa-libGLU-devel libX11-devel libxcb-devel libXi-devel libXrandr-devel mesa-libGL-devel python3 dotnet zenity` Get code and resources ----------