added null host for tool compiles

This commit is contained in:
Anthony Pesch 2017-05-07 14:17:24 -04:00
parent fcb926d198
commit f606679f1a
4 changed files with 54 additions and 13 deletions

View File

@ -283,7 +283,7 @@ target_compile_options(relib PRIVATE ${REDREAM_FLAGS})
if(BUILD_LIBRETRO)
add_library(redream_libretro SHARED $<TARGET_OBJECTS:relib> src/libretro.c)
add_library(redream_libretro SHARED $<TARGET_OBJECTS:relib> 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 $<TARGET_OBJECTS:relib> src/main.c)
add_executable(redream $<TARGET_OBJECTS:relib> 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 $<TARGET_OBJECTS:relib> 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 $<TARGET_OBJECTS:relib> 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 $<TARGET_OBJECTS:relib> ${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 $<TARGET_OBJECTS:relib> ${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()

40
src/null_host.c Normal file
View File

@ -0,0 +1,40 @@
#include <stddef.h>
#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) {}