|
9 | 9 | option(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF) |
10 | 10 | endif() |
11 | 11 |
|
| 12 | +option(DFHACK_SDL_CONSOLE "Use experimental SDL console" ON) |
| 13 | + |
12 | 14 | # Generation |
13 | 15 | set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml) |
14 | 16 |
|
@@ -119,10 +121,20 @@ file(GLOB_RECURSE TEST_SOURCES |
119 | 121 | *test.cpp) |
120 | 122 | dfhack_test(dfhack-test "${TEST_SOURCES}") |
121 | 123 |
|
122 | | -if(WIN32) |
123 | | - set(CONSOLE_SOURCES Console-windows.cpp) |
| 124 | +if (NOT DFHACK_SDL_CONSOLE) |
| 125 | + if(WIN32) |
| 126 | + set(CONSOLE_SOURCES Console-windows.cpp) |
| 127 | + else() |
| 128 | + set(CONSOLE_SOURCES Console-posix.cpp) |
| 129 | + endif() |
| 130 | + set(DFCLIENT_CONSOLE_SOURCES ${CONSOLE_SOURCES}) |
124 | 131 | else() |
125 | | - set(CONSOLE_SOURCES Console-posix.cpp) |
| 132 | + if(WIN32) |
| 133 | + set(DFCLIENT_CONSOLE_SOURCES Console-windows.cpp) |
| 134 | + else() |
| 135 | + set(DFCLIENT_CONSOLE_SOURCES Console-posix.cpp) |
| 136 | + endif() |
| 137 | + set(CONSOLE_SOURCES Console-sdl.cpp Console-sdl-impl.cpp) |
126 | 138 | endif() |
127 | 139 |
|
128 | 140 | set(MAIN_SOURCES_WINDOWS |
@@ -372,7 +384,7 @@ add_library(dfhack SHARED ${PROJECT_SOURCES}) |
372 | 384 | add_dependencies(dfhack generate_proto_core) |
373 | 385 | add_dependencies(dfhack generate_headers) |
374 | 386 |
|
375 | | -add_library(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS} ${CONSOLE_SOURCES}) |
| 387 | +add_library(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS} ${DFCLIENT_CONSOLE_SOURCES}) |
376 | 388 | add_dependencies(dfhack-client dfhack) |
377 | 389 |
|
378 | 390 | add_executable(dfhack-run dfhack-run.cpp) |
@@ -420,6 +432,9 @@ set_target_properties(dfhack PROPERTIES INTERFACE_LINK_LIBRARIES "") |
420 | 432 | target_link_libraries(dfhack-client protobuf-lite clsocket jsoncpp_static) |
421 | 433 | target_link_libraries(dfhack-run dfhack-client) |
422 | 434 |
|
| 435 | +target_link_libraries(dfhack SDL2_image) |
| 436 | +target_link_libraries(dfhack-client SDL2_image) |
| 437 | + |
423 | 438 | if(APPLE) |
424 | 439 | add_custom_command(TARGET dfhack-run COMMAND ${dfhack_SOURCE_DIR}/package/darwin/fix-libs.sh WORKING_DIRECTORY ../ COMMENT "Fixing library dependencies...") |
425 | 440 | endif() |
|
0 commit comments