mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-08-03 20:57:55 -04:00
CMake Build System (#48)
* First stab at CMake It builds on Linux, and cross-compiles to Windows as well using the provided toolchain files. convert-icon is also fixed up with argument count checking and modern format strings, along with all flake8 warnings fixed. * Fix Visual Studio compilation * Add a newline to gitignore * Build system updates - Add documentation. - Add options for defines. - Automatically copy DLL files to binary directory. - Add preliminary CPack support which packages the binary plus docs and DLL files. * Fix SDL2_FILES conditional * Build Windows and Linux packages We use our own Python script instead of unix2dos. Also, a few other random fixes came along for the ride. * Fix up warnings and defines on MSVC * Update Travis to use CMake * Remove automake and autoconf files * Yet more build system updates - Add docs, examples, and desktop stuff to binary packages. - Get rid of HAVE_CONFIG_H. - Change HAVE_DLOPEN to something more CMake-like. - Add optional targets for most of the tools. * Ignore files for source package * Add to README file * Get rid of BETA, DOGS, and fix another Automake straggler * Prevent in-tree builds Fixes #21
This commit is contained in:
parent
b66f8b89f7
commit
b13b8fc415
21
.gitignore
vendored
21
.gitignore
vendored
@ -23,17 +23,10 @@
|
|||||||
/WinMBF.ncb
|
/WinMBF.ncb
|
||||||
/Release
|
/Release
|
||||||
|
|
||||||
Makefile
|
# Standard CMake build directory.
|
||||||
Makefile.in
|
/build*
|
||||||
.deps
|
|
||||||
/autom4te.cache
|
# Visual Studio CMake integration directories.
|
||||||
/aclocal.m4
|
/.vs/
|
||||||
/compile
|
/out/
|
||||||
/config.h.in
|
CMakeSettings.json
|
||||||
/config.log
|
|
||||||
/config.status
|
|
||||||
/configure
|
|
||||||
/configure.scan
|
|
||||||
/depcomp
|
|
||||||
/install-sh
|
|
||||||
/missing
|
|
||||||
|
@ -9,9 +9,9 @@ if [ "$ANALYZE" = "true" ] ; then
|
|||||||
exit $RET
|
exit $RET
|
||||||
else
|
else
|
||||||
set -e
|
set -e
|
||||||
autoreconf -fiv
|
mkdir build && cd build
|
||||||
./configure --enable-werror
|
cmake ..
|
||||||
make -j4
|
make
|
||||||
make install DESTDIR=/tmp/whatever
|
make install DESTDIR=/tmp/whatever
|
||||||
make dist
|
make package
|
||||||
fi
|
fi
|
||||||
|
76
CMakeLists.txt
Normal file
76
CMakeLists.txt
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
include(CheckLibraryExists)
|
||||||
|
|
||||||
|
# Adds the cmake directory to the CMake include path.
|
||||||
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
# 3.12 is needed for modern FindPython.
|
||||||
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
project("Woof"
|
||||||
|
VERSION 0.9.0
|
||||||
|
DESCRIPTION "Woof! is a continuation of MBF, the Doom source port created by Lee Killough, for modern systems."
|
||||||
|
HOMEPAGE_URL "https://github.com/fabiangreffrath/woof"
|
||||||
|
LANGUAGES C)
|
||||||
|
|
||||||
|
# Prevent in-tree builds.
|
||||||
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
message(FATAL_ERROR "In-tree builds are not supported.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Hardcoded defines added to configure and resource files.
|
||||||
|
set(PROJECT_COMPANY "Fabian Greffrath and contributors")
|
||||||
|
set(PROJECT_COPYRIGHT "Copyright (C) 1993-2020")
|
||||||
|
set(PROJECT_LICENSE "GNU General Public License, version 2")
|
||||||
|
set(PROJECT_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
|
||||||
|
set(PROJECT_TARNAME "woof")
|
||||||
|
set(PROJECT_VERSION_RC "0,9,0,0")
|
||||||
|
|
||||||
|
configure_file(config.h.in config.h)
|
||||||
|
|
||||||
|
# Toggle-able defines added at compile-time.
|
||||||
|
option("${PROJECT_NAME}_INSTRUMENTED" "Enable memory allocation statistics" OFF)
|
||||||
|
option("${PROJECT_NAME}_RANGECHECK" "Enable bounds-checking of performance-sensitive functions" ON)
|
||||||
|
|
||||||
|
# Compiler environment requirements.
|
||||||
|
check_library_exists(m pow "" m_FOUND)
|
||||||
|
check_library_exists(dl dlopen "" dl_FOUND)
|
||||||
|
|
||||||
|
# Library requirements.
|
||||||
|
find_package(SDL2)
|
||||||
|
find_package(SDL2_mixer)
|
||||||
|
find_package(SDL2_net)
|
||||||
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
|
||||||
|
# Files that should be installed with the install target.
|
||||||
|
configure_file(WoofInstall.cmake.in WoofInstall.cmake ESCAPE_QUOTES @ONLY)
|
||||||
|
install(SCRIPT "${PROJECT_BINARY_DIR}/WoofInstall.cmake")
|
||||||
|
if(WIN32)
|
||||||
|
install(FILES "${PROJECT_BINARY_DIR}/COPYING.txt" DESTINATION .)
|
||||||
|
install(FILES "${PROJECT_BINARY_DIR}/README.txt" DESTINATION .)
|
||||||
|
install(FILES betagrph.wad DESTINATION .)
|
||||||
|
install(FILES betalevl.wad DESTINATION .)
|
||||||
|
install(FILES watermap.wad DESTINATION .)
|
||||||
|
else()
|
||||||
|
install(FILES COPYING DESTINATION "share/doc/${PROJECT_TARNAME}")
|
||||||
|
install(FILES README.md DESTINATION "share/doc/${PROJECT_TARNAME}")
|
||||||
|
install(FILES betagrph.wad DESTINATION "share/${PROJECT_TARNAME}")
|
||||||
|
install(FILES betalevl.wad DESTINATION "share/${PROJECT_TARNAME}")
|
||||||
|
install(FILES watermap.wad DESTINATION "share/${PROJECT_TARNAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Generate distribution packages with CPack.
|
||||||
|
if(WIN32)
|
||||||
|
set(CPACK_GENERATOR ZIP)
|
||||||
|
else()
|
||||||
|
set(CPACK_GENERATOR TGZ)
|
||||||
|
endif()
|
||||||
|
set(CPACK_SOURCE_GENERATOR TGZ ZIP)
|
||||||
|
set(CPACK_SOURCE_IGNORE_FILES "/.git/;/build;/.vs/;/out/;CMakeSettings.json")
|
||||||
|
set(CPACK_STRIP_FILES TRUE)
|
||||||
|
include(CPack)
|
||||||
|
|
||||||
|
# Where to find other CMakeLists.txt files.
|
||||||
|
add_subdirectory(data)
|
||||||
|
add_subdirectory(docs)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
add_subdirectory(Source)
|
||||||
|
add_subdirectory(toolsrc)
|
15
Makefile.am
15
Makefile.am
@ -1,15 +0,0 @@
|
|||||||
dist_doc_DATA = COPYING
|
|
||||||
|
|
||||||
dist_pkgdata_DATA = \
|
|
||||||
betagrph.wad \
|
|
||||||
betalevl.wad \
|
|
||||||
watermap.wad
|
|
||||||
|
|
||||||
SUBDIRS = \
|
|
||||||
configs \
|
|
||||||
data \
|
|
||||||
docs \
|
|
||||||
examples \
|
|
||||||
pkg \
|
|
||||||
Source \
|
|
||||||
toolsrc
|
|
15
README.md
15
README.md
@ -71,18 +71,27 @@ It can cloned via
|
|||||||
git clone https://github.com/fabiangreffrath/woof.git
|
git clone https://github.com/fabiangreffrath/woof.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Compilation should be as simple as
|
## Linux
|
||||||
|
|
||||||
|
You will need to install the SDL2, SDL2_mixer and SDL2_net libraries. Usually your distribution has these libraries in its repositories, and if your distribution has "dev" versions of those libraries, those are the ones you'll need.
|
||||||
|
|
||||||
|
Once installed, compilation should be as simple as:
|
||||||
|
|
||||||
```
|
```
|
||||||
cd woof
|
cd woof
|
||||||
autoreconf -fiv
|
mkdir build; cd build
|
||||||
./configure
|
cmake ..
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
After successful compilation the resulting binary can be found in the `Source/` directory.
|
After successful compilation the resulting binary can be found in the `Source/` directory.
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
|
||||||
|
Visual Studio 2019 comes with built-in support for CMake by opening the source tree as a folder. Otherwise, you should probably use the GUI tool included with CMake to set up the project and generate build files for your tool or IDE of choice.
|
||||||
|
|
||||||
|
CMake will almost certainly not be able to find SDL libraries by default. You will want to download the Windows development libraries for SDL2, SDL2_mixer, and SDL2_net. After you do so, extract them someplace, and then point the `SDL2_DIR`, `SDL2_MIXER_DIR` and `SDL2_NET_DIR` cache variables at the root directory of those extracted libraries. CMake should fill out the missing pieces.
|
||||||
|
|
||||||
# Contact
|
# Contact
|
||||||
|
|
||||||
The canonical homepage for Woof! is https://github.com/fabiangreffrath/woof
|
The canonical homepage for Woof! is https://github.com/fabiangreffrath/woof
|
||||||
|
150
Source/CMakeLists.txt
Normal file
150
Source/CMakeLists.txt
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
include(WoofSettings)
|
||||||
|
|
||||||
|
set(WOOF_SOURCES
|
||||||
|
am_map.c am_map.h
|
||||||
|
d_deh.c d_deh.h
|
||||||
|
d_englsh.h
|
||||||
|
d_event.h
|
||||||
|
d_french.h
|
||||||
|
d_io.h
|
||||||
|
d_items.c d_items.h
|
||||||
|
d_iwad.c d_iwad.h
|
||||||
|
d_main.c d_main.h
|
||||||
|
d_net.c d_net.h
|
||||||
|
d_player.h
|
||||||
|
d_textur.h
|
||||||
|
d_think.h
|
||||||
|
d_ticcmd.h
|
||||||
|
doomdata.h
|
||||||
|
doomdef.c doomdef.h
|
||||||
|
doomstat.c doomstat.h
|
||||||
|
doomtype.h
|
||||||
|
dstrings.c dstrings.h
|
||||||
|
f_finale.c f_finale.h
|
||||||
|
f_wipe.c f_wipe.h
|
||||||
|
g_game.c g_game.h
|
||||||
|
hu_lib.c hu_lib.h
|
||||||
|
hu_stuff.c hu_stuff.h
|
||||||
|
i_main.c
|
||||||
|
i_net.c i_net.h
|
||||||
|
i_savepng.c i_savepng.h
|
||||||
|
i_sound.c i_sound.h
|
||||||
|
i_system.c i_system.h
|
||||||
|
i_video.c i_video.h
|
||||||
|
info.c info.h
|
||||||
|
m_argv.c m_argv.h
|
||||||
|
m_bbox.c m_bbox.h
|
||||||
|
m_cheat.c m_cheat.h
|
||||||
|
m_fixed.h
|
||||||
|
m_menu.c m_menu.h
|
||||||
|
m_misc.c m_misc.h
|
||||||
|
m_misc2.c m_misc2.h
|
||||||
|
m_random.c m_random.h
|
||||||
|
m_swap.h
|
||||||
|
mmus2mid.c mmus2mid.h
|
||||||
|
p_ceilng.c
|
||||||
|
p_doors.c
|
||||||
|
p_enemy.c p_enemy.h
|
||||||
|
p_floor.c
|
||||||
|
p_genlin.c
|
||||||
|
p_inter.c p_inter.h
|
||||||
|
p_lights.c
|
||||||
|
p_map.c p_map.h
|
||||||
|
p_maputl.c p_maputl.h
|
||||||
|
p_mobj.c p_mobj.h
|
||||||
|
p_plats.c
|
||||||
|
p_pspr.c p_pspr.h
|
||||||
|
p_saveg.c p_saveg.h
|
||||||
|
p_setup.c p_setup.h
|
||||||
|
p_sight.c
|
||||||
|
p_spec.c p_spec.h
|
||||||
|
p_switch.c
|
||||||
|
p_telept.c
|
||||||
|
p_tick.c p_tick.h
|
||||||
|
p_user.c p_user.h
|
||||||
|
r_bsp.c r_bsp.h
|
||||||
|
r_data.c r_data.h
|
||||||
|
r_defs.h
|
||||||
|
r_draw.c r_draw.h
|
||||||
|
r_main.c r_main.h
|
||||||
|
r_plane.c r_plane.h
|
||||||
|
r_segs.c r_segs.h
|
||||||
|
r_sky.c r_sky.h
|
||||||
|
r_state.h
|
||||||
|
r_things.c r_things.h
|
||||||
|
s_sound.c s_sound.h
|
||||||
|
sounds.c sounds.h
|
||||||
|
statdump.c statdump.h
|
||||||
|
st_lib.c st_lib.h
|
||||||
|
st_stuff.c st_stuff.h
|
||||||
|
tables.c tables.h
|
||||||
|
v_video.c v_video.h
|
||||||
|
version.c version.h
|
||||||
|
w_wad.c w_wad.h
|
||||||
|
wi_stuff.c wi_stuff.h
|
||||||
|
z_zone.c z_zone.h)
|
||||||
|
|
||||||
|
# Some platforms require standard libraries to be linked against.
|
||||||
|
if(m_FOUND)
|
||||||
|
list(APPEND WOOF_LIBRARIES m)
|
||||||
|
endif()
|
||||||
|
if(dl_FOUND)
|
||||||
|
list(APPEND WOOF_LIBRARIES dl)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# Stamp out and compile resource file on Windows.
|
||||||
|
configure_file(resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
|
||||||
|
list(APPEND WOOF_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Standard target definition
|
||||||
|
add_executable(woof WIN32 ${WOOF_SOURCES})
|
||||||
|
target_woof_settings(woof)
|
||||||
|
target_include_directories(woof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
|
||||||
|
target_link_libraries(woof PRIVATE ${WOOF_LIBRARIES}
|
||||||
|
SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# MSVC tries to supply a default manifest and complains when it finds ours
|
||||||
|
# unless we specifically tell it not to.
|
||||||
|
set_target_properties(woof PROPERTIES LINK_FLAGS "/MANIFEST:NO")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Optional features.
|
||||||
|
#
|
||||||
|
# Our defines are not namespaced, so we pass them at compile-time instead of
|
||||||
|
# using config.h.
|
||||||
|
if("${${PROJECT_NAME}_INSTRUMENTED}")
|
||||||
|
target_compile_definitions(woof PRIVATE INSTRUMENTED)
|
||||||
|
endif()
|
||||||
|
if("${${PROJECT_NAME}_RANGECHECK}")
|
||||||
|
target_compile_definitions(woof PRIVATE RANGECHECK)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Copy library files to target directory.
|
||||||
|
if(SDL2_FILES)
|
||||||
|
add_custom_command(TARGET woof POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
|
${SDL2_FILES} $<TARGET_FILE_DIR:woof>)
|
||||||
|
endif()
|
||||||
|
if(SDL2_MIXER_FILES)
|
||||||
|
add_custom_command(TARGET woof POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
|
${SDL2_MIXER_FILES} $<TARGET_FILE_DIR:woof>)
|
||||||
|
endif()
|
||||||
|
if(SDL2_NET_FILES)
|
||||||
|
add_custom_command(TARGET woof POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
|
${SDL2_NET_FILES} $<TARGET_FILE_DIR:woof>)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Files to package in our distribution.
|
||||||
|
if(WIN32)
|
||||||
|
install(TARGETS woof RUNTIME DESTINATION .)
|
||||||
|
else()
|
||||||
|
install(TARGETS woof RUNTIME DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
install(FILES ${SDL2_FILES} DESTINATION .)
|
||||||
|
install(FILES ${SDL2_MIXER_FILES} DESTINATION .)
|
||||||
|
install(FILES ${SDL2_NET_FILES} DESTINATION .)
|
@ -1,111 +0,0 @@
|
|||||||
bin_PROGRAMS = woof
|
|
||||||
|
|
||||||
SOURCE_FILES = \
|
|
||||||
am_map.c am_map.h \
|
|
||||||
d_deh.c d_deh.h \
|
|
||||||
d_englsh.h \
|
|
||||||
d_event.h \
|
|
||||||
d_french.h \
|
|
||||||
d_io.h \
|
|
||||||
d_items.c d_items.h \
|
|
||||||
d_iwad.c d_iwad.h \
|
|
||||||
d_main.c d_main.h \
|
|
||||||
d_net.c d_net.h \
|
|
||||||
d_player.h \
|
|
||||||
d_textur.h \
|
|
||||||
d_think.h \
|
|
||||||
d_ticcmd.h \
|
|
||||||
doomdata.h \
|
|
||||||
doomdef.c doomdef.h \
|
|
||||||
doomstat.c doomstat.h \
|
|
||||||
doomtype.h \
|
|
||||||
dstrings.c dstrings.h \
|
|
||||||
f_finale.c f_finale.h \
|
|
||||||
f_wipe.c f_wipe.h \
|
|
||||||
g_game.c g_game.h \
|
|
||||||
hu_lib.c hu_lib.h \
|
|
||||||
hu_stuff.c hu_stuff.h \
|
|
||||||
i_main.c \
|
|
||||||
i_net.c i_net.h \
|
|
||||||
i_savepng.c i_savepng.h \
|
|
||||||
i_sound.c i_sound.h \
|
|
||||||
i_system.c i_system.h \
|
|
||||||
i_video.c i_video.h \
|
|
||||||
info.c info.h \
|
|
||||||
m_argv.c m_argv.h \
|
|
||||||
m_bbox.c m_bbox.h \
|
|
||||||
m_cheat.c m_cheat.h \
|
|
||||||
m_fixed.h \
|
|
||||||
m_menu.c m_menu.h \
|
|
||||||
m_misc.c m_misc.h \
|
|
||||||
m_misc2.c m_misc2.h \
|
|
||||||
m_random.c m_random.h \
|
|
||||||
m_swap.h \
|
|
||||||
mmus2mid.c mmus2mid.h \
|
|
||||||
p_ceilng.c \
|
|
||||||
p_doors.c \
|
|
||||||
p_enemy.c p_enemy.h \
|
|
||||||
p_floor.c \
|
|
||||||
p_genlin.c \
|
|
||||||
p_inter.c p_inter.h \
|
|
||||||
p_lights.c \
|
|
||||||
p_map.c p_map.h \
|
|
||||||
p_maputl.c p_maputl.h \
|
|
||||||
p_mobj.c p_mobj.h \
|
|
||||||
p_plats.c \
|
|
||||||
p_pspr.c p_pspr.h \
|
|
||||||
p_saveg.c p_saveg.h \
|
|
||||||
p_setup.c p_setup.h \
|
|
||||||
p_sight.c \
|
|
||||||
p_spec.c p_spec.h \
|
|
||||||
p_switch.c \
|
|
||||||
p_telept.c \
|
|
||||||
p_tick.c p_tick.h \
|
|
||||||
p_user.c p_user.h \
|
|
||||||
r_bsp.c r_bsp.h \
|
|
||||||
r_data.c r_data.h \
|
|
||||||
r_defs.h \
|
|
||||||
r_draw.c r_draw.h \
|
|
||||||
r_main.c r_main.h \
|
|
||||||
r_plane.c r_plane.h \
|
|
||||||
r_segs.c r_segs.h \
|
|
||||||
r_sky.c r_sky.h \
|
|
||||||
r_state.h \
|
|
||||||
r_things.c r_things.h \
|
|
||||||
s_sound.c s_sound.h \
|
|
||||||
sounds.c sounds.h \
|
|
||||||
statdump.c statdump.h \
|
|
||||||
st_lib.c st_lib.h \
|
|
||||||
st_stuff.c st_stuff.h \
|
|
||||||
tables.c tables.h \
|
|
||||||
v_video.c v_video.h \
|
|
||||||
version.c version.h \
|
|
||||||
w_wad.c w_wad.h \
|
|
||||||
wi_stuff.c wi_stuff.h \
|
|
||||||
z_zone.c z_zone.h
|
|
||||||
|
|
||||||
if HAVE_WINDRES
|
|
||||||
woof_SOURCES = $(SOURCE_FILES) resource.rc
|
|
||||||
else
|
|
||||||
woof_SOURCES = $(SOURCE_FILES)
|
|
||||||
endif
|
|
||||||
|
|
||||||
woof_CFLAGS = @SDL_CFLAGS@ @SDL_mixer_CFLAGS@ @SDL_net_CFLAGS@
|
|
||||||
woof_LDADD = @SDL_LIBS@ @SDL_mixer_LIBS@ @SDL_net_LIBS@
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
beta.c \
|
|
||||||
dogs.c \
|
|
||||||
icon.c \
|
|
||||||
manifest.xml \
|
|
||||||
resource.rc.in
|
|
||||||
|
|
||||||
.rc.o:
|
|
||||||
$(WINDRES) $< -o $@
|
|
||||||
%.o : %.rc
|
|
||||||
$(WINDRES) $< -o $@
|
|
||||||
|
|
||||||
if HAVE_PYTHON
|
|
||||||
icon.c : $(top_builddir)/data/woof.png
|
|
||||||
$(top_builddir)/data/convert-icon $(top_builddir)/data/woof.png $@
|
|
||||||
endif
|
|
@ -605,7 +605,7 @@ char *D_DoomPrefDir(void)
|
|||||||
// ~/.local/share/chocolate-doom. On Windows, we behave like
|
// ~/.local/share/chocolate-doom. On Windows, we behave like
|
||||||
// Vanilla Doom and save in the current directory.
|
// Vanilla Doom and save in the current directory.
|
||||||
|
|
||||||
result = SDL_GetPrefPath("", PACKAGE_TARNAME);
|
result = SDL_GetPrefPath("", PROJECT_TARNAME);
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
dir = M_StringDuplicate(result);
|
dir = M_StringDuplicate(result);
|
||||||
|
@ -33,16 +33,14 @@
|
|||||||
// This must come first, since it redefines malloc(), free(), etc. -- killough:
|
// This must come first, since it redefines malloc(), free(), etc. -- killough:
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
@ -30,13 +30,11 @@
|
|||||||
#ifndef __DOOMTYPE__
|
#ifndef __DOOMTYPE__
|
||||||
#define __DOOMTYPE__
|
#define __DOOMTYPE__
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stddef.h> // [FG] NULL
|
#include <stddef.h> // [FG] NULL
|
||||||
#include <stdint.h> // [FG] intptr_t types
|
#include <stdint.h> // [FG] intptr_t types
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef __BYTEBOOL__
|
#ifndef __BYTEBOOL__
|
||||||
#define __BYTEBOOL__
|
#define __BYTEBOOL__
|
||||||
// Fixed to use builtin bool type with C++.
|
// Fixed to use builtin bool type with C++.
|
||||||
|
@ -20,13 +20,11 @@
|
|||||||
// Dynamically load SDL2_Image for PNG screenshots.
|
// Dynamically load SDL2_Image for PNG screenshots.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef dl_FOUND
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@ -38,7 +36,7 @@
|
|||||||
savepng_t SavePNG = NULL;
|
savepng_t SavePNG = NULL;
|
||||||
|
|
||||||
static const char *sdl2_image_libs[] = {
|
static const char *sdl2_image_libs[] = {
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef dl_FOUND
|
||||||
"libSDL2_image-2.0.so.0",
|
"libSDL2_image-2.0.so.0",
|
||||||
"libSDL2_image-2.0.so",
|
"libSDL2_image-2.0.so",
|
||||||
"libSDL2_image.so",
|
"libSDL2_image.so",
|
||||||
@ -61,7 +59,7 @@ void I_InitSavePNG (void)
|
|||||||
|
|
||||||
for (i = 0; i < sizeof(sdl2_image_libs) / sizeof(*sdl2_image_libs); i++)
|
for (i = 0; i < sizeof(sdl2_image_libs) / sizeof(*sdl2_image_libs); i++)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef dl_FOUND
|
||||||
sdl2_image_lib = dlopen(sdl2_image_libs[i], RTLD_LAZY);
|
sdl2_image_lib = dlopen(sdl2_image_libs[i], RTLD_LAZY);
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
sdl2_image_lib = LoadLibrary(TEXT(sdl2_image_libs[i]));
|
sdl2_image_lib = LoadLibrary(TEXT(sdl2_image_libs[i]));
|
||||||
@ -74,7 +72,7 @@ void I_InitSavePNG (void)
|
|||||||
|
|
||||||
if (sdl2_image_lib != NULL)
|
if (sdl2_image_lib != NULL)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef dl_FOUND
|
||||||
savepng_func = dlsym(sdl2_image_lib, "IMG_SavePNG");
|
savepng_func = dlsym(sdl2_image_lib, "IMG_SavePNG");
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
savepng_func = GetProcAddress(sdl2_image_lib, "IMG_SavePNG");
|
savepng_func = GetProcAddress(sdl2_image_lib, "IMG_SavePNG");
|
||||||
|
@ -325,7 +325,7 @@ void I_Error(const char *error, ...) // killough 3/20/98: add const
|
|||||||
if (exit_gui_popup && !I_ConsoleStdout())
|
if (exit_gui_popup && !I_ConsoleStdout())
|
||||||
{
|
{
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
PACKAGE_STRING, errmsg, NULL);
|
PROJECT_STRING, errmsg, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!has_exited) // If it hasn't exited yet, exit now -- killough
|
if(!has_exited) // If it hasn't exited yet, exit now -- killough
|
||||||
@ -341,7 +341,7 @@ void I_Error(const char *error, ...) // killough 3/20/98: add const
|
|||||||
void I_EndDoom(void)
|
void I_EndDoom(void)
|
||||||
{
|
{
|
||||||
// haleyjd
|
// haleyjd
|
||||||
puts("\n" PACKAGE_NAME" exiting.\n");
|
puts("\n" PROJECT_NAME" exiting.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -977,7 +977,7 @@ static void I_InitGraphicsMode(void)
|
|||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetWindowTitle(screen, PACKAGE_STRING);
|
SDL_SetWindowTitle(screen, PROJECT_STRING);
|
||||||
I_InitWindowIcon();
|
I_InitWindowIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,7 @@
|
|||||||
#ifndef __INFO__
|
#ifndef __INFO__
|
||||||
#define __INFO__
|
#define __INFO__
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
// Needed for action function pointer handling.
|
// Needed for action function pointer handling.
|
||||||
#include "d_think.h"
|
#include "d_think.h"
|
||||||
|
@ -4157,7 +4157,7 @@ setup_menu_t cred_settings[]={
|
|||||||
void M_DrawCredits(void) // killough 10/98: credit screen
|
void M_DrawCredits(void) // killough 10/98: credit screen
|
||||||
{
|
{
|
||||||
char mbftext_s[32];
|
char mbftext_s[32];
|
||||||
sprintf(mbftext_s, PACKAGE_STRING);
|
sprintf(mbftext_s, PROJECT_STRING);
|
||||||
inhelpscreens = true;
|
inhelpscreens = true;
|
||||||
M_DrawBackground(gamemode==shareware ? "CEIL5_1" : "MFLR8_4", screens[0]);
|
M_DrawBackground(gamemode==shareware ? "CEIL5_1" : "MFLR8_4", screens[0]);
|
||||||
M_DrawTitle(42,9,"MBFTEXT",mbftext_s);
|
M_DrawTitle(42,9,"MBFTEXT",mbftext_s);
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
1 ICON "@top_srcdir@/data/woof.ico"
|
1 ICON "@PROJECT_SOURCE_DIR@/data/woof.ico"
|
||||||
|
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
|
|
||||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "@top_srcdir@/Source/manifest.xml"
|
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "@CMAKE_CURRENT_SOURCE_DIR@/manifest.xml"
|
||||||
|
|
||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
PRODUCTVERSION @WINDOWS_RC_VERSION@
|
PRODUCTVERSION @PROJECT_VERSION_RC@
|
||||||
FILEVERSION @WINDOWS_RC_VERSION@
|
FILEVERSION @PROJECT_VERSION_RC@
|
||||||
FILETYPE 1
|
FILETYPE 1
|
||||||
{
|
{
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
{
|
{
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
{
|
{
|
||||||
VALUE "FileVersion", "@PACKAGE_VERSION@.0"
|
VALUE "FileVersion", "@PROJECT_VERSION@"
|
||||||
VALUE "FileDescription", "@PACKAGE_STRING@"
|
VALUE "FileDescription", "@PROJECT_DESCRIPTION@"
|
||||||
VALUE "InternalName", "@PACKAGE_TARNAME@"
|
VALUE "InternalName", "@PROJECT_TARNAME@"
|
||||||
VALUE "CompanyName", "@PACKAGE_BUGREPORT@"
|
VALUE "CompanyName", "@PROJECT_COMPANY@"
|
||||||
VALUE "LegalCopyright", "@PACKAGE_COPYRIGHT@. Licensed under @PACKAGE_LICENSE@"
|
VALUE "LegalCopyright", "@PROJECT_COPYRIGHT@. Licensed under @PROJECT_LICENSE@"
|
||||||
VALUE "ProductName", "@PACKAGE_NAME@"
|
VALUE "ProductName", "@PROJECT_NAME@"
|
||||||
VALUE "ProductVersion", "@PACKAGE_VERSION@"
|
VALUE "ProductVersion", "@PROJECT_VERSION@"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@ -30,9 +30,7 @@
|
|||||||
#ifndef __SOUNDS__
|
#ifndef __SOUNDS__
|
||||||
#define __SOUNDS__
|
#define __SOUNDS__
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// SoundFX struct.
|
// SoundFX struct.
|
||||||
|
24
WoofInstall.cmake.in
Normal file
24
WoofInstall.cmake.in
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# This script is stamped out by CMake and run by `make install`.
|
||||||
|
|
||||||
|
set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
|
||||||
|
set(PROJECT_BINARY_DIR "@PROJECT_BINARY_DIR@")
|
||||||
|
set(Python3_EXECUTABLE "@Python3_EXECUTABLE@")
|
||||||
|
set(WIN32 "@WIN32@")
|
||||||
|
|
||||||
|
function(win_textfile SOURCE DESTINATION)
|
||||||
|
execute_process(COMMAND
|
||||||
|
"${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/win-textfile"
|
||||||
|
"${SOURCE}" "${DESTINATION}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(NOT Python3_EXECUTABLE)
|
||||||
|
message(FATAL_ERROR "Python 3 not found, can't run install scripts.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Convert text files to a format Windows Notepad can read without issue.
|
||||||
|
win_textfile(
|
||||||
|
"${PROJECT_SOURCE_DIR}/COPYING" "${PROJECT_BINARY_DIR}/COPYING.txt")
|
||||||
|
win_textfile(
|
||||||
|
"${PROJECT_SOURCE_DIR}/README.md" "${PROJECT_BINARY_DIR}/README.txt")
|
||||||
|
endif()
|
6
cmake/CrossToWin32.cmake
Normal file
6
cmake/CrossToWin32.cmake
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Toolchain file to cross-compile from Linux to 32-bit Windows
|
||||||
|
set(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
set(CMAKE_SYSTEM_PROCESSOR x86)
|
||||||
|
|
||||||
|
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
|
||||||
|
set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
|
6
cmake/CrossToWin64.cmake
Normal file
6
cmake/CrossToWin64.cmake
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Toolchain file to cross-compile from Linux to 64-bit Windows
|
||||||
|
set(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
set(CMAKE_SYSTEM_PROCESSOR x64)
|
||||||
|
|
||||||
|
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||||
|
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
154
cmake/FindSDL2.cmake
Normal file
154
cmake/FindSDL2.cmake
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
# FindSDL2.cmake
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018, Alex Mayfield <alexmax2742@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the <organization> nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Currently works with the following generators:
|
||||||
|
# - Unix Makefiles (Linux, MSYS2, Linux MinGW)
|
||||||
|
# - Ninja (Linux, MSYS2, Linux MinGW)
|
||||||
|
# - Visual Studio
|
||||||
|
|
||||||
|
# Cache variable that allows you to point CMake at a directory containing
|
||||||
|
# an extracted development library.
|
||||||
|
set(SDL2_DIR "${SDL2_DIR}" CACHE PATH "Location of SDL2 library directory")
|
||||||
|
|
||||||
|
# Use pkg-config to find library locations in *NIX environments.
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_search_module(PC_SDL2 QUIET sdl2)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the include directory.
|
||||||
|
if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
|
||||||
|
find_path(SDL2_INCLUDE_DIR "SDL_version.h"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_DIR}/include"
|
||||||
|
"${SDL2_DIR}/include/SDL2"
|
||||||
|
"${SDL2_DIR}/x86_64-w64-mingw32/include/SDL2"
|
||||||
|
${PC_SDL2_INCLUDE_DIRS})
|
||||||
|
else()
|
||||||
|
find_path(SDL2_INCLUDE_DIR "SDL_version.h"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_DIR}/include"
|
||||||
|
"${SDL2_DIR}/include/SDL2"
|
||||||
|
"${SDL2_DIR}/i686-w64-mingw32/include/SDL2"
|
||||||
|
${PC_SDL2_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the version. Taken and modified from CMake's FindSDL.cmake.
|
||||||
|
if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL_version.h")
|
||||||
|
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
|
||||||
|
set(SDL2_VERSION "${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH}")
|
||||||
|
unset(SDL2_VERSION_MAJOR_LINE)
|
||||||
|
unset(SDL2_VERSION_MINOR_LINE)
|
||||||
|
unset(SDL2_VERSION_PATCH_LINE)
|
||||||
|
unset(SDL2_VERSION_MAJOR)
|
||||||
|
unset(SDL2_VERSION_MINOR)
|
||||||
|
unset(SDL2_VERSION_PATCH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the SDL2 and SDL2main libraries
|
||||||
|
if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
|
||||||
|
find_library(SDL2_LIBRARY "SDL2"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_DIR}/lib"
|
||||||
|
"${SDL2_DIR}/lib/x64"
|
||||||
|
"${SDL2_DIR}/x86_64-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_LIBRARY_DIRS})
|
||||||
|
find_library(SDL2_MAIN_LIBRARY "SDL2main"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_DIR}/lib"
|
||||||
|
"${SDL2_DIR}/lib/x64"
|
||||||
|
"${SDL2_DIR}/x86_64-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_LIBRARY_DIRS})
|
||||||
|
else()
|
||||||
|
find_library(SDL2_LIBRARY "SDL2"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_DIR}/lib"
|
||||||
|
"${SDL2_DIR}/lib/x86"
|
||||||
|
"${SDL2_DIR}/i686-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_LIBRARY_DIRS})
|
||||||
|
find_library(SDL2_MAIN_LIBRARY "SDL2main"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_DIR}/lib"
|
||||||
|
"${SDL2_DIR}/lib/x86"
|
||||||
|
"${SDL2_DIR}/i686-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_LIBRARY_DIRS})
|
||||||
|
endif()
|
||||||
|
set(SDL2_LIBRARIES "${SDL2_MAIN_LIBRARY}" "${SDL2_LIBRARY}")
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SDL2
|
||||||
|
FOUND_VAR SDL2_FOUND
|
||||||
|
REQUIRED_VARS SDL2_INCLUDE_DIR SDL2_LIBRARIES
|
||||||
|
VERSION_VAR SDL2_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
|
if(SDL2_FOUND)
|
||||||
|
# SDL2 imported target.
|
||||||
|
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||||
|
INTERFACE_COMPILE_OPTIONS "${PC_SDL2_CFLAGS_OTHER}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LOCATION "${SDL2_LIBRARY}")
|
||||||
|
|
||||||
|
# SDL2main imported target.
|
||||||
|
if(MINGW)
|
||||||
|
# Gross hack to get mingw32 first in the linker order.
|
||||||
|
add_library(SDL2::_SDL2main_detail UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(SDL2::_SDL2main_detail PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${SDL2_MAIN_LIBRARY}")
|
||||||
|
|
||||||
|
# Ensure that SDL2main comes before SDL2 in the linker order. CMake
|
||||||
|
# isn't smart enough to keep proper ordering for indirect dependencies
|
||||||
|
# so we have to spell it out here.
|
||||||
|
target_link_libraries(SDL2::_SDL2main_detail INTERFACE SDL2::SDL2)
|
||||||
|
|
||||||
|
add_library(SDL2::SDL2main INTERFACE IMPORTED)
|
||||||
|
set_target_properties(SDL2::SDL2main PROPERTIES
|
||||||
|
IMPORTED_LIBNAME mingw32)
|
||||||
|
target_link_libraries(SDL2::SDL2main INTERFACE SDL2::_SDL2main_detail)
|
||||||
|
else()
|
||||||
|
add_library(SDL2::SDL2main UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(SDL2::SDL2main PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${SDL2_MAIN_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# On Windows, we need to figure out the location of our library files
|
||||||
|
# so we can copy and package them.
|
||||||
|
get_filename_component(SDL2_LIBRARY_DIR "${SDL2_LIBRARY}" DIRECTORY)
|
||||||
|
file(GLOB SDL2_FILES "${SDL2_LIBRARY_DIR}/*.dll")
|
||||||
|
if(NOT SDL2_FILES)
|
||||||
|
file(GLOB SDL2_FILES "${SDL2_LIBRARY_DIR}/../bin/*.dll")
|
||||||
|
endif()
|
||||||
|
set(SDL2_FILES "${SDL2_FILES}" CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
endif()
|
121
cmake/FindSDL2_mixer.cmake
Normal file
121
cmake/FindSDL2_mixer.cmake
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# FindSDL2_mixer.cmake
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018, Alex Mayfield <alexmax2742@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the <organization> nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Currently works with the following generators:
|
||||||
|
# - Unix Makefiles (Linux, MSYS2, Linux MinGW)
|
||||||
|
# - Ninja (Linux, MSYS2, Linux MinGW)
|
||||||
|
# - Visual Studio
|
||||||
|
|
||||||
|
# Cache variable that allows you to point CMake at a directory containing
|
||||||
|
# an extracted development library.
|
||||||
|
set(SDL2_MIXER_DIR "${SDL2_MIXER_DIR}" CACHE PATH "Location of SDL2_mixer library directory")
|
||||||
|
|
||||||
|
# Use pkg-config to find library locations in *NIX environments.
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_search_module(PC_SDL2_MIXER QUIET SDL2_mixer)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the include directory.
|
||||||
|
if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
|
||||||
|
find_path(SDL2_MIXER_INCLUDE_DIR "SDL_mixer.h"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_MIXER_DIR}/include"
|
||||||
|
"${SDL2_MIXER_DIR}/include/SDL2"
|
||||||
|
"${SDL2_MIXER_DIR}/x86_64-w64-mingw32/include/SDL2"
|
||||||
|
${PC_SDL2_MIXER_INCLUDE_DIRS})
|
||||||
|
else()
|
||||||
|
find_path(SDL2_MIXER_INCLUDE_DIR "SDL_mixer.h"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_MIXER_DIR}/include"
|
||||||
|
"${SDL2_MIXER_DIR}/include/SDL2"
|
||||||
|
"${SDL2_MIXER_DIR}/i686-w64-mingw32/include/SDL2"
|
||||||
|
${PC_SDL2_MIXER_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the version. Taken and modified from CMake's FindSDL.cmake.
|
||||||
|
if(SDL2_MIXER_INCLUDE_DIR AND EXISTS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h")
|
||||||
|
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MAJOR "${SDL2_MIXER_VERSION_MAJOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MINOR "${SDL2_MIXER_VERSION_MINOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_PATCH "${SDL2_MIXER_VERSION_PATCH_LINE}")
|
||||||
|
set(SDL2_MIXER_VERSION "${SDL2_MIXER_VERSION_MAJOR}.${SDL2_MIXER_VERSION_MINOR}.${SDL2_MIXER_VERSION_PATCH}")
|
||||||
|
unset(SDL2_MIXER_VERSION_MAJOR_LINE)
|
||||||
|
unset(SDL2_MIXER_VERSION_MINOR_LINE)
|
||||||
|
unset(SDL2_MIXER_VERSION_PATCH_LINE)
|
||||||
|
unset(SDL2_MIXER_VERSION_MAJOR)
|
||||||
|
unset(SDL2_MIXER_VERSION_MINOR)
|
||||||
|
unset(SDL2_MIXER_VERSION_PATCH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the library.
|
||||||
|
if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
|
||||||
|
find_library(SDL2_MIXER_LIBRARY "SDL2_mixer"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_MIXER_DIR}/lib"
|
||||||
|
"${SDL2_MIXER_DIR}/lib/x64"
|
||||||
|
"${SDL2_MIXER_DIR}/x86_64-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_MIXER_LIBRARY_DIRS})
|
||||||
|
else()
|
||||||
|
find_library(SDL2_MIXER_LIBRARY "SDL2_mixer"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_MIXER_DIR}/lib"
|
||||||
|
"${SDL2_MIXER_DIR}/lib/x86"
|
||||||
|
"${SDL2_MIXER_DIR}/i686-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_MIXER_LIBRARY_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SDL2_mixer
|
||||||
|
FOUND_VAR SDL2_MIXER_FOUND
|
||||||
|
REQUIRED_VARS SDL2_MIXER_INCLUDE_DIR SDL2_MIXER_LIBRARY
|
||||||
|
VERSION_VAR SDL2_MIXER_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
|
if(SDL2_MIXER_FOUND)
|
||||||
|
# Imported target.
|
||||||
|
add_library(SDL2::mixer UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(SDL2::mixer PROPERTIES
|
||||||
|
INTERFACE_COMPILE_OPTIONS "${PC_SDL2_MIXER_CFLAGS_OTHER}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_MIXER_INCLUDE_DIR}"
|
||||||
|
INTERFACE_LINK_LIBRARIES SDL2::SDL2
|
||||||
|
IMPORTED_LOCATION "${SDL2_MIXER_LIBRARY}")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# On Windows, we need to figure out the location of our library files
|
||||||
|
# so we can copy and package them.
|
||||||
|
get_filename_component(
|
||||||
|
SDL2_MIXER_LIBRARY_DIR "${SDL2_MIXER_LIBRARY}" DIRECTORY)
|
||||||
|
file(GLOB SDL2_MIXER_FILES "${SDL2_MIXER_LIBRARY_DIR}/*.dll")
|
||||||
|
if(NOT SDL2_MIXER_FILES)
|
||||||
|
file(GLOB SDL2_MIXER_FILES "${SDL2_MIXER_LIBRARY_DIR}/../bin/*.dll")
|
||||||
|
endif()
|
||||||
|
set(SDL2_MIXER_FILES "${SDL2_MIXER_FILES}" CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
endif()
|
121
cmake/FindSDL2_net.cmake
Normal file
121
cmake/FindSDL2_net.cmake
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# FindSDL2_net.cmake
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018, Alex Mayfield <alexmax2742@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the <organization> nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Currently works with the following generators:
|
||||||
|
# - Unix Makefiles (Linux, MSYS2, Linux MinGW)
|
||||||
|
# - Ninja (Linux, MSYS2, Linux MinGW)
|
||||||
|
# - Visual Studio
|
||||||
|
|
||||||
|
# Cache variable that allows you to point CMake at a directory containing
|
||||||
|
# an extracted development library.
|
||||||
|
set(SDL2_NET_DIR "${SDL2_NET_DIR}" CACHE PATH "Location of SDL2_net library directory")
|
||||||
|
|
||||||
|
# Use pkg-config to find library locations in *NIX environments.
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_search_module(PC_SDL2_NET QUIET SDL2_net)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the include directory.
|
||||||
|
if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
|
||||||
|
find_path(SDL2_NET_INCLUDE_DIR "SDL_net.h"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_NET_DIR}/include"
|
||||||
|
"${SDL2_NET_DIR}/include/SDL2"
|
||||||
|
"${SDL2_NET_DIR}/x86_64-w64-mingw32/include/SDL2"
|
||||||
|
${PC_SDL2_NET_INCLUDE_DIRS})
|
||||||
|
else()
|
||||||
|
find_path(SDL2_NET_INCLUDE_DIR "SDL_net.h"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_NET_DIR}/include"
|
||||||
|
"${SDL2_NET_DIR}/include/SDL2"
|
||||||
|
"${SDL2_NET_DIR}/i686-w64-mingw32/include/SDL2"
|
||||||
|
${PC_SDL2_NET_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the version. Taken and modified from CMake's FindSDL.cmake.
|
||||||
|
if(SDL2_NET_INCLUDE_DIR AND EXISTS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h")
|
||||||
|
file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_MAJOR "${SDL2_NET_VERSION_MAJOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_MINOR "${SDL2_NET_VERSION_MINOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_PATCH "${SDL2_NET_VERSION_PATCH_LINE}")
|
||||||
|
set(SDL2_NET_VERSION "${SDL2_NET_VERSION_MAJOR}.${SDL2_NET_VERSION_MINOR}.${SDL2_NET_VERSION_PATCH}")
|
||||||
|
unset(SDL2_NET_VERSION_MAJOR_LINE)
|
||||||
|
unset(SDL2_NET_VERSION_MINOR_LINE)
|
||||||
|
unset(SDL2_NET_VERSION_PATCH_LINE)
|
||||||
|
unset(SDL2_NET_VERSION_MAJOR)
|
||||||
|
unset(SDL2_NET_VERSION_MINOR)
|
||||||
|
unset(SDL2_NET_VERSION_PATCH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find the library.
|
||||||
|
if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
|
||||||
|
find_library(SDL2_NET_LIBRARY "SDL2_net"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_NET_DIR}/lib"
|
||||||
|
"${SDL2_NET_DIR}/lib/x64"
|
||||||
|
"${SDL2_NET_DIR}/x86_64-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_NET_LIBRARY_DIRS})
|
||||||
|
else()
|
||||||
|
find_library(SDL2_NET_LIBRARY "SDL2_net"
|
||||||
|
HINTS
|
||||||
|
"${SDL2_NET_DIR}/lib"
|
||||||
|
"${SDL2_NET_DIR}/lib/x86"
|
||||||
|
"${SDL2_NET_DIR}/i686-w64-mingw32/lib"
|
||||||
|
${PC_SDL2_NET_LIBRARY_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SDL2_net
|
||||||
|
FOUND_VAR SDL2_NET_FOUND
|
||||||
|
REQUIRED_VARS SDL2_NET_INCLUDE_DIR SDL2_NET_LIBRARY
|
||||||
|
VERSION_VAR SDL2_NET_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
|
if(SDL2_NET_FOUND)
|
||||||
|
# Imported target.
|
||||||
|
add_library(SDL2::net UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(SDL2::net PROPERTIES
|
||||||
|
INTERFACE_COMPILE_OPTIONS "${PC_SDL2_NET_CFLAGS_OTHER}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_NET_INCLUDE_DIR}"
|
||||||
|
INTERFACE_LINK_LIBRARIES SDL2::SDL2
|
||||||
|
IMPORTED_LOCATION "${SDL2_NET_LIBRARY}")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# On Windows, we need to figure out the location of our library files
|
||||||
|
# so we can copy and package them.
|
||||||
|
get_filename_component(
|
||||||
|
SDL2_NET_LIBRARY_DIR "${SDL2_NET_LIBRARY}" DIRECTORY)
|
||||||
|
file(GLOB SDL2_NET_FILES "${SDL2_NET_LIBRARY_DIR}/*.dll")
|
||||||
|
if(NOT SDL2_NET_FILES)
|
||||||
|
file(GLOB SDL2_NET_FILES "${SDL2_NET_LIBRARY_DIR}/../bin/*.dll")
|
||||||
|
endif()
|
||||||
|
set(SDL2_NET_FILES "${SDL2_NET_FILES}" CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
endif()
|
66
cmake/WoofSettings.cmake
Normal file
66
cmake/WoofSettings.cmake
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# Add woof settings to a target.
|
||||||
|
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
|
# Ninja can suppress colored output, toggle this to enable it again.
|
||||||
|
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE)
|
||||||
|
|
||||||
|
# Add compiler option if compiler supports it.
|
||||||
|
function(_checked_add_compile_option FLAG)
|
||||||
|
# Turn flag into suitable internal cache variable.
|
||||||
|
string(REGEX REPLACE "-(.*)" "CFLAG_\\1" FLAG_FOUND ${FLAG})
|
||||||
|
string(REPLACE "=" "_" FLAG_FOUND "${FLAG_FOUND}")
|
||||||
|
|
||||||
|
check_c_compiler_flag(${FLAG} ${FLAG_FOUND})
|
||||||
|
if(${FLAG_FOUND})
|
||||||
|
set(COMMON_COMPILE_OPTIONS ${COMMON_COMPILE_OPTIONS} ${FLAG} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Parameters we want to check for on all compilers.
|
||||||
|
#
|
||||||
|
# Note that we want to check for these, even on MSVC, because some compilers
|
||||||
|
# that pretend to be MSVC can take both GCC and MSVC-style parameters at the
|
||||||
|
# same time, like clang-cl.exe.
|
||||||
|
|
||||||
|
_checked_add_compile_option(-Wdeclaration-after-statement)
|
||||||
|
_checked_add_compile_option(-Werror=implicit-function-declaration)
|
||||||
|
_checked_add_compile_option(-Werror=incompatible-pointer-types)
|
||||||
|
_checked_add_compile_option(-Werror=int-conversion)
|
||||||
|
_checked_add_compile_option(-Wformat=2)
|
||||||
|
_checked_add_compile_option(-Wnull-dereference)
|
||||||
|
_checked_add_compile_option(-Wredundant-decls)
|
||||||
|
_checked_add_compile_option(-Wrestrict)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# Silence the usual warnings for POSIX and standard C functions.
|
||||||
|
list(APPEND COMMON_COMPILE_OPTIONS "/D_CRT_NONSTDC_NO_DEPRECATE")
|
||||||
|
list(APPEND COMMON_COMPILE_OPTIONS "/D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
|
||||||
|
# Default warning setting for MSVC.
|
||||||
|
_checked_add_compile_option(/W3)
|
||||||
|
|
||||||
|
# Extra warnings for cl.exe.
|
||||||
|
_checked_add_compile_option(/we4013) # Implicit function declaration.
|
||||||
|
_checked_add_compile_option(/we4133) # Incompatible types.
|
||||||
|
_checked_add_compile_option(/we4477) # Format string mismatch.
|
||||||
|
|
||||||
|
# Extra warnings for clang-cl.exe - prevents warning spam in SDL headers.
|
||||||
|
_checked_add_compile_option(-Wno-pragma-pack)
|
||||||
|
else()
|
||||||
|
# We only want -Wall on GCC compilers, since /Wall on MSVC is noisy.
|
||||||
|
_checked_add_compile_option(-Wall)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${FORCE_COLORED_OUTPUT})
|
||||||
|
_checked_add_compile_option(-fdiagnostics-color=always F_DIAG_COLOR)
|
||||||
|
if (NOT F_DIAG_COLOR)
|
||||||
|
_checked_add_compile_option(-fcolor-diagnostics F_COLOR_DIAG)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
function(target_woof_settings)
|
||||||
|
foreach(target ${ARGN})
|
||||||
|
target_compile_options(${target} PRIVATE ${COMMON_COMPILE_OPTIONS})
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
4
config.h.in
Normal file
4
config.h.in
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#cmakedefine PROJECT_NAME "@PROJECT_NAME@"
|
||||||
|
#cmakedefine PROJECT_STRING "@PROJECT_STRING@"
|
||||||
|
#cmakedefine PROJECT_TARNAME "@PROJECT_TARNAME@"
|
||||||
|
#cmakedefine dl_FOUND
|
@ -1,4 +0,0 @@
|
|||||||
EXTRA_DIST = \
|
|
||||||
common.cfg \
|
|
||||||
doom17.dat \
|
|
||||||
doom19.dat
|
|
82
configure.ac
82
configure.ac
@ -1,82 +0,0 @@
|
|||||||
# -*- Autoconf -*-
|
|
||||||
# Process this file with autoconf to produce a configure script.
|
|
||||||
|
|
||||||
AC_PREREQ([2.69])
|
|
||||||
AC_INIT([Woof], [0.9.0])
|
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
|
||||||
AC_CONFIG_SRCDIR([Source/version.c])
|
|
||||||
AC_CONFIG_HEADERS([config.h])
|
|
||||||
|
|
||||||
PACKAGE_COPYRIGHT="Copyright (C) 1993-2020"
|
|
||||||
PACKAGE_LICENSE="GNU General Public License, version 2"
|
|
||||||
WINDOWS_RC_VERSION=`echo $PACKAGE_VERSION | sed 's/-.*//; s/\./, /g; s/$/, 0/'`
|
|
||||||
AC_SUBST(PACKAGE_COPYRIGHT)
|
|
||||||
AC_SUBST(PACKAGE_LICENSE)
|
|
||||||
AC_SUBST(WINDOWS_RC_VERSION)
|
|
||||||
|
|
||||||
# Checks for programs.
|
|
||||||
AC_PROG_CC
|
|
||||||
AC_CHECK_PROG(HAVE_PYTHON, python, true, false)
|
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
case "$host" in
|
|
||||||
*-*-mingw* | *-*-cygwin* | *-*-msvc* )
|
|
||||||
AC_CHECK_TOOL(WINDRES, windres, )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
WINDRES=
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_WINDRES, test "$WINDRES" != "")
|
|
||||||
AM_CONDITIONAL(HAVE_PYTHON, $HAVE_PYTHON)
|
|
||||||
|
|
||||||
# Checks for libraries.
|
|
||||||
AC_SEARCH_LIBS([pow], [m])
|
|
||||||
AC_SEARCH_LIBS([dlopen], [dl dld], [AC_CHECK_FUNCS([dlopen])])
|
|
||||||
PKG_CHECK_MODULES([SDL], [sdl2])
|
|
||||||
PKG_CHECK_MODULES([SDL_mixer], [SDL2_mixer])
|
|
||||||
PKG_CHECK_MODULES([SDL_net], [SDL2_net])
|
|
||||||
AC_DEFINE([RANGECHECK], [1], [Parameter Validation Debugging])
|
|
||||||
|
|
||||||
# Checks for header files.
|
|
||||||
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h unistd.h])
|
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
AC_CHECK_HEADER_STDBOOL
|
|
||||||
AC_C_INLINE
|
|
||||||
AC_C_RESTRICT
|
|
||||||
AC_TYPE_INTPTR_T
|
|
||||||
AC_TYPE_UINTPTR_T
|
|
||||||
AC_TYPE_SIZE_T
|
|
||||||
AC_CHECK_TYPES([ptrdiff_t])
|
|
||||||
|
|
||||||
# Checks for library functions.
|
|
||||||
AC_FUNC_ALLOCA
|
|
||||||
AC_FUNC_ERROR_AT_LINE
|
|
||||||
AC_CHECK_FUNCS([atexit memmove memset mkdir pow putenv strcasecmp strchr strdup strerror strncasecmp strrchr strstr strtol])
|
|
||||||
|
|
||||||
# Set compiler flags
|
|
||||||
WARNINGS="-Wall -Wdeclaration-after-statement -Wredundant-decls"
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([werror], AS_HELP_STRING([--enable-werror], [Treat warnings as errors]))
|
|
||||||
AS_IF([test "x$enable_werror" = "xyes"], [WARNINGS="-Werror $WARNINGS"])
|
|
||||||
|
|
||||||
if test "$GCC" = "yes"
|
|
||||||
then
|
|
||||||
CFLAGS="$CFLAGS -g -O2 $WARNINGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
|
||||||
Makefile
|
|
||||||
configs/Makefile
|
|
||||||
data/Makefile
|
|
||||||
docs/Makefile
|
|
||||||
examples/Makefile
|
|
||||||
Source/Makefile
|
|
||||||
Source/resource.rc
|
|
||||||
toolsrc/Makefile
|
|
||||||
pkg/Makefile
|
|
||||||
pkg/config.make
|
|
||||||
])
|
|
||||||
AC_OUTPUT
|
|
11
data/CMakeLists.txt
Normal file
11
data/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
if(Python3_FOUND)
|
||||||
|
add_custom_target(convert-icon
|
||||||
|
COMMAND "${Python3_EXECUTABLE}" "convert-icon"
|
||||||
|
"woof.png" "../Source/icon.c"
|
||||||
|
VERBATIM WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
install(FILES woof.desktop DESTINATION share/applications)
|
||||||
|
install(FILES woof.png DESTINATION share/icons/hicolor/128x128/apps)
|
||||||
|
endif()
|
@ -1,12 +0,0 @@
|
|||||||
EXTRA_DIST = \
|
|
||||||
woof.desktop \
|
|
||||||
woof.ico \
|
|
||||||
woof8.ico \
|
|
||||||
woof.png \
|
|
||||||
convert-icon
|
|
||||||
|
|
||||||
appdir = $(prefix)/share/applications
|
|
||||||
app_DATA = woof.desktop
|
|
||||||
|
|
||||||
iconsdir = $(prefix)/share/icons/hicolor/128x128/apps
|
|
||||||
icons_DATA = woof.png
|
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright(C) 2005-2014 Simon Howard
|
# Copyright(C) 2005-2014 Simon Howard
|
||||||
#
|
#
|
||||||
@ -20,35 +20,42 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print("Usage: convert-icon <src> <dest>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import Image
|
import Image
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("WARNING: Could not update %s. "
|
print(
|
||||||
"Please install the Python Imaging library or Pillow."
|
"WARNING: Could not update {}\n"
|
||||||
% sys.argv[2])
|
"Please install the Python Imaging library or Pillow."
|
||||||
sys.exit(0)
|
.format([sys.argv[2]])
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def convert_image(filename, output_filename):
|
def convert_image(filename, output_filename):
|
||||||
|
|
||||||
im = Image.open(filename)
|
im = Image.open(filename)
|
||||||
|
|
||||||
outfile = open(output_filename, "w")
|
outfile = open(output_filename, "w", encoding="ascii")
|
||||||
|
|
||||||
size = im.size
|
size = im.size
|
||||||
|
|
||||||
struct_name = os.path.basename(output_filename)
|
struct_name = os.path.basename(output_filename)
|
||||||
struct_name = re.sub(re.compile("\\..*$"), "", struct_name)
|
struct_name = re.sub(re.compile(r"\..*$"), "", struct_name)
|
||||||
struct_name = re.sub(re.compile("\W"), "_", struct_name)
|
struct_name = re.sub(re.compile(r"\W"), "_", struct_name)
|
||||||
|
|
||||||
outfile.write("static int %s_w = %i;\n" % (struct_name, size[0]))
|
outfile.write("static int {}_w = {};\n".format(struct_name, size[0]))
|
||||||
outfile.write("static int %s_h = %i;\n" % (struct_name, size[1]))
|
outfile.write("static int {}_h = {};\n".format(struct_name, size[1]))
|
||||||
|
|
||||||
outfile.write("\n")
|
outfile.write("\n")
|
||||||
outfile.write("static const unsigned int %s_data[] = {\n" % (struct_name))
|
outfile.write(
|
||||||
|
"static const unsigned int {}_data[] = {{\n".format(struct_name)
|
||||||
|
)
|
||||||
|
|
||||||
elements_on_line = 0
|
elements_on_line = 0
|
||||||
|
|
||||||
@ -57,7 +64,7 @@ def convert_image(filename, output_filename):
|
|||||||
for y in range(size[1]):
|
for y in range(size[1]):
|
||||||
for x in range(size[0]):
|
for x in range(size[0]):
|
||||||
val = im.getpixel((x, y))
|
val = im.getpixel((x, y))
|
||||||
outfile.write("0x%02x%02x%02x%02x, " % val)
|
outfile.write("0x{:02x}{:02x}{:02x}{:02x}, ".format(*val))
|
||||||
elements_on_line += 1
|
elements_on_line += 1
|
||||||
|
|
||||||
if elements_on_line >= 6:
|
if elements_on_line >= 6:
|
||||||
@ -68,5 +75,5 @@ def convert_image(filename, output_filename):
|
|||||||
outfile.write("\n")
|
outfile.write("\n")
|
||||||
outfile.write("};\n")
|
outfile.write("};\n")
|
||||||
|
|
||||||
convert_image(sys.argv[1], sys.argv[2])
|
|
||||||
|
|
||||||
|
convert_image(sys.argv[1], sys.argv[2])
|
||||||
|
31
docs/CMakeLists.txt
Normal file
31
docs/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Files that need no conversion.
|
||||||
|
set(WOOF_DOCS_FILES
|
||||||
|
mbf-bugs.html)
|
||||||
|
|
||||||
|
# Plain text files that should be converted on Windows.
|
||||||
|
set(WOOF_DOCS_TEXTS
|
||||||
|
boomdeh.txt
|
||||||
|
boomref.txt
|
||||||
|
boom.txt
|
||||||
|
dckboom.txt
|
||||||
|
mbfedit.txt
|
||||||
|
mbffaq.txt
|
||||||
|
mbf.txt
|
||||||
|
options.txt
|
||||||
|
winmbf02s.txt
|
||||||
|
winmbf02.txt)
|
||||||
|
|
||||||
|
configure_file(WoofInstall.cmake.in WoofInstall.cmake ESCAPE_QUOTES @ONLY)
|
||||||
|
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/WoofInstall.cmake")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
install(FILES ${WOOF_DOCS_FILES} DESTINATION docs)
|
||||||
|
foreach(WOOF_DOCS_TEXT ${WOOF_DOCS_TEXTS})
|
||||||
|
install(
|
||||||
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/${WOOF_DOCS_TEXT}"
|
||||||
|
DESTINATION docs)
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
install(DIRECTORY . DESTINATION "share/doc/${PROJECT_TARNAME}"
|
||||||
|
PATTERN CMakeLists.txt EXCLUDE PATTERN *.cmake.in EXCLUDE)
|
||||||
|
endif()
|
@ -1,14 +0,0 @@
|
|||||||
dist_doc_DATA = \
|
|
||||||
boom.txt \
|
|
||||||
boomdeh.txt \
|
|
||||||
boomref.txt \
|
|
||||||
dckboom.txt \
|
|
||||||
mbf.txt \
|
|
||||||
mbfedit.txt \
|
|
||||||
mbffaq.txt \
|
|
||||||
options.txt \
|
|
||||||
winmbf02.txt
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
mbf-bugs.html \
|
|
||||||
winmbf02s.txt
|
|
28
docs/WoofInstall.cmake.in
Normal file
28
docs/WoofInstall.cmake.in
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# This script is stamped out by CMake and run by `make install`.
|
||||||
|
|
||||||
|
set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
|
||||||
|
set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||||
|
set(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||||
|
set(Python3_EXECUTABLE "@Python3_EXECUTABLE@")
|
||||||
|
set(WIN32 "@WIN32@")
|
||||||
|
|
||||||
|
set(WOOF_TEXTS "@WOOF_DOCS_TEXTS@")
|
||||||
|
|
||||||
|
function(win_textfile SOURCE DESTINATION)
|
||||||
|
execute_process(COMMAND
|
||||||
|
"${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/win-textfile"
|
||||||
|
"${SOURCE}" "${DESTINATION}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(NOT Python3_EXECUTABLE)
|
||||||
|
message(FATAL_ERROR "Python 3 not found, can't run install scripts.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Convert text files to a format Windows Notepad can read without issue.
|
||||||
|
foreach(WOOF_TEXT ${WOOF_TEXTS})
|
||||||
|
win_textfile(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/${WOOF_TEXT}"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${WOOF_TEXT}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
37
examples/CMakeLists.txt
Normal file
37
examples/CMakeLists.txt
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Files that need no conversion.
|
||||||
|
set(WOOF_EXAMPLES_FILES
|
||||||
|
battle.wad
|
||||||
|
dogfly.deh
|
||||||
|
donut.wad
|
||||||
|
fireplas.deh
|
||||||
|
fly.deh
|
||||||
|
friend.deh
|
||||||
|
grenade.deh
|
||||||
|
hockey.wad
|
||||||
|
mbfedit.wad
|
||||||
|
mine.deh
|
||||||
|
mushroom.deh
|
||||||
|
playbud.deh
|
||||||
|
possbud.deh
|
||||||
|
sky.wad
|
||||||
|
touchy.deh)
|
||||||
|
|
||||||
|
# Plain text files that should be converted on Windows.
|
||||||
|
set(WOOF_EXAMPLES_TEXTS
|
||||||
|
donut.txt
|
||||||
|
mbfedit.txt)
|
||||||
|
|
||||||
|
configure_file(WoofInstall.cmake.in WoofInstall.cmake ESCAPE_QUOTES @ONLY)
|
||||||
|
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/WoofInstall.cmake")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
install(FILES ${WOOF_EXAMPLES_FILES} DESTINATION docs/examples)
|
||||||
|
foreach(WOOF_EXAMPLES_TEXT ${WOOF_EXAMPLES_TEXTS})
|
||||||
|
install(
|
||||||
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/${WOOF_EXAMPLES_TEXT}"
|
||||||
|
DESTINATION docs/examples)
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
install(DIRECTORY . DESTINATION "share/doc/${PROJECT_TARNAME}/examples"
|
||||||
|
PATTERN CMakeLists.txt EXCLUDE PATTERN *.cmake.in EXCLUDE)
|
||||||
|
endif()
|
@ -1,20 +0,0 @@
|
|||||||
exampledir = $(docdir)/examples
|
|
||||||
|
|
||||||
dist_example_DATA = \
|
|
||||||
battle.wad \
|
|
||||||
dogfly.deh \
|
|
||||||
donut.txt \
|
|
||||||
donut.wad \
|
|
||||||
fireplas.deh \
|
|
||||||
fly.deh \
|
|
||||||
friend.deh \
|
|
||||||
grenade.deh \
|
|
||||||
hockey.wad \
|
|
||||||
mbfedit.txt \
|
|
||||||
mbfedit.wad \
|
|
||||||
mine.deh \
|
|
||||||
mushroom.deh \
|
|
||||||
playbud.deh \
|
|
||||||
possbud.deh \
|
|
||||||
sky.wad \
|
|
||||||
touchy.deh
|
|
28
examples/WoofInstall.cmake.in
Normal file
28
examples/WoofInstall.cmake.in
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# This script is stamped out by CMake and run by `make install`.
|
||||||
|
|
||||||
|
set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
|
||||||
|
set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||||
|
set(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||||
|
set(Python3_EXECUTABLE "@Python3_EXECUTABLE@")
|
||||||
|
set(WIN32 "@WIN32@")
|
||||||
|
|
||||||
|
set(WOOF_TEXTS "@WOOF_EXAMPLES_TEXTS@")
|
||||||
|
|
||||||
|
function(win_textfile SOURCE DESTINATION)
|
||||||
|
execute_process(COMMAND
|
||||||
|
"${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/win-textfile"
|
||||||
|
"${SOURCE}" "${DESTINATION}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(NOT Python3_EXECUTABLE)
|
||||||
|
message(FATAL_ERROR "Python 3 not found, can't run install scripts.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Convert text files to a format Windows Notepad can read without issue.
|
||||||
|
foreach(WOOF_TEXT ${WOOF_TEXTS})
|
||||||
|
win_textfile(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/${WOOF_TEXT}"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${WOOF_TEXT}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
WIN32_FILES= \
|
|
||||||
win32/GNUmakefile \
|
|
||||||
win32/cp-with-libs
|
|
||||||
|
|
||||||
EXTRA_DIST=$(WIN32_FILES)
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
|
|
||||||
include ../config.make
|
|
||||||
|
|
||||||
TOPLEVEL=../..
|
|
||||||
DOCS=$(TOPLEVEL)/docs
|
|
||||||
EXAMPLES=$(TOPLEVEL)/examples
|
|
||||||
|
|
||||||
ZIP=$(PACKAGE)-$(PACKAGE_VERSION)-win32.zip
|
|
||||||
|
|
||||||
all: $(ZIP)
|
|
||||||
|
|
||||||
$(ZIP): staging
|
|
||||||
cd $< && zip -X -r ../$@ *
|
|
||||||
|
|
||||||
staging:
|
|
||||||
mkdir -p $@/docs $@/examples
|
|
||||||
LC_ALL=C ./cp-with-libs --ldflags="$(LDFLAGS)" "$(TOPLEVEL)/Source/woof.exe" $@
|
|
||||||
|
|
||||||
$(STRIP) $@/*.exe $@/*.dll
|
|
||||||
|
|
||||||
unix2dos --add-bom --newfile "$(TOPLEVEL)/README.md" $@/README.txt
|
|
||||||
unix2dos --add-bom --newfile "$(TOPLEVEL)/COPYING" $@/COPYING.txt
|
|
||||||
|
|
||||||
for f in $(DOCS)/*.txt $(DOCS)/*.html; do \
|
|
||||||
unix2dos --add-bom --newfile $$f $@/docs/$$(basename $$f); \
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in $(EXAMPLES)/*.txt $(EXAMPLES)/*.wad $(EXAMPLES)/*.deh; do \
|
|
||||||
cp $$f $@/examples/$$(basename $$f); \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) -r -- $(ZIP)
|
|
||||||
$(RM) -r -- staging
|
|
7
toolsrc/CMakeLists.txt
Normal file
7
toolsrc/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
include(WoofSettings)
|
||||||
|
|
||||||
|
add_executable(bin2c EXCLUDE_FROM_ALL bin2c.c)
|
||||||
|
add_executable(bmp2c EXCLUDE_FROM_ALL bmp2c.c)
|
||||||
|
add_executable(swantbls EXCLUDE_FROM_ALL swantbls.c)
|
||||||
|
|
||||||
|
target_woof_settings(bin2c bmp2c swantbls)
|
@ -1,12 +0,0 @@
|
|||||||
noinst_PROGRAMS = \
|
|
||||||
bin2c \
|
|
||||||
bmp2c \
|
|
||||||
swantbls
|
|
||||||
|
|
||||||
bin2c_SOURCES = bin2c.c
|
|
||||||
bmp2c_SOURCES = bmp2c.c
|
|
||||||
swantbls_SOURCES = swantbls.c
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
defswani.dat \
|
|
||||||
fakedate.asm
|
|
53
win-textfile
Executable file
53
win-textfile
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Copyright(C) 2020 Alex Mayfield
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Converts text files to a format usable by Windows Notepad.
|
||||||
|
#
|
||||||
|
|
||||||
|
import io
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print("Usage: win-textfile <src> <dest>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
src = open(sys.argv[1], "rb")
|
||||||
|
dest_stream = io.BytesIO()
|
||||||
|
|
||||||
|
# Check for BOM and if it doesn't exist, add it.
|
||||||
|
bom = src.read(3)
|
||||||
|
if (bom != b"\xef\xbb\xbf"):
|
||||||
|
dest_stream.write(b"\xef\xbb\xbf")
|
||||||
|
src.seek(0)
|
||||||
|
|
||||||
|
# Read the text file byte by byte.
|
||||||
|
while True:
|
||||||
|
byte = src.read(1)
|
||||||
|
if (not byte):
|
||||||
|
# End of file.
|
||||||
|
break
|
||||||
|
if (byte == b"\r"):
|
||||||
|
# Found a CR, omit it so we don't double-up.
|
||||||
|
continue
|
||||||
|
if (byte == b"\n"):
|
||||||
|
# Replace LF with CRLF.
|
||||||
|
dest_stream.write(b"\r\n")
|
||||||
|
else:
|
||||||
|
# Everything else is copied verbatim.
|
||||||
|
dest_stream.write(byte)
|
||||||
|
|
||||||
|
# Don't write file until last possible moment.
|
||||||
|
dest = open(sys.argv[2], "wb")
|
||||||
|
dest.write(dest_stream.getbuffer())
|
Loading…
x
Reference in New Issue
Block a user