Skip to content

Commit

Permalink
de-duplicate stonesense resources
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Jul 29, 2023
1 parent aaf511b commit ac633da
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 46 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/steam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,24 @@ jobs:
run: |
echo "CCACHE_DIR=${HOME}/.ccache" >> $GITHUB_ENV
- name: Configure DFHack (common files)
env:
CC: gcc-10
CXX: g++-10
run: |
cmake \
-S . \
-B build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=build/common-output \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DDFHACK_BUILD_ARCH=64 \
-DBUILD_LIBRARY:BOOL=0 \
-DBUILD_BINARIES:BOOL=0 \
-DBUILD_DOCS:BOOL=1 \
-DCMAKE_INSTALL_PREFIX=build/common-output
-DBUILD_LIBRARY:BOOL=0 \
-DBUILD_PLUGINS:BOOL=0 \
-DBUILD_STONESENSE:BOOL=1 \
-DINSTALL_DATA_FILES:BOOL=1 \
-DINSTALL_SCRIPTS:BOOL=1
- name: Build DFHack (common files)
run: |
ninja -C build install
Expand All @@ -92,16 +100,16 @@ jobs:
-S . \
-B build \
-G Ninja \
-DDFHACK_BUILD_ARCH=64 \
-DBUILD_STONESENSE:BOOL=1 \
-DCMAKE_INSTALL_PREFIX=build/linux-output \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_LIBRARY:BOOL=1 \
-DBUILD_BINARIES:BOOL=1 \
-DDFHACK_BUILD_ARCH=64 \
-DBUILD_DOCS:BOOL=0 \
-DINSTALL_SCRIPTS:BOOL=0 \
-DBUILD_LIBRARY:BOOL=1 \
-DBUILD_PLUGINS:BOOL=1 \
-DBUILD_STONESENSE:BOOL=1 \
-DINSTALL_DATA_FILES:BOOL=0 \
-DCMAKE_INSTALL_PREFIX=build/linux-output
-DINSTALL_SCRIPTS:BOOL=0
- name: Build DFHack (linux build)
run: |
ninja -C build install
Expand All @@ -110,7 +118,7 @@ jobs:
ccache --show-stats
- name: Cross-compile win64 artifacts
env:
CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DFLAUNCH:BOOL=1 -DBUILD_DOCS:BOOL=0 -DINSTALL_SCRIPTS:BOOL=0 -DINSTALL_DATA_FILES:BOOL=0'
CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DFLAUNCH:BOOL=1 -DBUILD_DOCS:BOOL=0 -DINSTALL_DATA_FILES:BOOL=0 -DINSTALL_SCRIPTS:BOOL=0'
steam_username: ${{ secrets.STEAM_SDK_USERNAME }}
steam_password: ${{ secrets.STEAM_SDK_PASSWORD }}
run: |
Expand Down
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ set(DFHACK_USERDOC_DESTINATION ${DFHACK_DATA_DESTINATION})
# some options for the user/developer to play with
option(BUILD_LIBRARY "Build the DFHack library." ON)
option(BUILD_PLUGINS "Build the DFHack plugins." ON)
option(BUILD_BINARIES "Build the DFHack binary tools." ON)
option(INSTALL_SCRIPTS "Install DFHack scripts." ON)
option(INSTALL_DATA_FILES "Install DFHack common data files." ON)

Expand Down Expand Up @@ -418,9 +417,7 @@ file(WRITE "${CMAKE_BINARY_DIR}/dfhack_setarch.txt" ${DFHACK_SETARCH})
install(FILES "${CMAKE_BINARY_DIR}/dfhack_setarch.txt" DESTINATION "${DFHACK_DATA_DESTINATION}")

# build the plugins
if(BUILD_LIBRARY AND BUILD_PLUGINS)
add_subdirectory(plugins)
endif()
add_subdirectory(plugins)

if(INSTALL_DATA_FILES)
add_subdirectory(data)
Expand Down
66 changes: 34 additions & 32 deletions plugins/Plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,42 +115,44 @@ macro(dfhack_plugin)
endif()
endif()

add_library(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
ide_folder(${PLUGIN_NAME} "Plugins")
if(BUILD_LIBRARY AND BUILD_PLUGINS)
add_library(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
ide_folder(${PLUGIN_NAME} "Plugins")

target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/include")
target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/proto")
target_include_directories(${PLUGIN_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/proto")
target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/depends/xgetopt")

if(NUM_PROTO)
add_dependencies(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME})
target_link_libraries(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES})
else()
target_link_libraries(${PLUGIN_NAME} dfhack dfhack-version ${PLUGIN_LINK_LIBRARIES})
endif()

target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/include")
target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/proto")
target_include_directories(${PLUGIN_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/proto")
target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/depends/xgetopt")
add_dependencies(${PLUGIN_NAME} dfhack-version)

if(NUM_PROTO)
add_dependencies(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME})
target_link_libraries(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES})
else()
target_link_libraries(${PLUGIN_NAME} dfhack dfhack-version ${PLUGIN_LINK_LIBRARIES})
endif()
# Make sure the source is generated before the executable builds.
add_dependencies(${PLUGIN_NAME} generate_proto)

add_dependencies(${PLUGIN_NAME} dfhack-version)
if(UNIX)
set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_GCC}")
else()
set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_MSVC}")
endif()
set_target_properties(${PLUGIN_NAME} PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}")

# Make sure the source is generated before the executable builds.
add_dependencies(${PLUGIN_NAME} generate_proto)
if(APPLE)
set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dylib PREFIX "")
elseif(UNIX)
set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.so PREFIX "")
else()
set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll)
endif()

if(UNIX)
set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_GCC}")
else()
set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_MSVC}")
install(TARGETS ${PLUGIN_NAME}
LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION}
RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION})
endif()
set_target_properties(${PLUGIN_NAME} PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}")

if(APPLE)
set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dylib PREFIX "")
elseif(UNIX)
set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.so PREFIX "")
else()
set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll)
endif()

install(TARGETS ${PLUGIN_NAME}
LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION}
RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION})
endmacro()

0 comments on commit ac633da

Please sign in to comment.