Skip to content

Commit

Permalink
GCC14: Fix linux use of lib64 libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
perroboc committed Sep 4, 2024
1 parent 373b262 commit 68ca5b9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
83 changes: 45 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 <SOURCE_DIR>/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 <SOURCE_DIR>/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()

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions docs/Development/HowToBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down

0 comments on commit 68ca5b9

Please sign in to comment.