Skip to content

Commit

Permalink
Revert GLES3 changes for OSMesa in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tdcosta100 authored and acalcutt committed Apr 27, 2023
1 parent 624c6d5 commit 8edca4c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion platform/node/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function(add_node_module NAME)
TARGET ${_TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/libglapi.dll" "${_OUTPUT_PATH}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/libGLESv3.dll" "${_OUTPUT_PATH}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/libGLESv2.dll" "${_OUTPUT_PATH}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/osmesa.dll" "${_OUTPUT_PATH}"
)
endif()
Expand Down
18 changes: 9 additions & 9 deletions platform/windows/FindOSMesa.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ else()
endif()

find_library(OSMesa_osmesa_LIBRARY NAMES osmesa PATHS ${OSMesa_DIR}/lib PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_library(OSMesa_libGLESv3_LIBRARY NAMES libGLESv3 PATHS ${OSMesa_DIR}/lib PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_library(OSMesa_libGLESv2_LIBRARY NAMES libGLESv2 PATHS ${OSMesa_DIR}/lib PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)

find_file(OSMesa_osmesa_LIBRARY_DLL NAMES osmesa.dll PATHS ${OSMesa_DIR} PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_file(OSMesa_libGLESv3_LIBRARY_DLL NAMES libGLESv3.dll PATHS ${OSMesa_DIR} PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_file(OSMesa_libGLESv2_LIBRARY_DLL NAMES libGLESv2.dll PATHS ${OSMesa_DIR} PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)

unset(_ARCH)

Expand All @@ -29,18 +29,18 @@ include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSMesa
REQUIRED_VARS
OSMesa_osmesa_LIBRARY
OSMesa_libGLESv3_LIBRARY
OSMesa_libGLESv2_LIBRARY
OSMesa_INCLUDE_DIR)

# Hide internal variables
mark_as_advanced(OSMesa_INCLUDE_DIR OSMesa_osmesa_LIBRARY OSMesa_libGLESv3_LIBRARY)
mark_as_advanced(OSMesa_INCLUDE_DIR OSMesa_osmesa_LIBRARY OSMesa_libGLESv2_LIBRARY)

# Set standard variables
if(OSMesa_FOUND)
set(OSMesa_INCLUDE_DIRS "${OSMesa_INCLUDE_DIR}")
set(OSMesa_LIBRARIES
"${OSMesa_osmesa_LIBRARY}"
"${OSMesa_libGLESv3_LIBRARY}"
"${OSMesa_libGLESv2_LIBRARY}"
)

add_library(OSMesa::osmesa SHARED IMPORTED)
Expand All @@ -53,13 +53,13 @@ if(OSMesa_FOUND)
IMPORTED_LOCATION ${OSMesa_osmesa_LIBRARY_DLL}
)

add_library(OSMesa::libGLESv3 SHARED IMPORTED)
add_library(OSMesa::libGLESv2 SHARED IMPORTED)

set_target_properties(
OSMesa::libGLESv3
OSMesa::libGLESv2
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${OSMesa_INCLUDE_DIRS}
IMPORTED_IMPLIB ${OSMesa_libGLESv3_LIBRARY}
IMPORTED_LOCATION ${OSMesa_libGLESv3_LIBRARY_DLL}
IMPORTED_IMPLIB ${OSMesa_libGLESv2_LIBRARY}
IMPORTED_LOCATION ${OSMesa_libGLESv2_LIBRARY_DLL}
)
endif()
2 changes: 1 addition & 1 deletion platform/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ To configure build with OSMesa (software rendering), use the following command:
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DMBGL_WITH_OSMESA=ON
```

**WARNING:** as OSMesa doesn't have static libraries, it's necessary to copy `libglapi.dll`, `libGLESv3.dll` and `osmesa.dll` from `platform\windows\vendor\mesa3d\<arch>` to executable/dll directory you want to use, otherwise it won't run.
**WARNING:** as OSMesa doesn't have static libraries, it's necessary to copy `libglapi.dll`, `libGLESv2.dll` and `osmesa.dll` from `platform\windows\vendor\mesa3d\<arch>` to executable/dll directory you want to use, otherwise it won't run.

## Building

Expand Down
4 changes: 2 additions & 2 deletions platform/windows/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if(MBGL_WITH_EGL)
mbgl-core
PRIVATE
unofficial::angle::libEGL
unofficial::angle::libGLESv3
unofficial::angle::libGLESv2
)
elseif(MBGL_WITH_OSMESA)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
Expand All @@ -114,7 +114,7 @@ elseif(MBGL_WITH_OSMESA)
mbgl-core
PRIVATE
OSMesa::osmesa
OSMesa::libGLESv3
OSMesa::libGLESv2
)
else()
find_package(OpenGL REQUIRED)
Expand Down

0 comments on commit 8edca4c

Please sign in to comment.