make it build under msys2. no doom spawning yet
This commit is contained in:
parent
8d10383e01
commit
a900be463b
5 changed files with 54 additions and 46 deletions
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
project(doompanning)
|
project(doompanning LANGUAGES C CXX)
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
## Create binaries in the root of the build directory
|
## Create binaries in the root of the build directory
|
||||||
|
|
7
external/sdl_nyan/src/CMakeLists.txt
vendored
7
external/sdl_nyan/src/CMakeLists.txt
vendored
|
@ -26,11 +26,10 @@ target_include_directories(sdl_nyan
|
||||||
|
|
||||||
add_executable(sdl_nyan_demo sdl_nyan_demo.cc)
|
add_executable(sdl_nyan_demo sdl_nyan_demo.cc)
|
||||||
target_compile_features(sdl_nyan_demo PRIVATE cxx_std_17)
|
target_compile_features(sdl_nyan_demo PRIVATE cxx_std_17)
|
||||||
|
if (WIN32)
|
||||||
|
target_link_libraries(sdl_nyan_demo PRIVATE SDL2::SDL2main)
|
||||||
|
endif()
|
||||||
target_link_libraries(sdl_nyan_demo
|
target_link_libraries(sdl_nyan_demo
|
||||||
PRIVATE sdl_nyan
|
PRIVATE sdl_nyan
|
||||||
PRIVATE SDL2::SDL2
|
PRIVATE SDL2::SDL2
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_link_libraries(sdl_nyan_demo PRIVATE SDL2::SDL2main)
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -31,25 +31,19 @@ target_link_libraries(dp_common
|
||||||
target_include_directories(dp_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(dp_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
add_executable(doompanning doompanning.cc doomlib.cc)
|
add_executable(doompanning doompanning.cc doomlib.cc)
|
||||||
target_compile_features(doompanning PRIVATE cxx_std_17)
|
|
||||||
target_link_libraries(doompanning
|
|
||||||
PRIVATE dp_common
|
|
||||||
PRIVATE imgui
|
|
||||||
PRIVATE sdl_nyan
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(dp_imgui_demo dp_imgui_demo.cc)
|
add_executable(dp_imgui_demo dp_imgui_demo.cc)
|
||||||
|
|
||||||
|
target_compile_features(doompanning PRIVATE cxx_std_17)
|
||||||
target_compile_features(dp_imgui_demo PRIVATE cxx_std_17)
|
target_compile_features(dp_imgui_demo PRIVATE cxx_std_17)
|
||||||
target_link_libraries(dp_imgui_demo
|
|
||||||
PRIVATE dp_common
|
|
||||||
PRIVATE imgui
|
|
||||||
)
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(doompanning PRIVATE SDL2::SDL2main)
|
target_link_libraries(doompanning PRIVATE SDL2::SDL2 SDL2::SDL2main)
|
||||||
target_link_libraries(dp_imgui_demo PRIVATE SDL2::SDL2main)
|
target_link_libraries(dp_imgui_demo PRIVATE SDL2::SDL2 SDL2::SDL2main)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(doompanning PRIVATE dp_common imgui sdl_nyan)
|
||||||
|
target_link_libraries(dp_imgui_demo PRIVATE dp_common imgui)
|
||||||
|
|
||||||
add_executable(dp_common_c_test dp_common_c_test.c)
|
add_executable(dp_common_c_test dp_common_c_test.c)
|
||||||
target_compile_features(dp_common_c_test PRIVATE c_std_11)
|
target_compile_features(dp_common_c_test PRIVATE c_std_11)
|
||||||
target_link_libraries(dp_common_c_test
|
target_link_libraries(dp_common_c_test
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#ifdef __WIN32
|
||||||
|
#else
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dp_util.hpp"
|
#include "dp_util.hpp"
|
||||||
#include "doomlib.hpp"
|
#include "doomlib.hpp"
|
||||||
|
@ -113,6 +116,11 @@ char **__environ = environ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __WIN32
|
||||||
|
inline void spawn_doom(ControllerContext &ctx)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#else
|
||||||
void spawn_doom_posix_spawn(ControllerContext &ctx)
|
void spawn_doom_posix_spawn(ControllerContext &ctx)
|
||||||
{
|
{
|
||||||
(void) ctx;
|
(void) ctx;
|
||||||
|
@ -135,6 +143,7 @@ inline void spawn_doom(ControllerContext &ctx)
|
||||||
{
|
{
|
||||||
spawn_doom_posix_spawn(ctx);
|
spawn_doom_posix_spawn(ctx);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void end_all_dooms(ControllerContext &ctx)
|
void end_all_dooms(ControllerContext &ctx)
|
||||||
{
|
{
|
||||||
|
@ -173,6 +182,7 @@ inline auto dp_elapsed(const std::chrono::steady_clock::time_point &tStart) { re
|
||||||
|
|
||||||
void check_on_dooms(ControllerContext &ctx)
|
void check_on_dooms(ControllerContext &ctx)
|
||||||
{
|
{
|
||||||
|
#ifndef __WIN32
|
||||||
pid_t pid = 0;
|
pid_t pid = 0;
|
||||||
|
|
||||||
// Detect dooms that have terminated. This works for dooms forked from the
|
// Detect dooms that have terminated. This works for dooms forked from the
|
||||||
|
@ -196,6 +206,9 @@ void check_on_dooms(ControllerContext &ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (pid > 0);
|
} while (pid > 0);
|
||||||
|
#else
|
||||||
|
#warning "pid checking not implemented for Windows"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Find dooms that are in Endoom state and remove them. This works for
|
// Find dooms that are in Endoom state and remove them. This works for
|
||||||
// externally started dooms if we received their Endoom DoomState update.
|
// externally started dooms if we received their Endoom DoomState update.
|
||||||
|
|
|
@ -137,29 +137,6 @@ add_executable(dp_doom WIN32
|
||||||
|
|
||||||
target_compile_features(dp_doom PRIVATE c_std_11)
|
target_compile_features(dp_doom PRIVATE c_std_11)
|
||||||
|
|
||||||
# Handling linking/building WildMIDI
|
|
||||||
if(WILDMIDI)
|
|
||||||
target_compile_definitions(dp_doom PRIVATE WILDMIDI)
|
|
||||||
|
|
||||||
# TODO - Add support for system library
|
|
||||||
#find_package(WildMidi)
|
|
||||||
find_library(WILDMID_LIBRARY WildMidi)
|
|
||||||
|
|
||||||
#if(NOT WildMidi-FOUND)
|
|
||||||
# Set and hide these internal options
|
|
||||||
set(WANT_ALSA OFF CACHE INTERNAL "" FORCE)
|
|
||||||
set(WANT_DEVTEST OFF CACHE INTERNAL "" FORCE)
|
|
||||||
set(WANT_OPENAL OFF CACHE INTERNAL "" FORCE)
|
|
||||||
set(WANT_OSS OFF CACHE INTERNAL "" FORCE)
|
|
||||||
set(WANT_OSX_DEPLOYMENT OFF CACHE INTERNAL "" FORCE)
|
|
||||||
set(WANT_STATIC ON CACHE INTERNAL "" FORCE)
|
|
||||||
|
|
||||||
add_subdirectory("external/wildmidi-0.4.5" EXCLUDE_FROM_ALL)
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
target_link_libraries(dp_doom PRIVATE libwildmidi-static m)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Handle backends
|
# Handle backends
|
||||||
if(BACKEND STREQUAL "Xlib")
|
if(BACKEND STREQUAL "Xlib")
|
||||||
target_sources(dp_doom PRIVATE
|
target_sources(dp_doom PRIVATE
|
||||||
|
@ -189,11 +166,36 @@ elseif(BACKEND STREQUAL "nng")
|
||||||
"linuxdoom-1.10/ib_video/ib_video_nng.c"
|
"linuxdoom-1.10/ib_video/ib_video_nng.c"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(dp_doom
|
if (WIN32)
|
||||||
PRIVATE SDL2::SDL2
|
target_compile_definitions(dp_doom PRIVATE INCLUDE_SDL2_MAIN)
|
||||||
PRIVATE m
|
target_link_libraries(dp_doom PRIVATE SDL2::SDL2main SDL2::SDL2 m dp_common)
|
||||||
PRIVATE dp_common
|
else()
|
||||||
)
|
target_link_libraries(dp_doom PRIVATE SDL2::SDL2 m dp_common)
|
||||||
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid BACKEND")
|
message(FATAL_ERROR "Invalid BACKEND")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Handling linking/building WildMIDI
|
||||||
|
if(WILDMIDI)
|
||||||
|
target_compile_definitions(dp_doom PRIVATE WILDMIDI)
|
||||||
|
|
||||||
|
# TODO - Add support for system library
|
||||||
|
#find_package(WildMidi)
|
||||||
|
find_library(WILDMID_LIBRARY WildMidi)
|
||||||
|
|
||||||
|
#if(NOT WildMidi-FOUND)
|
||||||
|
# Set and hide these internal options
|
||||||
|
set(WANT_ALSA OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(WANT_DEVTEST OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(WANT_OPENAL OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(WANT_OSS OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(WANT_OSX_DEPLOYMENT OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(WANT_STATIC ON CACHE INTERNAL "" FORCE)
|
||||||
|
|
||||||
|
add_subdirectory("external/wildmidi-0.4.5" EXCLUDE_FROM_ALL)
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
target_link_libraries(dp_doom PRIVATE libwildmidi-static m)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue