update build system, remove "woof.com" hack (#2329)

* Add `WITH_FLUIDSYNTH` option and disable it by default.

FluidSynth has a lot of dependencies. On Windows, it takes up about 90% of the
build time with vcpkg. Disabling it by default would speed up the build process
for new developers.

* Disable GCC checks for MSVC (clang-cl) to speed up the configuration step.

* Move CMDLINE and COPYING to docs, remove README.md from distribution.

* Remove "woof.com" hack for console output on Windows.

The console still works in debug builds.

* Always search FluidSynth, update README.md.
This commit is contained in:
Roman Fomin 2025-07-20 21:13:40 +07:00 committed by GitHub
parent 928727e630
commit 54606e7cf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 189 additions and 226 deletions

View File

@ -93,10 +93,11 @@ jobs:
- name: Configure
env:
CC: ${{ matrix.config.compiler }}
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DENABLE_WERROR=ON -DENABLE_HARDENING=ON -DENABLE_LTO=ON \
${{ matrix.config.extra-options }}
run: >-
cmake -B build -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DENABLE_WERROR=ON -DENABLE_HARDENING=ON -DENABLE_LTO=ON
${{ matrix.config.extra-options }}
- name: Build
run: cmake --build build
@ -150,9 +151,10 @@ jobs:
- uses: actions/checkout@v4
- name: Configure
run: |
cmake -B build -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=OFF
run: >-
cmake -B build -G Ninja
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=OFF
- name: Run Cppcheck
if: ${{ matrix.name == 'Cppcheck' }}

View File

@ -27,7 +27,7 @@ jobs:
toolchain: $VCPKG_INSTALLATION_ROOT
triplet: x64-linux-dynamic-release
artifact-name: AppImage
artifact-path: build/*.appimage
artifact-path: build/*.AppImage
extra-options: -DCMAKE_INSTALL_PREFIX=/usr
- name: MSVC x64
@ -81,6 +81,7 @@ jobs:
cmake -B build -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DENABLE_WERROR=ON -DENABLE_HARDENING=ON -DENABLE_LTO=ON
-DWITH_FLUIDSYNTH=ON
-DCMAKE_TOOLCHAIN_FILE="${{ matrix.config.toolchain }}/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_OVERLAY_TRIPLETS="cmake/triplets"
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }}

View File

@ -1,31 +1,34 @@
include(CheckLibraryExists)
include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
cmake_minimum_required(VERSION 3.15...4.0)
# Adds the cmake directory to the CMake include path.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(WITH_FLUIDSYNTH "Use FluidSynth if available" OFF)
if(WITH_FLUIDSYNTH)
list(APPEND VCPKG_MANIFEST_FEATURES "fluidsynth")
endif()
# X_VCPKG_APPLOCAL_DEPS_INSTALL automatically installs dependencies.
set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
cmake_minimum_required(VERSION 3.15)
# Adds the cmake directory to the CMake include path.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project("Woof"
project(
"Woof"
VERSION 15.2.0
LANGUAGES C)
LANGUAGES C
)
set(CMAKE_C_STANDARD 99)
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
message(STATUS
"Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE
"${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Prevent in-tree builds.
@ -42,19 +45,26 @@ set(PROJECT_SHORTNAME "woof")
set(BASE_PK3 "woof.pk3")
set(WOOF_ICON "woof.ico")
set(SETUP_ICON "setup.ico")
set(PROJECT_VERSION_RC "${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},0") # ${PROJECT_VERSION_TWEAK}
set(PROJECT_VERSION_RC
"${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},0")
# Toggle-able defines added at compile-time.
option(WOOF_RANGECHECK "Enable bounds-checking of performance-sensitive functions" ON)
option(WOOF_STRICT "Prefer original MBF code paths over demo compatiblity with PrBoom+" OFF)
include(CheckLibraryExists)
include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
# Compiler environment requirements.
check_library_exists(m pow "" HAVE_LIBM)
check_include_file("dirent.h" HAVE_DIRENT_H)
check_symbol_exists(strcasecmp "strings.h" HAVE_DECL_STRCASECMP)
check_symbol_exists(strncasecmp "strings.h" HAVE_DECL_STRNCASECMP)
check_symbol_exists(getpwuid "unistd.h;sys/types.h;pwd.h" HAVE_GETPWUID)
check_c_source_compiles("
check_c_source_compiles(
"
#include <windows.h>
int main()
{
@ -62,28 +72,30 @@ check_c_source_compiles("
TIMER_ALL_ACCESS);
return 0;
}
"
HAVE_HIGH_RES_TIMER
"
HAVE_HIGH_RES_TIMER
)
check_c_source_compiles("
check_c_source_compiles(
"
#include <immintrin.h>
int main()
{
int tmp = _div64(4, 2, NULL);
return 0;
}
"
HAVE__DIV64
"
HAVE__DIV64
)
check_c_source_compiles("
check_c_source_compiles(
"
typedef float vec __attribute__((ext_vector_type(4)));
int main()
{
vec a = (vec){0, 1, 2, 3};
return 0;
}
"
HAVE_EXT_VECTOR_TYPE
"
HAVE_EXT_VECTOR_TYPE
)
option(CMAKE_FIND_PACKAGE_PREFER_CONFIG
@ -142,20 +154,20 @@ find_package(Python3 COMPONENTS Interpreter)
configure_file(config.h.in config.h)
if(WIN32)
install(FILES COPYING DESTINATION . RENAME COPYING.txt)
install(FILES README.md DESTINATION .)
install(FILES COPYING DESTINATION docs RENAME COPYING.txt)
install(DIRECTORY examples/ DESTINATION docs/examples)
if(FluidSynth_FOUND)
install(DIRECTORY soundfonts/ DESTINATION soundfonts)
endif()
else()
install(FILES COPYING DESTINATION "share/doc/${PROJECT_SHORTNAME}")
install(FILES README.md DESTINATION "share/doc/${PROJECT_SHORTNAME}")
if(EXISTS "${CMAKE_SOURCE_DIR}/examples")
install(DIRECTORY examples/ DESTINATION "share/doc/${PROJECT_SHORTNAME}/examples")
install(DIRECTORY examples/
DESTINATION "share/doc/${PROJECT_SHORTNAME}/examples")
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/soundfonts" AND FluidSynth_FOUND)
install(DIRECTORY soundfonts/ DESTINATION "share/${PROJECT_SHORTNAME}/soundfonts")
install(DIRECTORY soundfonts/
DESTINATION "share/${PROJECT_SHORTNAME}/soundfonts")
endif()
endif()
@ -188,7 +200,7 @@ elseif(LINUX)
execute_process(COMMAND
${CMAKE_COMMAND} -E env
OUTPUT=${CPACK_PACKAGE_FILE_NAME}.appimage
OUTPUT=${CPACK_PACKAGE_FILE_NAME}.AppImage
VERSION=$<IF:$<BOOL:${CPACK_PACKAGE_VERSION}>,${CPACK_PACKAGE_VERSION},0.1.0>
${LINUXDEPLOY_EXECUTABLE}
--appimage-extract-and-run
@ -197,7 +209,7 @@ elseif(LINUX)
--desktop-file=${CPACK_TEMPORARY_DIRECTORY}/${CPACK_PACKAGING_INSTALL_PREFIX}/share/applications/io.github.fabiangreffrath.woof.desktop
--icon-file=${CPACK_TEMPORARY_DIRECTORY}/${CPACK_PACKAGING_INSTALL_PREFIX}/share/icons/hicolor/128x128/apps/woof.png
--output=appimage)
]])
]])
else()
set(CPACK_GENERATOR TGZ)
endif()

View File

@ -115,13 +115,19 @@ After successful compilation the resulting binary can be found in the `src/` dir
Visual Studio 2019 and [VSCode](https://code.visualstudio.com/) comes with built-in support for CMake by opening the source tree as a folder.
Install vcpkg <https://github.com/Microsoft/vcpkg#quick-start-windows>. Integrate it into CMake or use toolchain file:
Install vcpkg <https://github.com/Microsoft/vcpkg?tab=readme-ov-file#get-started>.
Run the CMake configuration:
```
cd woof
cmake -B build -DCMAKE_TOOLCHAIN_FILE="[path to vcpkg]/scripts/buildsystems/vcpkg.cmake"
```
During this step, vcpkg will build all the dependencies. To enable FluidSynth add `-DWITH_FLUIDSYNTH=ON` option.
Build the project:
```
cmake --build build
```
CMake will automatically download and build all dependencies for you.
# Contact

View File

@ -35,18 +35,6 @@ endfunction()
# 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(-Werror=array-bounds)
_checked_add_compile_option(-Werror=clobbered)
_checked_add_compile_option(-Werror=format-security)
_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(-Werror=volatile-register-var)
_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")
@ -68,20 +56,29 @@ if(MSVC)
# Using the token operator to compare signed and unsigned numbers required
# the compiler to convert the signed value to unsigned.
_checked_add_compile_option(/wd4018)
# Extra warnings for clang-cl.exe - prevents warning spam in SDL headers.
_checked_add_compile_option(-Wno-pragma-pack)
else()
_checked_add_compile_option(-Werror=array-bounds)
_checked_add_compile_option(-Werror=clobbered)
_checked_add_compile_option(-Werror=format-security)
_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(-Werror=volatile-register-var)
_checked_add_compile_option(-Wformat=2)
_checked_add_compile_option(-Wnull-dereference)
_checked_add_compile_option(-Wredundant-decls)
_checked_add_compile_option(-Wrestrict)
# We only want -Wall on GCC compilers, since /Wall on MSVC is noisy.
_checked_add_compile_option(-Wall)
endif()
option(ENABLE_WERROR "Treat warnings as errors" OFF)
if(ENABLE_WERROR)
_checked_add_compile_option(-Werror)
if(MSVC)
_checked_add_compile_option(/WX)
endif()
if(MSVC)
_checked_add_compile_option(/WX)
else()
_checked_add_compile_option(-Werror)
endif()
endif()
option(ENABLE_ASAN "Enable ASan" OFF)

View File

@ -4,7 +4,7 @@ configure_file(WoofInstall.cmake.in WoofInstall.cmake ESCAPE_QUOTES @ONLY)
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/WoofInstall.cmake")
if(WIN32)
install(FILES CMDLINE.txt DESTINATION .)
install(FILES CMDLINE.txt DESTINATION docs)
elseif(UNIX AND NOT APPLE)
install(FILES CMDLINE.txt DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_SHORTNAME}")
install(FILES "${PROJECT_SHORTNAME}.6" DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)

View File

@ -153,63 +153,48 @@ set(WOOF_SOURCES
wi_stuff.c wi_stuff.h
wi_interlvl.c wi_interlvl.h
ws_stuff.c ws_stuff.h
z_zone.c z_zone.h)
z_zone.c z_zone.h
)
# Standard target definition
if(WIN32)
add_library(woof SHARED EXCLUDE_FROM_ALL ${WOOF_SOURCES})
target_compile_definitions(woof PRIVATE WIN_LAUNCHER)
add_executable(woof ${WOOF_SOURCES})
target_woof_settings(woof)
target_include_directories(woof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
if(WIN32)
# Stamp out and compile resource file on Windows.
configure_file(resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
add_executable(woof-com WIN32 ../win32/win_launcher.c
"${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
target_woof_settings(woof-com)
target_include_directories(woof-com PRIVATE ${SDL2_INCLUDE_DIR})
target_link_libraries(woof-com PRIVATE ${SDL2_LIBRARIES} woof)
add_executable(woof-exe WIN32 ../win32/win_launcher.c
"${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
target_woof_settings(woof-exe)
target_include_directories(woof-exe PRIVATE ${SDL2_INCLUDE_DIR})
target_link_libraries(woof-exe PRIVATE ${SDL2_LIBRARIES} woof)
target_sources(woof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
# MSVC tries to supply a default manifest and complains when it finds ours
# unless we specifically tell it not to.
if(MSVC)
target_link_options(woof-com PRIVATE "/MANIFEST:NO" "/SUBSYSTEM:CONSOLE")
target_link_options(woof-exe PRIVATE "/MANIFEST:NO")
target_link_options(
woof
PRIVATE "/MANIFEST:NO"
"$<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,/SUBSYSTEM:CONSOLE,/SUBSYSTEM:WINDOWS>"
)
else()
target_link_options(woof-com PRIVATE "-mconsole")
target_link_options(woof PRIVATE
"$<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-mconsole,-mwindows>")
endif()
else()
add_executable(woof ${WOOF_SOURCES})
endif()
target_woof_settings(woof)
target_include_directories(woof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(woof PRIVATE
${SDL2_LIBRARIES}
SDL2_net::SDL2_net
OpenAL::OpenAL
libebur128::libebur128
SndFile::sndfile
yyjson::yyjson
opl
pffft
textscreen
miniz
spng
sha1
md5)
target_compile_definitions(woof PUBLIC
$<$<CONFIG:Debug>:WOOF_DEBUG>
$<$<CONFIG:RelWithDebInfo>:WOOF_DEBUG>
$<$<CONFIG:Release>:WOOF_RELEASE>
$<$<CONFIG:MinSizeRel>:WOOF_RELEASE>
target_link_libraries(
woof
PRIVATE ${SDL2_LIBRARIES}
SDL2_net::SDL2_net
OpenAL::OpenAL
libebur128::libebur128
SndFile::sndfile
yyjson::yyjson
opl
textscreen
pffft
miniz
spng
sha1
md5
)
# Some platforms require standard libraries to be linked against.
@ -228,10 +213,12 @@ if(WIN32)
endif()
if(APPLE)
target_link_libraries(woof PRIVATE
-Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit
-Wl,-framework,CoreServices -Wl,-framework,CoreAudio
-Wl,-framework,CoreMIDI)
target_link_libraries(
woof
PRIVATE -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit
-Wl,-framework,CoreServices -Wl,-framework,CoreAudio
-Wl,-framework,CoreMIDI
)
endif()
if(ALSA_FOUND)
@ -249,6 +236,9 @@ if(libxmp_FOUND)
target_link_libraries(woof PRIVATE libxmp::xmp)
endif()
target_compile_definitions(woof PRIVATE
$<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,WOOF_DEBUG,WOOF_RELEASE>)
# Optional features.
#
# Our defines are not namespaced, so we pass them at compile-time instead of
@ -260,6 +250,7 @@ if(WOOF_STRICT)
target_compile_definitions(woof PRIVATE MBF_STRICT)
endif()
# Setup tool
set(SETUP_SOURCES
d_iwad.c d_iwad.h
i_main.c
@ -276,7 +267,8 @@ set(SETUP_SOURCES
net_sdl.c net_sdl.h
net_structrw.c net_structrw.h
version.c version.h
z_zone.c z_zone.h)
z_zone.c z_zone.h
)
if(WIN32)
# Stamp out and compile resource file on Windows.
@ -288,53 +280,46 @@ add_executable(woof-setup WIN32 ${SETUP_SOURCES})
target_woof_settings(woof-setup)
target_include_directories(woof-setup PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(woof-setup PRIVATE
${SDL2_LIBRARIES}
SDL2_net::SDL2_net
textscreen
setup)
target_link_libraries(
woof-setup
PRIVATE ${SDL2_LIBRARIES}
SDL2_net::SDL2_net
textscreen
setup
)
if(MSVC)
target_link_options(woof-setup PRIVATE "/MANIFEST:NO")
endif()
# Base file
add_dependencies(woof woof-base)
if(MSVC)
add_custom_command(TARGET woof POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${BASE_PK3_PATH}" "$<TARGET_FILE_DIR:woof>")
add_custom_command(
TARGET woof
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${BASE_PK3_PATH}"
"$<TARGET_FILE_DIR:woof>"
)
endif()
# Install
#
# Rename woof-com and woof-exe executables.
if(WIN32)
add_custom_command(TARGET woof-com POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE_DIR:woof-com>/$<TARGET_FILE_NAME:woof-com>"
"$<TARGET_FILE_DIR:woof-com>/woof.com")
add_custom_command(TARGET woof-exe POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE_DIR:woof-exe>/$<TARGET_FILE_NAME:woof-exe>"
"$<TARGET_FILE_DIR:woof-exe>/woof.exe")
endif()
# Files to package in our distribution.
if(WIN32)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21 AND NOT VCPKG_TOOLCHAIN)
install(TARGETS woof woof-setup
RUNTIME_DEPENDENCIES
PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-"
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"
DIRECTORIES $<TARGET_FILE_DIR:woof> $ENV{PATH}
RUNTIME DESTINATION .)
install(
TARGETS woof woof-setup
RUNTIME_DEPENDENCIES
PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-"
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"
DIRECTORIES $<TARGET_FILE_DIR:woof> $ENV{PATH}
RUNTIME DESTINATION .
)
else()
install(TARGETS woof woof-setup RUNTIME DESTINATION .)
endif()
install(FILES "$<TARGET_FILE_DIR:woof-com>/woof.com"
"$<TARGET_FILE_DIR:woof-exe>/woof.exe"
DESTINATION .)
else()
install(TARGETS woof woof-setup RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

View File

@ -24,7 +24,6 @@
#include "config.h"
#include "i_printf.h"
#include "i_system.h"
#include "m_argv.h"
#include "version.h"
@ -36,18 +35,7 @@
void D_DoomMain(void);
#if defined(WIN_LAUNCHER)
__declspec(dllexport) void Woof_Exit(void)
{
I_SafeExit(0);
}
#endif
#if defined(WIN_LAUNCHER)
__declspec(dllexport) int Woof_Main(int argc, char **argv)
#else
int main(int argc, char **argv)
#endif
{
myargc = argc;
myargv = argv;

View File

@ -1,48 +1,57 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
{
"name": "sdl2",
"features": [
{
"name": "vulkan",
"platform": "linux"
},
{
"name": "wayland",
"platform": "linux"
},
{
"name": "x11",
"platform": "linux"
},
{
"name": "ibus",
"platform": "linux"
}
]
},
"sdl2-net",
{
"name": "openal-soft",
"features": [
{
"name": "pipewire",
"platform": "linux"
}
]
},
"libebur128",
"libsndfile",
{
"name": "fluidsynth",
"default-features": false,
"features": ["sndfile"]
"name": "libxmp",
"default-features": false
},
{
"name": "libxmp",
"default-features": false
"name": "openal-soft",
"features": [
{
"name": "pipewire",
"platform": "linux"
}
]
},
{
"name": "sdl2",
"features": [
{
"name": "ibus",
"platform": "linux"
},
{
"name": "vulkan",
"platform": "linux"
},
{
"name": "wayland",
"platform": "linux"
},
{
"name": "x11",
"platform": "linux"
}
]
},
"sdl2-net",
"yyjson"
]
],
"features": {
"fluidsynth": {
"description": "Build with FluidSynth support",
"dependencies": [
{
"name": "fluidsynth",
"default-features": false,
"features": [
"sndfile"
]
}
]
}
}
}

View File

@ -1,37 +0,0 @@
//
// Copyright(C) 2022 Roman Fomin
//
// 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.
//
#include "SDL.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
__declspec(dllexport) extern int Woof_Main(int argc, char **argv);
__declspec(dllexport) extern void Woof_Exit(void);
BOOL CtrlHandler(DWORD event)
{
if (event == CTRL_CLOSE_EVENT)
{
Woof_Exit();
return TRUE;
}
return FALSE;
}
int main(int argc, char **argv)
{
SetConsoleCtrlHandler((PHANDLER_ROUTINE)(CtrlHandler), TRUE);
return Woof_Main(argc, argv);
}