mirror of https://github.com/aap/librw.git
cmake: nx toolchain has FindOpenGL module
This commit is contained in:
parent
60588b7192
commit
a20f9e738b
|
@ -90,12 +90,6 @@ if(LIBRW_INSTALL)
|
|||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake"
|
||||
)
|
||||
endif()
|
||||
if(NINTENDO_SWITCH)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_LIST_DIR}/cmake/nx/FindNXGL.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake"
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REPLACE "." ";" cmake_c_compiler_version_list "${CMAKE_C_COMPILER_VERSION}")
|
||||
list(GET cmake_c_compiler_version_list 0 cmake_c_compiler_version_major)
|
||||
|
|
|
@ -3,19 +3,17 @@ include("${CMAKE_CURRENT_LIST_DIR}/librw-targets.cmake")
|
|||
set(LIBRW_PLATFORM "@LIBRW_PLATFORM@")
|
||||
set(LIBRW_PLATFORMS "@LIBRW_PLATFORMS@")
|
||||
set(LIBRW_PLATFORM_@LIBRW_PLATFORM@ ON)
|
||||
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL @LIBRW_PLATFORM_GL3_REQUIRES_OPENGL@)
|
||||
|
||||
if(LIBRW_PLATFORM_GL3)
|
||||
set(LIBRW_GL3_GFXLIB "@LIBRW_GL3_GFXLIB@")
|
||||
set(LIBRW_GL3_GFXLIBS "@LIBRW_GL3_GFXLIBS@")
|
||||
|
||||
if(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL)
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
endif()
|
||||
if(NINTENDO_SWITCH)
|
||||
find_package(NXGL REQUIRED)
|
||||
find_package(OpenGL)
|
||||
if(NOT TARGET TARGET OpenGL::OpenGL AND NOT TARGET OpenGL::EGL AND NOT TARGET OpenGL::GL)
|
||||
message(FATAL_ERROR )
|
||||
endif()
|
||||
|
||||
if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
||||
find_package(glfw3 REQUIRED)
|
||||
elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2")
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
find_library(NXGL_EGL_LIBRARY EGL)
|
||||
find_library(NXGL_GLAPI_LIBRARY glapi)
|
||||
find_library(NXGL_DRM_NOUVEAU_LIBRARY drm_nouveau)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(NXGL
|
||||
REQUIRED_VARS NXGL_EGL_LIBRARY NXGL_GLAPI_LIBRARY NXGL_DRM_NOUVEAU_LIBRARY
|
||||
)
|
||||
|
||||
if(NXGL_FOUND)
|
||||
if(NOT TARGET NXGL::EGL)
|
||||
add_library(NXGL::EGL UNKNOWN IMPORTED)
|
||||
set_target_properties(NXGL::EGL PROPERTIES
|
||||
IMPORTED_LOCATION "${NXGL_EGL_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET NXGL::glapi)
|
||||
add_library(NXGL::glapi UNKNOWN IMPORTED)
|
||||
set_target_properties(NXGL::glapi PROPERTIES
|
||||
IMPORTED_LOCATION "${NXGL_GLAPI_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET NXGL::drm_nouveau)
|
||||
add_library(NXGL::drm_nouveau UNKNOWN IMPORTED)
|
||||
set_target_properties(NXGL::drm_nouveau PROPERTIES
|
||||
IMPORTED_LOCATION "${NXGL_DRM_NOUVEAU_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET NXGL::OpenGL)
|
||||
add_library(NXGL::OpenGL INTERFACE IMPORTED)
|
||||
set_target_properties(NXGL::OpenGL PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "NXGL::EGL;NXGL::glapi;NXGL::drm_nouveau"
|
||||
)
|
||||
endif()
|
||||
endif()
|
|
@ -45,7 +45,7 @@ class LibrwConan(ConanFile):
|
|||
|
||||
def validate(self):
|
||||
if self.options.platform == "d3d9" and self.settings.os != "Windows":
|
||||
raise ConanInvalidConfiguration("d3d9 can only be built for Windows")
|
||||
raise ConanInvalidConfiguration("platform=d3d9 can only be built for os=Windows")
|
||||
if self._os_is_playstation2:
|
||||
if self.options.platform not in ("null", "ps2"):
|
||||
raise ConanInvalidConfiguration("os=Playstation2 only supports platform=(null,ps2)")
|
||||
|
|
|
@ -149,16 +149,6 @@ set_target_properties(librw
|
|||
)
|
||||
|
||||
if(LIBRW_PLATFORM_GL3)
|
||||
if(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL)
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
target_link_libraries(librw
|
||||
PRIVATE
|
||||
OpenGL::GL
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
||||
find_package(glfw3 REQUIRED)
|
||||
target_link_libraries(librw
|
||||
|
@ -174,12 +164,25 @@ if(LIBRW_PLATFORM_GL3)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(NINTENDO_SWITCH)
|
||||
find_package(NXGL REQUIRED)
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL)
|
||||
if(TARGET OpenGL::OpenGL)
|
||||
target_link_libraries(librw
|
||||
PRIVATE
|
||||
NXGL::OpenGL
|
||||
OpenGL::OpenGL
|
||||
)
|
||||
elseif(TARGET OpenGL::EGL)
|
||||
target_link_libraries(librw
|
||||
PRIVATE
|
||||
OpenGL::EGL
|
||||
)
|
||||
elseif(TARGET OpenGL::GL)
|
||||
target_link_libraries(librw
|
||||
PRIVATE
|
||||
OpenGL::GL
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "find_package(OpenGL) failed.")
|
||||
endif()
|
||||
elseif(LIBRW_PLATFORM_D3D9)
|
||||
target_link_libraries(librw
|
||||
|
|
Loading…
Reference in New Issue