mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
CMake: build tinydisplay using CMake
Based on work by @toadkarter (#1487) and @pmp-p (#1547) Fixes #1481
This commit is contained in:
parent
a6ab238abc
commit
c48fcba3d8
@ -103,6 +103,11 @@
|
|||||||
# Panda3D::OpenGLES2::pandagles2
|
# Panda3D::OpenGLES2::pandagles2
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
# TinyDisplay - Support for software rendering.
|
||||||
|
#
|
||||||
|
# Panda3D::TinyDisplay::p3tinydisplay
|
||||||
|
#
|
||||||
|
#
|
||||||
# Vision - Support for vision processing.
|
# Vision - Support for vision processing.
|
||||||
#
|
#
|
||||||
# Panda3D::Vision::p3vision
|
# Panda3D::Vision::p3vision
|
||||||
@ -126,7 +131,7 @@ set(_panda_components
|
|||||||
Bullet ODE
|
Bullet ODE
|
||||||
FFmpeg
|
FFmpeg
|
||||||
OpenAL FMOD
|
OpenAL FMOD
|
||||||
OpenGL DX9 OpenGLES1 OpenGLES2
|
OpenGL DX9 OpenGLES1 OpenGLES2 TinyDisplay
|
||||||
Vision VRPN
|
Vision VRPN
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -448,10 +448,10 @@ on DirectX rendering." OFF)
|
|||||||
mark_as_advanced(SUPPORT_FIXED_FUNCTION)
|
mark_as_advanced(SUPPORT_FIXED_FUNCTION)
|
||||||
|
|
||||||
# Should build tinydisplay?
|
# Should build tinydisplay?
|
||||||
#option(HAVE_TINYDISPLAY
|
option(HAVE_TINYDISPLAY
|
||||||
# "Builds TinyDisplay, a light software renderer based on TinyGL,
|
"Builds TinyDisplay, a light software renderer based on TinyGL,
|
||||||
#that is built into Panda. TinyDisplay is not as full-featured as Mesa
|
that is built into Panda. TinyDisplay is not as full-featured as Mesa
|
||||||
#but is many times faster." ON)
|
but is many times faster." ON)
|
||||||
|
|
||||||
# Is SDL installed, and where?
|
# Is SDL installed, and where?
|
||||||
set(Threads_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
|
set(Threads_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
|
||||||
|
@ -60,6 +60,9 @@ add_subdirectory(src/wgldisplay)
|
|||||||
add_subdirectory(src/windisplay)
|
add_subdirectory(src/windisplay)
|
||||||
add_subdirectory(src/x11display)
|
add_subdirectory(src/x11display)
|
||||||
|
|
||||||
|
# Creates a metalib, so should go after
|
||||||
|
add_subdirectory(src/tinydisplay)
|
||||||
|
|
||||||
# For other components
|
# For other components
|
||||||
# bullet
|
# bullet
|
||||||
add_subdirectory(src/bullet)
|
add_subdirectory(src/bullet)
|
||||||
|
127
panda/src/tinydisplay/CMakeLists.txt
Normal file
127
panda/src/tinydisplay/CMakeLists.txt
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
if (NOT HAVE_TINYDISPLAY)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(P3TINYDISPLAY_HEADERS
|
||||||
|
config_tinydisplay.h
|
||||||
|
tinyGeomMunger.I tinyGeomMunger.h
|
||||||
|
tinySDLGraphicsPipe.I tinySDLGraphicsPipe.h
|
||||||
|
tinySDLGraphicsWindow.I tinySDLGraphicsWindow.h
|
||||||
|
tinyGraphicsBuffer.I tinyGraphicsBuffer.h
|
||||||
|
tinyGraphicsStateGuardian.I tinyGraphicsStateGuardian.h
|
||||||
|
tinyTextureContext.I tinyTextureContext.h
|
||||||
|
tinyWinGraphicsPipe.I tinyWinGraphicsPipe.h
|
||||||
|
tinyWinGraphicsWindow.I tinyWinGraphicsWindow.h
|
||||||
|
tinyXGraphicsPipe.I tinyXGraphicsPipe.h
|
||||||
|
tinyXGraphicsWindow.I tinyXGraphicsWindow.h
|
||||||
|
tinyOffscreenGraphicsPipe.I tinyOffscreenGraphicsPipe.h
|
||||||
|
srgb_tables.h
|
||||||
|
zbuffer.h
|
||||||
|
zfeatures.h
|
||||||
|
zgl.h
|
||||||
|
zline.h
|
||||||
|
zmath.h
|
||||||
|
ztriangle.h
|
||||||
|
ztriangle_two.h
|
||||||
|
ztriangle_code_1.h
|
||||||
|
ztriangle_code_2.h
|
||||||
|
ztriangle_code_3.h
|
||||||
|
ztriangle_code_4.h
|
||||||
|
ztriangle_table.h
|
||||||
|
store_pixel.h
|
||||||
|
store_pixel_code.h
|
||||||
|
store_pixel_table.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(P3TINYDISPLAY_SOURCES
|
||||||
|
clip.cxx
|
||||||
|
config_tinydisplay.cxx
|
||||||
|
error.cxx
|
||||||
|
image_util.cxx
|
||||||
|
init.cxx
|
||||||
|
td_light.cxx
|
||||||
|
memory.cxx
|
||||||
|
specbuf.cxx
|
||||||
|
store_pixel.cxx
|
||||||
|
td_texture.cxx
|
||||||
|
tinyGeomMunger.cxx
|
||||||
|
tinyGraphicsBuffer.cxx
|
||||||
|
tinyGraphicsStateGuardian.cxx
|
||||||
|
tinyOffscreenGraphicsPipe.cxx
|
||||||
|
tinySDLGraphicsPipe.cxx
|
||||||
|
tinySDLGraphicsWindow.cxx
|
||||||
|
tinyTextureContext.cxx
|
||||||
|
tinyWinGraphicsPipe.cxx
|
||||||
|
tinyWinGraphicsWindow.cxx
|
||||||
|
tinyXGraphicsPipe.cxx
|
||||||
|
tinyXGraphicsWindow.cxx
|
||||||
|
vertex.cxx
|
||||||
|
srgb_tables.cxx
|
||||||
|
zbuffer.cxx
|
||||||
|
zdither.cxx
|
||||||
|
zline.cxx
|
||||||
|
zmath.cxx
|
||||||
|
)
|
||||||
|
|
||||||
|
set(P3TINYDISPLAY_ZTRIANGLE_SOURCES
|
||||||
|
ztriangle_1.cxx
|
||||||
|
ztriangle_2.cxx
|
||||||
|
ztriangle_3.cxx
|
||||||
|
ztriangle_4.cxx
|
||||||
|
ztriangle_table.cxx
|
||||||
|
)
|
||||||
|
|
||||||
|
set_source_files_properties(${P3TINYDISPLAY_ZTRIANGLE_SOURCES}
|
||||||
|
PROPERTIES SKIP_UNITY_BUILD_INCLUSION YES)
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_source_files_properties(${P3TINYDISPLAY_ZTRIANGLE_SOURCES}
|
||||||
|
PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_COCOA)
|
||||||
|
set(P3TINYDISPLAY_HEADERS ${P3TINYDISPLAY_HEADERS}
|
||||||
|
tinyCocoaGraphicsPipe.I tinyCocoaGraphicsPipe.h
|
||||||
|
tinyCocoaGraphicsWindow.I tinyCocoaGraphicsWindow.h)
|
||||||
|
|
||||||
|
set(P3TINYDISPLAY_SOURCES ${P3TINYDISPLAY_SOURCES}
|
||||||
|
tinyCocoaGraphicsPipe.cxx
|
||||||
|
tinyCocoaGraphicsWindow.mm)
|
||||||
|
|
||||||
|
set_source_files_properties(tinyCocoaGraphicsWindow.mm
|
||||||
|
PROPERTIES SKIP_UNITY_BUILD_INCLUSION YES)
|
||||||
|
|
||||||
|
add_compile_definitions(HAVE_COCOA)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
composite_sources(p3tinydisplay P3TINYDISPLAY_SOURCES)
|
||||||
|
|
||||||
|
# Determine the additional components to link in.
|
||||||
|
set(COCOADISPLAY_LINK_TARGETS)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
list(APPEND COCOADISPLAY_LINK_TARGETS p3windisplay)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_X11)
|
||||||
|
list(APPEND COCOADISPLAY_LINK_TARGETS p3x11display)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_COCOA)
|
||||||
|
list(APPEND COCOADISPLAY_LINK_TARGETS p3cocoadisplay)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "TinyDisplay")
|
||||||
|
add_metalib(p3tinydisplay ${MODULE_TYPE}
|
||||||
|
${P3TINYDISPLAY_HEADERS} ${P3TINYDISPLAY_SOURCES} ${P3TINYDISPLAY_ZTRIANGLE_SOURCES}
|
||||||
|
COMPONENTS ${COCOADISPLAY_LINK_TARGETS})
|
||||||
|
unset(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
|
||||||
|
|
||||||
|
set_target_properties(p3tinydisplay PROPERTIES DEFINE_SYMBOL BUILDING_TINYDISPLAY)
|
||||||
|
|
||||||
|
install(TARGETS p3tinydisplay
|
||||||
|
EXPORT TinyDisplay COMPONENT TinyDisplay
|
||||||
|
DESTINATION ${MODULE_DESTINATION}
|
||||||
|
ARCHIVE COMPONENT TinyDisplayDevel)
|
||||||
|
|
||||||
|
export_targets(TinyDisplay NAMESPACE "Panda3D::TinyDisplay::" COMPONENT TinyDisplayDevel)
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "srgb_tables.h"
|
||||||
|
|
||||||
const unsigned short decode_sRGB[256] = { 0x0000, 0x0013, 0x0027, 0x003b,
|
const unsigned short decode_sRGB[256] = { 0x0000, 0x0013, 0x0027, 0x003b,
|
||||||
0x004f, 0x0063, 0x0077, 0x008b, 0x009f, 0x00b3, 0x00c6, 0x00db, 0x00f0,
|
0x004f, 0x0063, 0x0077, 0x008b, 0x009f, 0x00b3, 0x00c6, 0x00db, 0x00f0,
|
||||||
0x0107, 0x011f, 0x0139, 0x0153, 0x016f, 0x018c, 0x01aa, 0x01ca, 0x01eb,
|
0x0107, 0x011f, 0x0139, 0x0153, 0x016f, 0x018c, 0x01aa, 0x01ca, 0x01eb,
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
|
#ifndef SRGB_TABLES_H
|
||||||
|
#define SRGB_TABLES_H
|
||||||
|
|
||||||
/* 8-bit sRGB to 16-bit linear */
|
/* 8-bit sRGB to 16-bit linear */
|
||||||
extern const unsigned short decode_sRGB[256];
|
extern const unsigned short decode_sRGB[256];
|
||||||
|
|
||||||
/* 12-bit linear to 8-bit sRGB. I used 12-bit because it can
|
/* 12-bit linear to 8-bit sRGB. I used 12-bit because it can
|
||||||
represent all possible 8-bit sRGB values. */
|
represent all possible 8-bit sRGB values. */
|
||||||
extern const unsigned char encode_sRGB[4096];
|
extern const unsigned char encode_sRGB[4096];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user