diff --git a/CMakeLists.txt b/CMakeLists.txt index 29352434..4643828d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,7 +283,7 @@ target_compile_options(relib PRIVATE ${REDREAM_FLAGS}) if(BUILD_LIBRETRO) -add_library(redream_libretro SHARED $ src/libretro.c) +add_library(redream_libretro SHARED $ src/retro_host.c) set_target_properties(redream_libretro PROPERTIES PREFIX "") set_target_properties(redream_libretro PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(redream_libretro SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS} deps/libretro/include) @@ -308,7 +308,7 @@ endif() # redream #-------------------------------------------------- -add_executable(redream $ src/main.c) +add_executable(redream $ src/glfw_host.c) target_include_directories(redream SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS}) target_include_directories(redream PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) target_link_libraries(redream ${REDREAM_LIBS} glfw) @@ -321,12 +321,12 @@ target_compile_options(redream PRIVATE ${REDREAM_FLAGS}) if(BUILD_TOOLS) -#add_executable(recc $ tools/recc/recc.c) -#target_include_directories(recc SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS}) -#target_include_directories(recc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) -#target_link_libraries(recc ${REDREAM_LIBS}) -#target_compile_definitions(recc PRIVATE ${REDREAM_DEFS} MICROPROFILE_ENABLED=0) -#target_compile_options(recc PRIVATE ${REDREAM_FLAGS}) +add_executable(recc $ src/null_host.c tools/recc/recc.c) +target_include_directories(recc SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS}) +target_include_directories(recc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) +target_link_libraries(recc ${REDREAM_LIBS}) +target_compile_definitions(recc PRIVATE ${REDREAM_DEFS} MICROPROFILE_ENABLED=0) +target_compile_options(recc PRIVATE ${REDREAM_FLAGS}) endif() @@ -437,6 +437,7 @@ endif() # build test binary set(RETEST_SOURCES + src/null_host.c test/test_dead_code_elimination.c test/test_interval_tree.c test/test_list.c @@ -445,10 +446,10 @@ set(RETEST_SOURCES ${asm_inc} test/retest.c) -#add_executable(retest $ ${RETEST_SOURCES}) -#target_include_directories(retest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/test ${REDREAM_INCLUDE_DIRS}) -#target_link_libraries(retest ${REDREAM_LIBS}) -#target_compile_definitions(retest PRIVATE ${REDREAM_DEFS}) -#target_compile_options(retest PRIVATE ${REDREAM_FLAGS}) +add_executable(retest $ ${RETEST_SOURCES}) +target_include_directories(retest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/test ${REDREAM_INCLUDE_DIRS}) +target_link_libraries(retest ${REDREAM_LIBS}) +target_compile_definitions(retest PRIVATE ${REDREAM_DEFS}) +target_compile_options(retest PRIVATE ${REDREAM_FLAGS}) endif() diff --git a/src/main.c b/src/glfw_host.c similarity index 100% rename from src/main.c rename to src/glfw_host.c diff --git a/src/null_host.c b/src/null_host.c new file mode 100644 index 00000000..a31edbcb --- /dev/null +++ b/src/null_host.c @@ -0,0 +1,40 @@ +#include +#include "host.h" + +/* + * audio + */ +void audio_push(struct host *base, const int16_t *data, int num_frames) {} + +/* + * video + */ +void video_gl_make_current(struct host *host, gl_context_t ctx) {} + +void video_gl_destroy_context(struct host *base, gl_context_t ctx) {} + +gl_context_t video_gl_create_context_from(struct host *base, + gl_context_t from) { + return NULL; +} + +gl_context_t video_gl_create_context(struct host *base) { + return NULL; +} + +int video_gl_supports_multiple_contexts(struct host *base) { + return 0; +} + +int video_height(struct host *base) { + return 0; +} + +int video_width(struct host *base) { + return 0; +} + +/* + * input + */ +void input_poll(struct host *base) {} diff --git a/src/libretro.c b/src/retro_host.c similarity index 100% rename from src/libretro.c rename to src/retro_host.c