Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
dhthwy committed Nov 15, 2024
1 parent 8554f42 commit 8bb0241
Show file tree
Hide file tree
Showing 6 changed files with 3,656 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ endif(CMAKE_CONFIGURATION_TYPES)
option(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF)
option(BUILD_DOCS_NO_HTML "Don't build the HTML docs, only the in-game docs." OFF)
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)
option(DFHACK_SDL_CONSOLE "Use experimental SDL console" ON)

macro(CHECK_GCC compiler_path)
execute_process(COMMAND ${compiler_path} -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT)
Expand Down
23 changes: 19 additions & 4 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ if(UNIX)
option(CONSOLE_NO_CATCH "Make the console not catch 'CTRL+C' events for easier debugging." OFF)
endif()

option(DFHACK_SDL_CONSOLE "Use experimental SDL console" ON)

# Generation
set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml)

Expand Down Expand Up @@ -119,10 +121,20 @@ file(GLOB_RECURSE TEST_SOURCES
*test.cpp)
dfhack_test(dfhack-test "${TEST_SOURCES}")

if(WIN32)
set(CONSOLE_SOURCES Console-windows.cpp)
if (NOT DFHACK_SDL_CONSOLE)
if(WIN32)
set(CONSOLE_SOURCES Console-windows.cpp)
else()
set(CONSOLE_SOURCES Console-posix.cpp)
endif()
set(DFCLIENT_CONSOLE_SOURCES ${CONSOLE_SOURCES})
else()
set(CONSOLE_SOURCES Console-posix.cpp)
if(WIN32)
set(DFCLIENT_CONSOLE_SOURCES Console-windows.cpp)
else()
set(DFCLIENT_CONSOLE_SOURCES Console-posix.cpp)
endif()
set(CONSOLE_SOURCES Console-sdl.cpp Console-sdl-impl.cpp)
endif()

set(MAIN_SOURCES_WINDOWS
Expand Down Expand Up @@ -372,7 +384,7 @@ add_library(dfhack SHARED ${PROJECT_SOURCES})
add_dependencies(dfhack generate_proto_core)
add_dependencies(dfhack generate_headers)

add_library(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS} ${CONSOLE_SOURCES})
add_library(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp Error.cpp ${PROJECT_PROTO_SRCS} ${DFCLIENT_CONSOLE_SOURCES})
add_dependencies(dfhack-client dfhack)

add_executable(dfhack-run dfhack-run.cpp)
Expand Down Expand Up @@ -420,6 +432,9 @@ set_target_properties(dfhack PROPERTIES INTERFACE_LINK_LIBRARIES "")
target_link_libraries(dfhack-client protobuf-lite clsocket jsoncpp_static)
target_link_libraries(dfhack-run dfhack-client)

target_link_libraries(dfhack SDL2_image)
target_link_libraries(dfhack-client SDL2_image)

if(APPLE)
add_custom_command(TARGET dfhack-run COMMAND ${dfhack_SOURCE_DIR}/package/darwin/fix-libs.sh WORKING_DIRECTORY ../ COMMENT "Fixing library dependencies...")
endif()
Expand Down
Loading

0 comments on commit 8bb0241

Please sign in to comment.