diff --git a/CMakeLists.txt b/CMakeLists.txt index 51f6d3d..1676693 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,15 @@ cmake_minimum_required(VERSION 3.5) project(arona_core) -function(retrieve_files out_files) +function(retrieve_files path out_files) set(source_list) + message(STATUS "Retrieving files in ${path}") # 递归查找文件夹下的 .h .hpp. ini 文件保存到 HEAD_FILES - file(GLOB_RECURSE HEAD_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS *.h *.hpp *.ini) + file(GLOB_RECURSE HEAD_FILES RELATIVE ${path} CONFIGURE_DEPENDS *.h *.hpp *.ini) # 递归查找文件夹下的 *.cpp *.c 文件保存到 SRC_FILES - file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS *.cpp *.c) + file(GLOB_RECURSE SRC_FILES RELATIVE ${path} CONFIGURE_DEPENDS *.cpp *.c *.ixx) # 将 HEDADER_FILES 和 SRC_FILES 保存到 ALL_FILES 变量 set(ALL_FILES ${HEAD_FILES} ${SRC_FILES}) @@ -45,7 +46,7 @@ function(retrieve_files out_files) endif() # Remove common directory prefix to make the group - string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "" GROUP "${PARENT_DIR}") + string(REPLACE "${path}" "" GROUP "${PARENT_DIR}") # Make sure we are using windows slashes string(REPLACE "/" "\\" GROUP "${GROUP}") # Group into "Source Files" and "Header Files" diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 6f7a890..d9333d4 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -3,7 +3,7 @@ project(core) set(CMAKE_CXX_STANDARD 23) set(ALL_FILES "") -retrieve_files(ALL_FILES) +retrieve_files(${CMAKE_CURRENT_SOURCE_DIR} ALL_FILES) add_library(${PROJECT_NAME} SHARED ${ALL_FILES}) @@ -13,7 +13,6 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} rt target_link_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} rtaudio spdlog mempool Taskflow) target_link_libraries(${PROJECT_NAME} PUBLIC rtaudio spdlog mempool Taskflow) -target_precompile_headers(${PROJECT_NAME} PUBLIC extern.h) add_definitions(-Dcore_EXPORTS) if (MSVC) diff --git a/core/application/application.h b/core/application/application.h index a61618f..53f6694 100644 --- a/core/application/application.h +++ b/core/application/application.h @@ -1,6 +1,8 @@ #pragma once #include #include +#include "extern.h" +#include "spdlog/logger.h" class renderer; class render_target; diff --git a/core/audio/device/audio_device_manager.cpp b/core/audio/device/audio_device_manager.cpp index 13beb34..11c5e45 100644 --- a/core/audio/device/audio_device_manager.cpp +++ b/core/audio/device/audio_device_manager.cpp @@ -4,6 +4,7 @@ #include "audio/mixer/mixer_track.h" #include "audio/plugin_host/midi_sequencer.h" #include "audio/plugin_host/plugin_host_manager.h" +#include "spdlog/spdlog.h" #include "thread_message/thread_message_hubs.h" int rt_audio_callback(void *output_buffer, void *input_buffer, diff --git a/core/audio/misc/audio_buffer.h b/core/audio/misc/audio_buffer.h index 1a04010..45032f8 100644 --- a/core/audio/misc/audio_buffer.h +++ b/core/audio/misc/audio_buffer.h @@ -1,4 +1,8 @@ #pragma once +#include +#include +#include +#include "extern.h" class CORE_API audio_buffer { public: diff --git a/core/audio/misc/circular_audio_buffer.h b/core/audio/misc/circular_audio_buffer.h index 1616fc9..286a6c7 100644 --- a/core/audio/misc/circular_audio_buffer.h +++ b/core/audio/misc/circular_audio_buffer.h @@ -4,6 +4,15 @@ #include #include "extern.h" +#include "spdlog/spdlog.h" + +#if defined(_DEBUG) || defined(DEBUG) +#define checkf(expr, msg, ...) if (!(expr)) { spdlog::error(msg, __VA_ARGS__); throw std::runtime_error(fmt::format(msg, __VA_ARGS__)); } +#define check(expr) if (!(expr)) { spdlog::error("Check failed: {}", #expr); throw std::runtime_error(fmt::format("Check failed: {}", #expr)); } +#else +#define checkf(...) +#define check(...) +#endif /** * Basic implementation of a circular buffer built for pushing and popping arbitrary amounts of data at once. diff --git a/core/audio/mixer/channel_interface.h b/core/audio/mixer/channel_interface.h index cdce531..f03cddd 100644 --- a/core/audio/mixer/channel_interface.h +++ b/core/audio/mixer/channel_interface.h @@ -1,5 +1,8 @@ #pragma once +#include #include +#include +#include class mixer_track; class channel_node; diff --git a/core/audio/mixer/channel_node.h b/core/audio/mixer/channel_node.h index 95d6eb9..d899f54 100644 --- a/core/audio/mixer/channel_node.h +++ b/core/audio/mixer/channel_node.h @@ -1,4 +1,7 @@ #pragma once +#include +#include +#include class mixer_track; class channel_interface; diff --git a/core/audio/mixer/mixer.h b/core/audio/mixer/mixer.h index 97a2570..63a1de2 100644 --- a/core/audio/mixer/mixer.h +++ b/core/audio/mixer/mixer.h @@ -3,6 +3,7 @@ #include "misc/singleton/singleton.h" #include +#include class plugin_host; class channel_interface; diff --git a/core/audio/plugin_host/midi_sequencer.h b/core/audio/plugin_host/midi_sequencer.h index 5cfd9dc..6e6f391 100644 --- a/core/audio/plugin_host/midi_sequencer.h +++ b/core/audio/plugin_host/midi_sequencer.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "misc/singleton/singleton.h" class midi_sequencer : public singleton_t { diff --git a/core/audio/plugin_host/plugin_host.h b/core/audio/plugin_host/plugin_host.h index 582a90d..309299c 100644 --- a/core/audio/plugin_host/plugin_host.h +++ b/core/audio/plugin_host/plugin_host.h @@ -1,4 +1,8 @@ #pragma once +#include +#include +#include +#include "extern.h" class mixer_track; class channel_interface; diff --git a/core/extern.h b/core/extern.h index ec44042..2e9ef2e 100644 --- a/core/extern.h +++ b/core/extern.h @@ -1,18 +1,7 @@ #pragma once -#include "spdlog/spdlog.h" #ifdef core_EXPORTS #define CORE_API __declspec(dllexport) #else #define CORE_API __declspec(dllimport) #endif - -#if defined(_DEBUG) || defined(DEBUG) -#define checkf(expr, msg, ...) if (!(expr)) { spdlog::error(msg, __VA_ARGS__); throw std::runtime_error(fmt::format(msg, __VA_ARGS__)); } -#define check(expr) if (!(expr)) { spdlog::error("Check failed: {}", #expr); throw std::runtime_error(fmt::format("Check failed: {}", #expr)); } -#else -#define checkf(...) -#define check(...) -#endif - - diff --git a/core/misc/delegates.h b/core/misc/delegates.h index 1c3e460..476eaec 100644 --- a/core/misc/delegates.h +++ b/core/misc/delegates.h @@ -85,6 +85,7 @@ Raw delegate payload: 10 #include #include #include +#include "extern.h" /////////////////////////////////////////////////////////////// //////////////////// DEFINES SECTION ////////////////////////// diff --git a/core/misc/singleton/singleton_manager.cpp b/core/misc/singleton/singleton_manager.cpp index 9b3629b..b1b60f7 100644 --- a/core/misc/singleton/singleton_manager.cpp +++ b/core/misc/singleton/singleton_manager.cpp @@ -1,5 +1,7 @@ #include "singleton_manager.h" +#include + #include "singleton.h" bool singleton_initliazer::has_init(singleton* s) { diff --git a/core/misc/singleton/singleton_manager.h b/core/misc/singleton/singleton_manager.h index 3fb3e81..63c6786 100644 --- a/core/misc/singleton/singleton_manager.h +++ b/core/misc/singleton/singleton_manager.h @@ -1,4 +1,6 @@ #pragma once +#include +#include "extern.h" class singleton; diff --git a/core/thread_message/thread_message.h b/core/thread_message/thread_message.h index 33fddd3..cac5c56 100644 --- a/core/thread_message/thread_message.h +++ b/core/thread_message/thread_message.h @@ -1,4 +1,6 @@ #pragma once +#include +#include "extern.h" class CORE_API thread_message { public: