Skip to content

Commit 8bb0241

Browse files
committed
Initial
1 parent 8554f42 commit 8bb0241

File tree

6 files changed

+3656
-4
lines changed

6 files changed

+3656
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ endif(CMAKE_CONFIGURATION_TYPES)
3232
option(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF)
3333
option(BUILD_DOCS_NO_HTML "Don't build the HTML docs, only the in-game docs." OFF)
3434
option(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduces libdfhack size to about half but removes a few useful symbols)" ON)
35+
option(DFHACK_SDL_CONSOLE "Use experimental SDL console" ON)
3536

3637
macro(CHECK_GCC compiler_path)
3738
execute_process(COMMAND ${compiler_path} -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT)

library/CMakeLists.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ if(UNIX)
99
option(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF)
1010
endif()
1111

12+
option(DFHACK_SDL_CONSOLE "Use experimental SDL console" ON)
13+
1214
# Generation
1315
set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml)
1416

@@ -119,10 +121,20 @@ file(GLOB_RECURSE TEST_SOURCES
119121
*test.cpp)
120122
dfhack_test(dfhack-test "${TEST_SOURCES}")
121123

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})
124131
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)
126138
endif()
127139

128140
set(MAIN_SOURCES_WINDOWS
@@ -372,7 +384,7 @@ add_library(dfhack SHARED ${PROJECT_SOURCES})
372384
add_dependencies(dfhack generate_proto_core)
373385
add_dependencies(dfhack generate_headers)
374386

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})
376388
add_dependencies(dfhack-client dfhack)
377389

378390
add_executable(dfhack-run dfhack-run.cpp)
@@ -420,6 +432,9 @@ set_target_properties(dfhack PROPERTIES INTERFACE_LINK_LIBRARIES "")
420432
target_link_libraries(dfhack-client protobuf-lite clsocket jsoncpp_static)
421433
target_link_libraries(dfhack-run dfhack-client)
422434

435+
target_link_libraries(dfhack SDL2_image)
436+
target_link_libraries(dfhack-client SDL2_image)
437+
423438
if(APPLE)
424439
add_custom_command(TARGET dfhack-run COMMAND ${dfhack_SOURCE_DIR}/package/darwin/fix-libs.sh WORKING_DIRECTORY ../ COMMENT "Fixing library dependencies...")
425440
endif()

0 commit comments

Comments
 (0)