Skip to content

Commit

Permalink
HogMaker as external project
Browse files Browse the repository at this point in the history
  • Loading branch information
Lgt2x authored and tophyr committed Dec 27, 2024
1 parent 4ff0665 commit 3f8f876
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 101 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
shell: arch -x86_64 /bin/bash -e {0}
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/usr/local/bin/brew shellenv)" # makes the Intel version of Brew and its installs are enshrined as the default
eval "$(/usr/local/bin/brew shellenv)" # makes the Intel version of Brew and its installs are enshrined as the default
echo "PATH=$PATH" >> $GITHUB_ENV # modify $PATH so the above step persists into the future steps
- name: Install macOS dependencies
Expand Down Expand Up @@ -105,9 +105,7 @@ jobs:
- name: Configure cross-compiled build
if: ${{ matrix.os.preset == 'linux-cross-arm64' }}
run: |
cmake --preset linux
ninja -f build-${{ matrix.build_type }}.ninja -C builds/linux/ HogMaker
cmake --preset linux-cross-arm64 -DHogMaker_DIR=$PWD/builds/linux/ -DBUILD_TESTING=OFF -DENABLE_LOGGER=ON -DFORCE_PORTABLE_INSTALL=ON -DBUILD_EDITOR=OFF -DUSE_EXTERNAL_PLOG=ON
cmake --preset linux-cross-arm64 -DBUILD_TESTING=OFF -DENABLE_LOGGER=ON -DFORCE_PORTABLE_INSTALL=ON -DBUILD_EDITOR=OFF -DUSE_EXTERNAL_PLOG=ON
- name: Configure CMake
if: ${{ matrix.os.preset != 'linux-cross-arm64' }}
Expand Down
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,17 @@ endif()

add_subdirectory(Descent3)

if (CMAKE_CROSSCOMPILING)
find_package(HogMaker REQUIRED)
else()
add_subdirectory(tools)
# Always build HogMaker natively. Build it as external project,
include(ExternalProject)
ExternalProject_Add(HogMaker
SOURCE_DIR ${CMAKE_SOURCE_DIR}/tools
BINARY_DIR ${CMAKE_BINARY_DIR}/tools
INSTALL_COMMAND ""
)
if (DEFINED CMAKE_CONFIGURATION_TYPES)
set(HogMakerBin_ConfigDir "$<CONFIG>/")
endif()
set(HogMakerBin ${CMAKE_BINARY_DIR}/tools/${HogMakerBin_ConfigDir}HogMaker)

add_subdirectory(netcon)
add_subdirectory(netgames)
Expand Down
58 changes: 0 additions & 58 deletions cmake/HogMaker.cmake

This file was deleted.

15 changes: 8 additions & 7 deletions netcon/descent3onlineclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(Descent3_Online_TCP_IP PROPERTIES SUFFIX ".dylib")
endif()

include(HogMaker)
MakeHog(
TARGET Descent3_Online_TCP_IP_Hog
OUTPUT "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Descent3 Online.d3c"
INPUT_FILE "${CMAKE_SOURCE_DIR}/netcon/descent3onlineclient/d3online.d3c.txt"
SEARCH_PATH "$<TARGET_FILE_DIR:Descent3_Online_TCP_IP>" "${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
DEPENDS Descent3_Online_TCP_IP
add_custom_target(Descent3_Online_TCP_IP_Hog
COMMAND ${HogMakerBin}
"${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Descent3 Online.d3c"
"${CMAKE_SOURCE_DIR}/netcon/descent3onlineclient/d3online.d3c.txt"
"${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
"$<TARGET_FILE_DIR:Descent3_Online_TCP_IP>"
DEPENDS Descent3_Online_TCP_IP HogMaker
COMMENT "Generate 'Direct Descent3 Online.d3c'"
)

install(
Expand Down
19 changes: 10 additions & 9 deletions netcon/lanclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(Direct_TCP_IP PROPERTIES SUFFIX ".dylib")
endif()

include(HogMaker)
MakeHog(
TARGET Direct_TCP_IP_Hog
OUTPUT "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Direct TCP~IP.d3c"
INPUT_FILE "${CMAKE_SOURCE_DIR}/netcon/lanclient/TCP_IP.d3c.txt"
SEARCH_PATH "$<TARGET_FILE_DIR:Direct_TCP_IP>" "${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
DEPENDS Direct_TCP_IP
add_custom_target(Direct_TCP_IP_Hog
COMMAND ${HogMakerBin}
"${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Direct TCP~IP.d3c"
"${CMAKE_SOURCE_DIR}/netcon/lanclient/TCP_IP.d3c.txt"
"${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
"$<TARGET_FILE_DIR:Direct_TCP_IP>"
DEPENDS Direct_TCP_IP HogMaker
COMMENT "Generate 'Direct TCP~IP.d3c'"
)

install(
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Direct TCP~IP.d3c"
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Direct TCP~IP.d3c"
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
)
19 changes: 10 additions & 9 deletions netcon/mtclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(Parallax_Online PROPERTIES SUFFIX ".dylib")
endif()

include(HogMaker)
MakeHog(
TARGET Parallax_Online_Hog
OUTPUT "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Parallax Online.d3c"
INPUT_FILE "${CMAKE_SOURCE_DIR}/netcon/mtclient/Parallax_Online.d3c.txt"
SEARCH_PATH "$<TARGET_FILE_DIR:Parallax_Online>" "${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
DEPENDS Parallax_Online
add_custom_target(Parallax_Online_Hog
COMMAND ${HogMakerBin}
"${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Parallax Online.d3c"
"${CMAKE_SOURCE_DIR}/netcon/mtclient/Parallax_Online.d3c.txt"
"${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
"$<TARGET_FILE_DIR:Parallax_Online>"
DEPENDS Parallax_Online HogMaker
COMMENT "Generate 'Parallax Online.d3c'"
)

install(
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Parallax Online.d3c"
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Parallax Online.d3c"
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
)
16 changes: 8 additions & 8 deletions scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ foreach(SCRIPT ${SCRIPTS})
endif()
endforeach()

include(HogMaker)
MakeHog(
TARGET HogFull
OUTPUT "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/d3-${HOG_NAME}.hog"
INPUT_FILE "${CMAKE_SOURCE_DIR}/scripts/data/fullhog/d3-${HOG_NAME}-fullhog.txt"
SEARCH_PATH "$<TARGET_FILE_DIR:AIGame>"
DEPENDS ${SCRIPTS}
add_custom_target(HogFull
COMMAND ${HogMakerBin}
"${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/d3-${HOG_NAME}.hog"
"${CMAKE_SOURCE_DIR}/scripts/data/fullhog/d3-${HOG_NAME}-fullhog.txt"
"$<TARGET_FILE_DIR:AIGame>"
DEPENDS ${SCRIPTS} HogMaker data/fullhog/d3-${HOG_NAME}-fullhog.txt
COMMENT "Generate fullhog/d3-${HOG_NAME}.hog"
)

install(
Expand All @@ -106,7 +106,7 @@ install(

# FIXME: there may be only one d3-linux.hog, need deal with demo somehow.
# add_custom_target(HogLinuxDemo
# COMMAND $<TARGET_FILE:HogMaker>
# COMMAND ${HogMakerBin}
# "${CMAKE_BINARY_DIR}/scripts/data/demohog/d3-${HOG_NAME}.hog"
# "${CMAKE_BINARY_DIR}/scripts/data/demohog/d3-${HOG_NAME}-demohog.txt"
# "${CMAKE_BINARY_DIR}/scripts/"
Expand Down
11 changes: 9 additions & 2 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
cmake_minimum_required(VERSION 3.20) # For using CMAKE_<LANG>_BYTE_ORDER

project(HogMaker LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(
HogMaker
HogMaker/HogFormat.cpp
HogMaker/HogMaker.cpp
)
target_include_directories(HogMaker PRIVATE ${PROJECT_BINARY_DIR}/lib)
export(TARGETS HogMaker FILE "${CMAKE_BINARY_DIR}/HogMakerConfig.cmake")

target_include_directories(HogMaker PRIVATE ${PROJECT_SOURCE_DIR}/../lib ${PROJECT_BINARY_DIR}/lib)

0 comments on commit 3f8f876

Please sign in to comment.