This commit is contained in:
DepressedTWM 2026-08-04 12:23:18 +04:00
parent e7f162ad7c
commit a9c3ae475d
7 changed files with 187 additions and 102 deletions

View file

@ -7,18 +7,47 @@ option(STEAM "Build for Steam" OFF)
option(DEBUG "Debug mode" ON) option(DEBUG "Debug mode" ON)
option(SANITIZERS "Enable sanitizers" OFF) option(SANITIZERS "Enable sanitizers" OFF)
option(NATIVE "Use native instructions(for local use only)" OFF) option(NATIVE "Use native instructions(for local use only)" OFF)
#x86, arm64, ia-64 option(LINUX_CROSSCOMPILATION "Forces MiNGW use" OFF)
option(CPU_ARCH "CPU arch" "x86") option(STATIC "Build more static build" OFF)
option(CPU_ARCH "CPU arch(x86, arm64, ia-64)" "x86")
#Configuration #Configuration
set(CMAKE_DISABLE_IN_SOURCE_BUILD TRUE) set(CMAKE_DISABLE_IN_SOURCE_BUILD TRUE)
set(VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "5.1.2600.0") set(VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "5.1.2600.0")
set(STEAMWORKS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/steamworks" CACHE PATH "Path to Steamworks folder") set(STEAMWORKS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/steamworks" CACHE PATH "Path to Steamworks folder")
set(ZLIB_USE_STATIC_LIBS ON)
set(OPENSSL_USE_STATIC_LIBS ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
if(STATIC)
set(ZLIB_USE_STATIC_LIBS ON)
set(OPENSSL_USE_STATIC_LIBS ON)
endif()
# https://www.mingw-w64.org/build-systems/cmake/
if(LINUX_CROSSCOMPILATION)
# toolchain-mingw64.cmake
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
# specify the cross compiler
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
# where is the target environment
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
# search for programs in the build host directories
# set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
# set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
# set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# CMake determines how to examine dependencies based on the *host* system, leading to
# a `file unknown error` unless the target platform is explicitly specified.
set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM "windows+pe")
endif()
# main stuff # main stuff
set(MAIN_HEADERS set(MAIN_HEADERS
src/quadarray.h src/quadarray.h
@ -135,23 +164,32 @@ set(MAIN_SOURCE
src/signals/maindispatcher.cpp src/signals/maindispatcher.cpp
) )
if(WIN32) # main stuff
list(APPEND MAIN_SOURCE assets/resources.rc) set(MAIN_HEADERS
list(APPEND DEFINES UNICODE) # ...
list(APPEND PLATFORM_LIBRARIES Secur32 Shlwapi winmm z) )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/windows )
elseif(APPLE) set(MAIN_SOURCE
list(APPEND MAIN_HEADERS src/mac-desktop.h) # ...
list(APPEND MAIN_SOURCE src/mac-desktop.mm) )
elseif(LINUX)
find_package(PkgConfig REQUIRED) if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
pkg_check_modules(LINUXPKGS REQUIRED gtk+-3.0 libxfconf-0 libseccomp) list(APPEND MAIN_SOURCE assets/resources.rc)
include_directories(${LINUXPKGS_INCLUDE_DIRS}) list(APPEND DEFINES UNICODE)
add_compile_options(${LINUXPKGS_CFLAGS_OTHER}) list(APPEND PLATFORM_LIBRARIES Secur32 Shlwapi winmm z)
list(APPEND PLATFORM_LIBRARIES ${LINUXPKGS_LDFLAGS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}/windows)
list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c) elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h) list(APPEND MAIN_HEADERS src/mac-desktop.h)
elseif(BSD) list(APPEND MAIN_SOURCE src/mac-desktop.mm)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(LINUXPKGS REQUIRED gtk+-3.0 libxfconf-0 libseccomp)
include_directories(${LINUXPKGS_INCLUDE_DIRS})
add_compile_options(${LINUXPKGS_CFLAGS_OTHER})
list(APPEND PLATFORM_LIBRARIES ${LINUXPKGS_LDFLAGS})
list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c)
list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(LINUXPKGS REQUIRED gtk+-3.0) pkg_check_modules(LINUXPKGS REQUIRED gtk+-3.0)
include_directories(${LINUXPKGS_INCLUDE_DIRS}) include_directories(${LINUXPKGS_INCLUDE_DIRS})
@ -159,12 +197,15 @@ elseif(BSD)
list(APPEND PLATFORM_LIBRARIES ${LINUXPKGS_LDFLAGS}) list(APPEND PLATFORM_LIBRARIES ${LINUXPKGS_LDFLAGS})
list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c) list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c)
list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h) list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h)
set(STEAM OFF) set(STEAM OFF)
elseif(EMSCRIPTEN) elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(STEAM OFF) set(STEAM OFF)
set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "") set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "")
elseif(APPLE) elseif(APPLE)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake"
VERBATIM
)
endif() endif()
if (STEAM) if (STEAM)
@ -299,88 +340,71 @@ set(BINDING_SOURCE
) )
source_group("Binding Source" FILES ${BINDING_SOURCE} ${BINDING_HEADERS}) source_group("Binding Source" FILES ${BINDING_SOURCE} ${BINDING_HEADERS})
if(NATIVE)
add_compile_options("-march=native -mtune=native")
################ endif()
# Настройки зависимые от компилятора if(SANITIZERS)
if (MSVC) # ASan + Ruby = SEGFAULT
list(APPEND DEFINES _CRT_SECURE_NO_WARNINGS NOMINMAX ) set(SANITIZERS "undefined,leak,shift,shift-base,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin,pointer-subtract,pointer-compare")
if(DEBUG) add_compile_options(-fsanitize=${SANITIZERS})
add_compile_options(/EHr /validate-charset /DEBUG /RTCu /RTCs /RTCc) add_link_options(-fsanitize=${SANITIZERS})
else() endif()
add_compile_options(/O2 /fp:fast /GL /GF /GA /Gy) if(DEBUG)
add_link_options(/LTCG /OPT:REF /OPT:ICF) add_compile_options(
endif()
if(SANITIZERS)
add_compile_options(/fsanitize=address /fsanitize=fuzzer /fsanitize-address-use-after-return)
endif()
else()
if(NATIVE)
add_compile_options("-march=native -mtune=native")
endif()
if(SANITIZERS)
# ASan + Ruby = shit :<
set(SANITIZERS "undefined,leak,shift,shift-base,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin,pointer-subtract,pointer-compare")
add_compile_options(-fsanitize=${SANITIZERS})
add_link_options(-fsanitize=${SANITIZERS})
endif()
if(DEBUG)
add_compile_options(
-g3 -g3
-fno-omit-frame-pointer -fno-omit-frame-pointer
-Og -Og
-Wall -Wall
-Wextra) -Wextra)
else() else()
add_compile_options( add_compile_options(
-O2 -O2
-ffast-math -ffast-math
-fipa-pta -fipa-pta
-ftree-vectorize -ftree-vectorize
-fstdarg-opt -fstdarg-opt
-fomit-frame-pointer -fomit-frame-pointer
-frename-registers -frename-registers
-ffunction-sections -ffunction-sections
-fdata-sections -fdata-sections
-fvisibility=hidden) -fvisibility=hidden)
add_link_options(-Wl,-O2 add_link_options(-Wl,-O2
-Wl,--gc-sections -Wl,--gc-sections
-Wl,--as-needed -Wl,--as-needed
-Wl,--no-undefined -Wl,--no-undefined
-Wl,--strip-all -Wl,--strip-all
-Wl,--no-copy-dt-needed-entries) -Wl,--no-copy-dt-needed-entries)
if(NOT WIN32) if(NOT WIN32)
add_compile_options(-flto) add_compile_options(-flto)
add_link_options(-flto) add_link_options(-flto)
endif() endif()
if(LINUX) if(LINUX)
add_compile_options(-fno-plt) add_compile_options(-fno-plt)
endif() endif()
if(CPU_ARCH MATCHES "x86") if(CPU_ARCH MATCHES "x86")
add_compile_options( add_compile_options(
-mnoreturn-no-callee-saved-registers -mnoreturn-no-callee-saved-registers
-mrelax-cmpxchg-loop) -mrelax-cmpxchg-loop)
elseif(CPU_ARCH MATCHES "arm64") elseif(CPU_ARCH MATCHES "arm64")
# TODO: check is it really usefull:3 # TODO: check is it really usefull:3
add_compile_options( add_compile_options(
-mlow-precision-recip-sqrt -mlow-precision-recip-sqrt
-mlow-precision-sqrt -mlow-precision-sqrt
-mlow-precision-div -mlow-precision-div
) )
elseif(CPU_ARCH MATCHES "ia-64") elseif(CPU_ARCH MATCHES "ia-64")
# In theory it must make game work better on IA-64? # In theory it must make game work better on IA-64?
add_compile_options( add_compile_options(
-minline-float-divide-min-latency -minline-float-divide-min-latency
-minline-float-divide-max-throughput -minline-float-divide-max-throughput
-minline-int-divide-min-latency -minline-int-divide-min-latency
-minline-int-divide-max-throughput -minline-int-divide-max-throughput
-minline-sqrt-min-latency -minline-sqrt-min-latency
-minline-sqrt-max-throughput -minline-sqrt-max-throughput
) )
endif()
endif() endif()
endif() endif()
@ -402,6 +426,15 @@ else()
) )
endif() endif()
if(LINUX_CROSSCOMPILATION)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
/usr/x86_64-w64-mingw32/include
)
target_compile_options(oneshot PRIVATE
-idirafter /usr/x86_64-w64-mingw32/include
)
endif()
if(POLICY CMP0167) # suppress Boost warning if(POLICY CMP0167) # suppress Boost warning
cmake_policy(SET CMP0167 OLD) cmake_policy(SET CMP0167 OLD)
endif() endif()

View file

@ -4,6 +4,7 @@
* "Визя" * "Визя"
* DepressedTWM * DepressedTWM
* referr * referr
* MeTLAaaaaa
## Artists ## Artists

View file

@ -27,3 +27,5 @@ Deleted useless hooks
fix crash on game exit fix crash on game exit
Error handling updated Error handling updated
added gamepad button icons in settings added gamepad button icons in settings
Removed MSVC support
Fixed issue #47

View file

@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.28.3)
project(_______)
include(FindPackageHandleStandardArgs)
option(DEBUG "Debug mode" ON)
option(SANITIZERS "Enable sanitizers" OFF)
option(NATIVE "Use native instructions(for local use only)" OFF)
set(CMAKE_DISABLE_IN_SOURCE_BUILD TRUE)
set(VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "5.1.2600.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(EMBEDDED_INPUT
assets/icon.png
)
## Process Embeddeds ##
find_program(XXD_EXE
NAMES xxd xxd.exe
DOC "Location of the xxd executable"
HINTS
ENV PATH
/usr/bin /usr/local/bin .
)
macro(ProcessWithXXD outvar inputfile outdir)
get_filename_component(basefile ${inputfile} NAME)
set(outputfile ${outdir}/${basefile}.xxd)
set_source_files_properties(${outputfile} PROPERTIES HEADER_FILE_ONLY TRUE)
add_custom_command(
OUTPUT ${outputfile}
COMMAND ${XXD_EXE} -i ${inputfile} ${outputfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${inputfile}
COMMENT "Generating XXD for ${inputfile}"
)
list(APPEND ${outvar}
${outputfile}
)
endmacro()
foreach(item ${EMBEDDED_INPUT})
ProcessWithXXD(EMBEDDED_SOURCE ${item} ${CMAKE_CURRENT_BINARY_DIR})
endforeach()
source_group("Embedded Source" FILES ${EMBEDDED_INPUT} ${EMBEDDED_SOURCE})
add_executable(${PROJECT_NAME} ${EMBEDDED_SOURCE} main.c)
find_package(SDL3 CONFIG)
find_package(SDL3_image CONFIG)
target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFINES})
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3 SDL3_image::SDL3_image)

BIN
journal/SDL/assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

0
journal/SDL/main.c Normal file
View file

View file

@ -407,8 +407,8 @@ class Window_Message < Window_Selectable
else else
if @blip >= BLIP_TIME if @blip >= BLIP_TIME
#april fools #april fools
if ($game_temp.message_face != nil && CTime.month == 4 && CTime.day == 1) or Settings[:enforce_april_fools] && $game_temp.message_face.start_with?("niko") if ($game_temp.message_face != nil && ((CTime.month == 4 && CTime.day == 1) or Settings[:enforce_april_fools])) && $game_temp.message_face.start_with?("niko")
niko_sounds = [ "cat_2"] niko_sounds = ["cat_2"]
@blipsound = niko_sounds[rand(niko_sounds.length)] @blipsound = niko_sounds[rand(niko_sounds.length)]
Audio.se_play("Audio/SE/#{@blipsound}.wav", 50, rand(100..125)) unless @text.empty? Audio.se_play("Audio/SE/#{@blipsound}.wav", 50, rand(100..125)) unless @text.empty?
else else