Commit bb8c0e58 authored by ds22x's avatar ds22x
Browse files

Sync with upstream

parents 92e5907e 730b9331
......@@ -10,7 +10,7 @@ snes9x_linux-gtk-amd64_task:
setup_script:
- git submodule update --init --recursive
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install meson gettext libsdl2-dev libgtkmm-3.0-dev libgtk-3-dev libminizip-dev portaudio19-dev glslang-dev
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install meson gettext libsdl2-dev libgtkmm-3.0-dev libgtk-3-dev libminizip-dev portaudio19-dev glslang-dev cmake
compile_script:
- meson build gtk --buildtype=release --strip
......
......@@ -49,15 +49,13 @@ bool8 S9xGraphicsInit (void)
S9xInitTileRenderer();
memset(BlackColourMap, 0, 256 * sizeof(uint16));
GFX.RealPPL = GFX.Pitch >> 1;
IPPU.OBJChanged = TRUE;
Settings.BG_Forced = 0;
S9xFixColourBrightness();
S9xBuildDirectColourMaps();
GFX.Screen = &GFX.ScreenBuffer[GFX.RealPPL * 32];
GFX.ZERO = (uint16 *) malloc(sizeof(uint16) * 0x10000);
GFX.ScreenSize = GFX.Pitch / 2 * SNES_HEIGHT_EXTENDED * (Settings.SupportHiRes ? 2 : 1);
GFX.SubScreen = (uint16 *) malloc(GFX.ScreenSize * sizeof(uint16));
GFX.ZBuffer = (uint8 *) malloc(GFX.ScreenSize);
GFX.SubZBuffer = (uint8 *) malloc(GFX.ScreenSize);
......@@ -100,6 +98,9 @@ bool8 S9xGraphicsInit (void)
}
}
GFX.EndScreenRefreshCallback = NULL;
GFX.EndScreenRefreshCallbackData = NULL;
return (TRUE);
}
......@@ -109,6 +110,9 @@ void S9xGraphicsDeinit (void)
if (GFX.SubScreen) { free(GFX.SubScreen); GFX.SubScreen = NULL; }
if (GFX.ZBuffer) { free(GFX.ZBuffer); GFX.ZBuffer = NULL; }
if (GFX.SubZBuffer) { free(GFX.SubZBuffer); GFX.SubZBuffer = NULL; }
GFX.EndScreenRefreshCallback = NULL;
GFX.EndScreenRefreshCallbackData = NULL;
}
void S9xGraphicsScreenResize (void)
......@@ -121,19 +125,11 @@ void S9xGraphicsScreenResize (void)
if (Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
{
GFX.RealPPL = GFX.Pitch >> 1;
IPPU.DoubleWidthPixels = TRUE;
IPPU.RenderedScreenWidth = SNES_WIDTH << 1;
}
else
{
#ifdef USE_OPENGL
if (Settings.OpenGLEnable)
GFX.RealPPL = SNES_WIDTH;
else
#endif
GFX.RealPPL = GFX.Pitch >> 1;
IPPU.DoubleWidthPixels = FALSE;
IPPU.RenderedScreenWidth = SNES_WIDTH;
}
......@@ -273,6 +269,15 @@ void S9xEndScreenRefresh (void)
}
}
}
if (GFX.EndScreenRefreshCallback)
GFX.EndScreenRefreshCallback(GFX.EndScreenRefreshCallbackData);
}
void S9xSetEndScreenRefreshCallback(const SGFX::Callback cb, void *const data)
{
GFX.EndScreenRefreshCallback = cb;
GFX.EndScreenRefreshCallbackData = data;
}
void RenderLine (uint8 C)
......@@ -471,27 +476,6 @@ void S9xUpdateScreen (void)
{
if (!IPPU.DoubleWidthPixels && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
{
#ifdef USE_OPENGL
if (Settings.OpenGLEnable && GFX.RealPPL == 256)
{
// Have to back out of the speed up hack where the low res.
// SNES image was rendered into a 256x239 sized buffer,
// ignoring the true, larger size of the buffer.
GFX.RealPPL = GFX.Pitch >> 1;
for (int32 y = (int32) GFX.StartY - 1; y >= 0; y--)
{
uint16 *p = GFX.Screen + y * GFX.PPL + 255;
uint16 *q = GFX.Screen + y * GFX.RealPPL + 510;
for (int x = 255; x >= 0; x--, p--, q -= 2)
*q = *(q + 1) = *p;
}
GFX.PPL = GFX.RealPPL; // = GFX.Pitch >> 1 above
}
else
#endif
// Have to back out of the regular speed hack
for (uint32 y = 0; y < GFX.StartY; y++)
{
......
......@@ -11,16 +11,19 @@
struct SGFX
{
typedef void (*Callback)(void *);
const uint32 Pitch = sizeof(uint16) * MAX_SNES_WIDTH;
const uint32 RealPPL = MAX_SNES_WIDTH; // true PPL of Screen buffer
const uint32 ScreenSize = MAX_SNES_WIDTH * SNES_HEIGHT_EXTENDED;
uint16 ScreenBuffer[512 * (478 + 64)];
uint16 *Screen;
uint16 *SubScreen;
uint8 *ZBuffer;
uint8 *SubZBuffer;
uint32 Pitch;
uint32 ScreenSize;
uint16 *S;
uint8 *DB;
uint16 *ZERO;
uint32 RealPPL; // true PPL of Screen buffer
uint32 PPL; // number of pixels on each of Screen buffer
uint32 LinesPerTile; // number of lines in 1 tile (4 or 8 due to interlace)
uint16 *ScreenColors; // screen colors for rendering main
......@@ -66,6 +69,9 @@ struct SGFX
const char *InfoString;
uint32 InfoStringTimeout;
char FrameDisplayString[256];
Callback EndScreenRefreshCallback;
void *EndScreenRefreshCallbackData;
};
struct SBG
......@@ -201,6 +207,7 @@ struct COLOR_SUB
void S9xStartScreenRefresh (void);
void S9xEndScreenRefresh (void);
void S9xSetEndScreenRefreshCallback(SGFX::Callback cb, void *data);
void S9xBuildDirectColourMaps (void);
void RenderLine (uint8);
void S9xComputeClipWindows (void);
......
cmake_minimum_required(VERSION 3.20)
project(snes9x-gtk VERSION 1.61)
option(USE_OPENGL "Build support for OpenGL" ON)
option(USE_SLANG "Build support for slang-type shaders" ON)
option(USE_XV "Build support for XVideo output" ON)
option(USE_PORTAUDIO "Build PortAudio sound driver" ON)
option(USE_ALSA "Build ALSA sound driver" ON)
option(USE_PULSEAUDIO "Use PulseAudio" ON)
option(USE_OSS "Build support for OSS" ON)
option(DEBUGGER "Enable Snes9x Debugger" ON)
option(USE_HQ2X "Build the HQ2x family of filters" ON)
option(USE_XBRZ "Build the XBRZ family of filters" ON)
option(USE_SYSTEMZIP "Force use of system minizip" ON)
option(USE_WAYLAND "Build support for Wayland" ON)
option(DANGEROUS_HACKS "Allow dangerous hacks to be used" ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_INSTALL_DATADIR "snes9x" CACHE STRING "cheats.bml directory")
set(CMAKE_INSTALL_LOCALEDIR locale CACHE STRING "Locale directory")
string(APPEND DATADIR ${CMAKE_INSTALL_PREFIX} "/" ${CMAKE_INSTALL_DATAROOTDIR} "/" ${CMAKE_INSTALL_DATADIR})
string(APPEND LOCALEDIR ${CMAKE_INSTALL_PREFIX} "/" ${CMAKE_INSTALL_DATAROOTDIR} "/" ${CMAKE_INSTALL_LOCALEDIR})
add_compile_definitions(HAVE_LIBPNG
ZLIB SNES9X_GTK
NETPLAY_SUPPORT
UNZIP_SUPPORT
HAVE_MKSTEMP
HAVE_STRINGS_H
HAVE_STDINT_H
RIGHTSHIFT_IS_SAR
"GETTEXT_PACKAGE=\"snes9x-gtk\""
DATADIR=\"${DATADIR}\"
SNES9XLOCALEDIR=\"${LOCALEDIR}\")
set(INCLUDES ../apu/bapu ../ src)
set(SOURCES)
set(ARGS -Wall -W -Wno-unused-parameter)
set(LIBS)
set(DEFINES)
include(FindGettext)
foreach(lang es fr_FR ja pt_BR ru sr@latin uk zh_CN)
GETTEXT_PROCESS_PO_FILES(${lang} ALL INSTALL_DESTINATION "share/locale/" PO_FILES po/${lang}.po)
endforeach()
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
pkg_check_modules(GTK REQUIRED gtkmm-3.0 gthread-2.0 libpng)
pkg_check_modules(XRANDR REQUIRED xrandr)
find_library(X11 X11 REQUIRED)
find_library(XEXT Xext REQUIRED)
find_library(DL dl REQUIRED)
list(APPEND ARGS ${SDL2_CFLAGS} ${GTK_CFLAGS} ${XRANDR_CFLAGS})
list(APPEND LIBS ${X11} ${XEXT} ${DL} ${SDL2_LIBRARIES} ${GTK_LIBRARIES} ${XRANDR_LIBRARIES})
if(USE_OPENGL)
pkg_check_modules(EPOXY REQUIRED epoxy)
list(APPEND ARGS ${EPOXY_CFLAGS})
list(APPEND LIBS ${EPOXY_LIBRARIES})
list(APPEND SOURCES src/gtk_display_driver_opengl.cpp
src/gtk_glx_context.cpp
../shaders/glsl.cpp
../shaders/shader_helpers.cpp
src/gtk_shader_parameters.cpp)
list(APPEND DEFINES "USE_OPENGL")
endif()
if(USE_SLANG)
list(APPEND SOURCES ../shaders/slang.cpp)
list(APPEND INCLUDES ../external/glslang)
set(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS CACHE BOOL ON)
set(BUILD_TESTING CACHE BOOL OFF)
add_subdirectory("../external/glslang" "glslang" EXCLUDE_FROM_ALL)
add_subdirectory("../external/SPIRV-Cross" "SPIRV-Cross" EXCLUDE_FROM_ALL)
list(APPEND LIBS glslang
OGLCompiler
HLSL
OSDependent
SPIRV
glslang-default-resource-limits)
list(APPEND LIBS spirv-cross-core
spirv-cross-glsl
spirv-cross-reflect
spirv-cross-cpp)
list(APPEND DEFINES "USE_SLANG")
list(APPEND INCLUDES "../external/glslang")
endif()
if(USE_WAYLAND)
pkg_check_modules(WAYLAND REQUIRED wayland-client wayland-egl)
list(APPEND DEFINES "USE_WAYLAND")
list(APPEND SOURCES src/gtk_wayland_egl_context.cpp
src/gtk_wayland_egl_context.h
src/wayland-idle-inhibit-unstable-v1.c)
list(APPEND ARGS ${WAYLAND_CFLAGS})
list(APPEND LIBS ${WAYLAND_LIBRARIES})
endif()
if(USE_XV)
pkg_check_modules(XV REQUIRED xv)
list(APPEND DEFINES "USE_XV")
list(APPEND SOURCES src/gtk_display_driver_xv.cpp
src/gtk_display_driver_xv.h)
list(APPEND ARGS ${XV_CFLAGS})
list(APPEND LIBS ${XV_LIBRARIES})
endif()
if(USE_PULSEAUDIO)
pkg_check_modules(PULSEAUDIO REQUIRED libpulse)
list(APPEND DEFINES "USE_PULSEAUDIO")
list(APPEND SOURCES src/gtk_sound_driver_pulse.cpp)
list(APPEND ARGS ${PULSEAUDIO_CFLAGS})
list(APPEND LIBS ${PULSEAUDIO_LIBRARIES})
endif()
if(USE_PORTAUDIO)
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
list(APPEND DEFINES "USE_PORTAUDIO")
list(APPEND SOURCES src/gtk_sound_driver_portaudio.cpp)
list(APPEND ARGS ${PORTAUDIO_CFLAGS})
list(APPEND LIBS ${PORTAUDIO_LIBRARIES})
endif()
if(USE_ALSA)
pkg_check_modules(ALSA REQUIRED alsa)
list(APPEND DEFINES "USE_ALSA")
list(APPEND SOURCES src/gtk_sound_driver_alsa.cpp)
list(APPEND ARGS ${ALSA_CFLAGS})
list(APPEND LIBS ${ALSA_LIBRARIES})
endif()
if(USE_OSS)
CHECK_INCLUDE_FILE("sys/soundcard.h" OSS)
if(OSS)
list(APPEND SOURCES src/gtk_sound_driver_oss.cpp)
list(APPEND DEFINES "USE_OSS")
endif()
endif()
pkg_check_modules(LIBPNG REQUIRED "libpng")
list(APPEND ARGS ${LIBPNG_CFLAGS})
list(APPEND LIBS ${LIBPNG_LIBRARIES})
pkg_check_modules(ZLIB REQUIRED "zlib")
list(APPEND ARGS ${ZLIB_CFLAGS})
list(APPEND LIBS ${ZLIB_LIBRARIES})
pkg_check_modules(MINIZIP "minizip")
if(USE_SYSTEMZIP AND MINIZIP_FOUND)
list(APPEND DEFINES "SYSTEM_ZIP")
list(APPEND ARGS ${MINIZIP_CFLAGS})
list(APPEND LIBS ${MINIZIP_LIBRARIES})
else()
list(APPEND INCLUDES ../unzip)
list(APPEND SOURCES ../unzip/unzip.c ../unzip/ioapi.c ../unzip/zip.c)
endif()
if(USE_HQ2X)
list(APPEND DEFINES "USE_HQ2X")
list(APPEND SOURCES ../filter/hq2x.cpp)
endif()
if(USE_XBRZ)
list(APPEND DEFINES "USE_XBRZ")
list(APPEND SOURCES ../filter/xbrz.cpp ../filter/xbrz.h src/filter_xbrz.cpp)
endif()
if(DANGEROUS_HACKS)
list(APPEND DEFINES ALLOW_CPU_OVERCLOCK)
message("Dangerous hacks are enabled. Use at your own risk.")
endif()
list(APPEND SOURCES
src/gtk_sound_driver.h
../filter/2xsai.cpp
../filter/2xsai.h
../filter/epx.cpp
../filter/epx.h
src/filter_epx_unsafe.h
src/filter_epx_unsafe.cpp
src/gtk_binding.cpp
src/gtk_binding.h
src/gtk_cheat.cpp
src/gtk_cheat.h
src/gtk_config.cpp
src/gtk_config.h
src/gtk_control.cpp
src/gtk_control.h
src/gtk_display.cpp
src/gtk_display_driver_gtk.cpp
src/gtk_display_driver_gtk.h
src/gtk_display_driver.h
src/gtk_display.h
src/gtk_file.cpp
src/gtk_file.h
src/gtk_builder_window.cpp
src/gtk_builder_window.h
src/gtk_preferences.cpp
src/gtk_preferences.h
src/gtk_s9xcore.h
src/gtk_s9x.cpp
src/gtk_s9x.h
src/gtk_s9xwindow.cpp
src/gtk_s9xwindow.h
src/gtk_sound.cpp
src/gtk_sound.h
src/gtk_splash.cpp
../filter/snes_ntsc_config.h
../filter/snes_ntsc.h
../filter/snes_ntsc_impl.h
../filter/snes_ntsc.c
src/gtk_compat.h
src/gtk_sound_driver_sdl.h
src/gtk_sound_driver_sdl.cpp
../fxinst.cpp
../fxemu.cpp
../fxdbg.cpp
../c4.cpp
../c4emu.cpp
../apu/apu.cpp
../apu/bapu/dsp/sdsp.cpp
../apu/bapu/smp/smp.cpp
../apu/bapu/smp/smp_state.cpp
../msu1.cpp
../msu1.h
../dsp.cpp
../dsp1.cpp
../dsp2.cpp
../dsp3.cpp
../dsp4.cpp
../spc7110.cpp
../obc1.cpp
../seta.cpp
../seta010.cpp
../seta011.cpp
../seta018.cpp
../controls.cpp
../crosshairs.cpp
../cpu.cpp
../sa1.cpp
../debug.cpp
../sdd1.cpp
../tile.cpp
../tileimpl-n1x1.cpp
../tileimpl-n2x1.cpp
../tileimpl-h2x1.cpp
../srtc.cpp
../gfx.cpp
../memmap.cpp
../clip.cpp
../ppu.cpp
../dma.cpp
../snes9x.cpp
../globals.cpp
../stream.cpp
../conffile.cpp
../bsx.cpp
../logger.cpp
../snapshot.cpp
../screenshot.cpp
../movie.cpp
../statemanager.cpp
../sha256.cpp
../bml.cpp
../cpuops.cpp
../cpuexec.cpp
../sa1cpu.cpp
../cheats.cpp
../cheats2.cpp
../sdd1emu.cpp
../netplay.cpp
../server.cpp
../loadzip.cpp
../compat.cpp
src/gtk_netplay_dialog.cpp
src/gtk_netplay_dialog.h
src/gtk_netplay.cpp
src/gtk_netplay.h
src/background_particles.cpp
src/background_particles.h)
set(LIBJMA_SOURCES
../jma/s9x-jma.cpp
../jma/7zlzma.cpp
../jma/crc32.cpp
../jma/iiostrm.cpp
../jma/inbyte.cpp
../jma/jma.cpp
../jma/lzma.cpp
../jma/lzmadec.cpp
../jma/winout.cpp)
add_library(jma ${LIBJMA_SOURCES})
target_include_directories(jma PRIVATE ${INCLUDES})
target_compile_options(jma PUBLIC ${ARGS})
add_executable(sourcify src/sourcify.c)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gtk_snes9x_ui.cpp
COMMAND sourcify ${CMAKE_CURRENT_SOURCE_DIR}/src/snes9x.ui ${CMAKE_CURRENT_BINARY_DIR}/gtk_snes9x_ui.cpp snes9x_ui
DEPENDS sourcify)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mini_icon.cpp
COMMAND sourcify ${CMAKE_CURRENT_SOURCE_DIR}/data/mini_icon.png ${CMAKE_CURRENT_BINARY_DIR}/mini_icon.cpp mini_icon
DEPENDS sourcify)
add_executable(snes9x-gtk ${SOURCES} ${jma} ${CMAKE_CURRENT_BINARY_DIR}/gtk_snes9x_ui.cpp ${CMAKE_CURRENT_BINARY_DIR}/mini_icon.cpp)
target_include_directories(snes9x-gtk PRIVATE ${INCLUDES})
target_compile_options(snes9x-gtk PRIVATE ${ARGS})
target_link_libraries(snes9x-gtk PRIVATE ${LIBS})
target_compile_definitions(snes9x-gtk PRIVATE ${DEFINES})
install(TARGETS snes9x-gtk)
install(FILES ../data/cheats.bml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_INSTALL_DATADIR})
install(FILES data/snes9x-gtk.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
install(FILES data/snes9x_16x16.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps RENAME snes9x.png)
install(FILES data/snes9x_24x24.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/24x24/apps RENAME snes9x.png)
install(FILES data/snes9x_32x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps RENAME snes9x.png)
install(FILES data/snes9x_64x64.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps RENAME snes9x.png)
install(FILES data/snes9x_128x128.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps RENAME snes9x.png)
install(FILES data/snes9x_256x256.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps RENAME snes9x.png)
install(FILES data/snes9x.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps)
\ No newline at end of file
../external
\ No newline at end of file
project('snes9x-gtk',
['c', 'cpp'],
version: '1.61',
meson_version: '>=0.46.0',
meson_version: '>=0.56.2',
subproject_dir: 'external',
default_options: ['cpp_std=c++17'])
args = ['-DSNES9X_GTK', '-DUNZIP_SUPPORT', '-DNETPLAY_SUPPORT', '-DJMA_SUPPORT', '-Wall', '-W', '-Wno-unused-parameter']
......@@ -73,93 +74,31 @@ endif
slang = get_option('slang')
if slang and opengl
glslang_args = ['-w', '-fno-exceptions', '-DNV_EXTENSIONS', '-DAMD_EXTENSIONS', '-DGLSLANG_OSINCLUDE_UNIX', '-DENABLE_OPT=0']
OSDependent_src = ['../external/glslang/glslang/OSDependent/Unix/ossource.cpp']
OSDependent_lib = static_library('OSDependent',
OSDependent_src,
include_directories: include_directories('../external/glslang'),
cpp_args: glslang_args)
libs += OSDependent_lib
glslang_src = [
'../external/glslang/glslang/MachineIndependent/glslang_tab.cpp',
'../external/glslang/glslang/MachineIndependent/attribute.cpp',
'../external/glslang/glslang/MachineIndependent/Constant.cpp',
'../external/glslang/glslang/MachineIndependent/iomapper.cpp',
'../external/glslang/glslang/MachineIndependent/InfoSink.cpp',
'../external/glslang/glslang/MachineIndependent/Initialize.cpp',
'../external/glslang/glslang/MachineIndependent/IntermTraverse.cpp',
'../external/glslang/glslang/MachineIndependent/Intermediate.cpp',
'../external/glslang/glslang/MachineIndependent/ParseContextBase.cpp',
'../external/glslang/glslang/MachineIndependent/ParseHelper.cpp',
'../external/glslang/glslang/MachineIndependent/PoolAlloc.cpp',
'../external/glslang/glslang/MachineIndependent/RemoveTree.cpp',
'../external/glslang/glslang/MachineIndependent/Scan.cpp',
'../external/glslang/glslang/MachineIndependent/ShaderLang.cpp',
'../external/glslang/glslang/MachineIndependent/SymbolTable.cpp',
'../external/glslang/glslang/MachineIndependent/Versions.cpp',
'../external/glslang/glslang/MachineIndependent/intermOut.cpp',
'../external/glslang/glslang/MachineIndependent/limits.cpp',
'../external/glslang/glslang/MachineIndependent/linkValidate.cpp',
'../external/glslang/glslang/MachineIndependent/parseConst.cpp',
'../external/glslang/glslang/MachineIndependent/reflection.cpp',
'../external/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp',
'../external/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp',
'../external/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp',
'../external/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp',
'../external/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp',
'../external/glslang/glslang/MachineIndependent/propagateNoContraction.cpp',
'../external/glslang/glslang/GenericCodeGen/CodeGen.cpp',
'../external/glslang/glslang/GenericCodeGen/Link.cpp',
'../external/glslang/StandAlone/ResourceLimits.cpp'
]
glslang_lib = static_library('glslang',
glslang_src,
include_directories: include_directories('../external/glslang'),
cpp_args: glslang_args)
libs += glslang_lib
OGLCompilersDLL_src = ['../external/glslang/OGLCompilersDLL/InitializeDll.cpp']
OGLCompilersDLL_lib = static_library('OGLCompilersDLL',
OGLCompilersDLL_src,
include_directories: include_directories('../external/glslang'),
cpp_args: glslang_args)
libs += OGLCompilersDLL_lib
SPIRV_src = [
'../external/glslang/SPIRV/GlslangToSpv.cpp',
'../external/glslang/SPIRV/InReadableOrder.cpp',
'../external/glslang/SPIRV/Logger.cpp',
'../external/glslang/SPIRV/SpvBuilder.cpp',
'../external/glslang/SPIRV/SpvPostProcess.cpp',
'../external/glslang/SPIRV/SpvTools.cpp',
'../external/glslang/SPIRV/disassemble.cpp',
'../external/glslang/SPIRV/SPVRemapper.cpp',
'../external/glslang/SPIRV/doc.cpp'
]
SPIRV_lib = static_library('SPIRV',
SPIRV_src,
include_directories: include_directories('../external/glslang'),
cpp_args: glslang_args)
libs += SPIRV_lib
args += ['-DUSE_SLANG',
'-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS']
srcs += ['../shaders/slang.cpp']
srcs += ['../external/SPIRV-Cross/spirv_cfg.cpp',
'../external/SPIRV-Cross/spirv_cfg.hpp',
'../external/SPIRV-Cross/spirv_common.hpp',
'../external/SPIRV-Cross/spirv_cross.cpp',
'../external/SPIRV-Cross/spirv_cross.hpp',
'../external/SPIRV-Cross/spirv_glsl.cpp',
'../external/SPIRV-Cross/spirv_glsl.hpp',
'../external/SPIRV-Cross/spirv_cross_parsed_ir.cpp',
'../external/SPIRV-Cross/spirv_cross_parsed_ir.hpp',
'../external/SPIRV-Cross/spirv_parser.cpp',
'../external/SPIRV-Cross/spirv_parser.hpp',
'../external/SPIRV-Cross/spirv.hpp']
cmake = import('cmake')
glslang_opt_var = cmake.subproject_options()
glslang_opt_var.add_cmake_defines({'BUILD_TESTING': false})
glslang_pro = cmake.subproject('glslang', options: glslang_opt_var)
# deps += glslang_pro.dependency('GenericCodeGen')
deps += glslang_pro.dependency('glslang')
# deps += glslang_pro.dependency('MachineIndependent')
deps += glslang_pro.dependency('OGLCompiler')
deps += glslang_pro.dependency('HLSL')
deps += glslang_pro.dependency('OSDependent')
deps += glslang_pro.dependency('SPIRV')
deps += glslang_pro.dependency('glslang-default-resource-limits')
spirv_cross_opt_var = cmake.subproject_options()
spirv_cross_opt_var.add_cmake_defines({'SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS': true})
spirv_cross_pro = cmake.subproject('SPIRV-Cross', options: spirv_cross_opt_var)
deps += spirv_cross_pro.dependency('spirv-cross-core')
deps += spirv_cross_pro.dependency('spirv-cross-glsl')
deps += spirv_cross_pro.dependency('spirv-cross-reflect')
deps += spirv_cross_pro.dependency('spirv-cross-cpp')
args += ['-DUSE_SLANG']
srcs += '../shaders/slang.cpp'
includes += '../external/glslang'
endif
......@@ -297,29 +236,7 @@ if get_option('xbrz')
srcs += ['../filter/xbrz.cpp', '../filter/xbrz.h', 'src/filter_xbrz.cpp', 'src/filter_xbrz.h']
endif
if c_compiler.has_function('mkstemp')
args += '-DHAVE_MKSTEMP'
endif
if c_compiler.has_header('strings.h')
args += '-DHAVE_STRINGS_H'
endif
if c_compiler.has_header('stdint.h')
args += '-DHAVE_STDINT_H'
endif
results = c_compiler.run('int main(int argc, char **argv) { int i; i = -1; i >>= 1; return (i < 0 ? 0 : 1); }')
if results.returncode() == 0
args += '-DRIGHTSHIFT_IS_SAR'
endif
results = c_compiler.run('int main(int argc, char **argv) { return (!(sizeof(void *) == sizeof(int))); }')
if results.returncode() != 0
args += '-DPTR_NOT_INT'
endif
args += ['-DHAVE_MKSTEMP', '-DHAVE_STRINGS_H', '-DHAVE_STDINT_H', '-DRIGHTSHIFT_IS_SAR']
srcs += [
'src/gtk_sound_driver.h',
......
......@@ -5,7 +5,7 @@
\*****************************************************************************/