Skip to content

Commit 10f963c

Browse files
Lgt2xtophyr
authored andcommitted
HogMaker as external project
1 parent 4ff0665 commit 10f963c

File tree

7 files changed

+49
-94
lines changed

7 files changed

+49
-94
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
shell: arch -x86_64 /bin/bash -e {0}
7070
run: |
7171
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
72-
eval "$(/usr/local/bin/brew shellenv)" # makes the Intel version of Brew and its installs are enshrined as the default
72+
eval "$(/usr/local/bin/brew shellenv)" # makes the Intel version of Brew and its installs are enshrined as the default
7373
echo "PATH=$PATH" >> $GITHUB_ENV # modify $PATH so the above step persists into the future steps
7474
7575
- name: Install macOS dependencies
@@ -105,9 +105,7 @@ jobs:
105105
- name: Configure cross-compiled build
106106
if: ${{ matrix.os.preset == 'linux-cross-arm64' }}
107107
run: |
108-
cmake --preset linux
109-
ninja -f build-${{ matrix.build_type }}.ninja -C builds/linux/ HogMaker
110-
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
108+
cmake --preset linux-cross-arm64 -DBUILD_TESTING=OFF -DENABLE_LOGGER=ON -DFORCE_PORTABLE_INSTALL=ON -DBUILD_EDITOR=OFF -DUSE_EXTERNAL_PLOG=ON
111109
112110
- name: Configure CMake
113111
if: ${{ matrix.os.preset != 'linux-cross-arm64' }}

CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,17 @@ endif()
275275

276276
add_subdirectory(Descent3)
277277

278-
if (CMAKE_CROSSCOMPILING)
279-
find_package(HogMaker REQUIRED)
280-
else()
281-
add_subdirectory(tools)
278+
# Always build HogMaker natively. Build it as external project,
279+
include(ExternalProject)
280+
ExternalProject_Add(HogMaker
281+
SOURCE_DIR ${CMAKE_SOURCE_DIR}/tools
282+
BINARY_DIR ${CMAKE_BINARY_DIR}/tools
283+
INSTALL_COMMAND ""
284+
)
285+
if (DEFINED CMAKE_CONFIGURATION_TYPES)
286+
set(HogMakerBin_ConfigDir "$<CONFIG>/")
282287
endif()
288+
set(HogMakerBin ${CMAKE_BINARY_DIR}/tools/${HogMakerBin_ConfigDir}HogMaker)
283289

284290
add_subdirectory(netcon)
285291
add_subdirectory(netgames)

cmake/HogMaker.cmake

Lines changed: 0 additions & 58 deletions
This file was deleted.

netcon/lanclient/CMakeLists.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
1919
set_target_properties(Direct_TCP_IP PROPERTIES SUFFIX ".dylib")
2020
endif()
2121

22-
include(HogMaker)
23-
MakeHog(
24-
TARGET Direct_TCP_IP_Hog
25-
OUTPUT "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Direct TCP~IP.d3c"
26-
INPUT_FILE "${CMAKE_SOURCE_DIR}/netcon/lanclient/TCP_IP.d3c.txt"
27-
SEARCH_PATH "$<TARGET_FILE_DIR:Direct_TCP_IP>" "${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
28-
DEPENDS Direct_TCP_IP
22+
add_custom_target(Direct_TCP_IP_Hog
23+
COMMAND ${HogMakerBin}
24+
"$<TARGET_FILE_DIR:Descent3>/online/Direct TCP~IP.d3c"
25+
"${CMAKE_SOURCE_DIR}/netcon/lanclient/TCP_IP.d3c.txt"
26+
"${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
27+
"$<TARGET_FILE_DIR:Direct_TCP_IP>"
28+
DEPENDS Direct_TCP_IP HogMaker
29+
COMMENT "Generate 'Direct TCP~IP.d3c'"
2930
)
3031

3132
install(
32-
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Direct TCP~IP.d3c"
33-
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
33+
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Direct TCP~IP.d3c"
34+
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
3435
)

netcon/mtclient/CMakeLists.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2929
set_target_properties(Parallax_Online PROPERTIES SUFFIX ".dylib")
3030
endif()
3131

32-
include(HogMaker)
33-
MakeHog(
34-
TARGET Parallax_Online_Hog
35-
OUTPUT "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Parallax Online.d3c"
36-
INPUT_FILE "${CMAKE_SOURCE_DIR}/netcon/mtclient/Parallax_Online.d3c.txt"
37-
SEARCH_PATH "$<TARGET_FILE_DIR:Parallax_Online>" "${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
38-
DEPENDS Parallax_Online
32+
add_custom_target(Parallax_Online_Hog
33+
COMMAND ${HogMakerBin}
34+
"$<TARGET_FILE_DIR:Descent3>/online/Parallax Online.d3c"
35+
"${CMAKE_SOURCE_DIR}/netcon/mtclient/Parallax_Online.d3c.txt"
36+
"${CMAKE_SOURCE_DIR}/scripts/data/fullhog/"
37+
"$<TARGET_FILE_DIR:Parallax_Online>"
38+
DEPENDS Parallax_Online HogMaker
39+
COMMENT "Generate 'Parallax Online.d3c'"
3940
)
4041

4142
install(
42-
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Parallax Online.d3c"
43-
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
43+
FILES "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/online/Parallax Online.d3c"
44+
DESTINATION ${CMAKE_INSTALL_DATADIR}/online
4445
)

scripts/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ foreach(SCRIPT ${SCRIPTS})
9090
endif()
9191
endforeach()
9292

93-
include(HogMaker)
94-
MakeHog(
95-
TARGET HogFull
96-
OUTPUT "${D3_GENERATED_FILES_OUTPUT_DIRECTORY}/d3-${HOG_NAME}.hog"
97-
INPUT_FILE "${CMAKE_SOURCE_DIR}/scripts/data/fullhog/d3-${HOG_NAME}-fullhog.txt"
98-
SEARCH_PATH "$<TARGET_FILE_DIR:AIGame>"
99-
DEPENDS ${SCRIPTS}
93+
add_custom_target(HogFull
94+
COMMAND ${HogMakerBin}
95+
"$<TARGET_FILE_DIR:Descent3>/d3-${HOG_NAME}.hog"
96+
"${CMAKE_SOURCE_DIR}/scripts/data/fullhog/d3-${HOG_NAME}-fullhog.txt"
97+
"$<TARGET_FILE_DIR:AIGame>"
98+
DEPENDS ${SCRIPTS} HogMaker data/fullhog/d3-${HOG_NAME}-fullhog.txt
99+
COMMENT "Generate fullhog/d3-${HOG_NAME}.hog"
100100
)
101101

102102
install(
@@ -106,7 +106,7 @@ install(
106106

107107
# FIXME: there may be only one d3-linux.hog, need deal with demo somehow.
108108
# add_custom_target(HogLinuxDemo
109-
# COMMAND $<TARGET_FILE:HogMaker>
109+
# COMMAND ${HogMakerBin}
110110
# "${CMAKE_BINARY_DIR}/scripts/data/demohog/d3-${HOG_NAME}.hog"
111111
# "${CMAKE_BINARY_DIR}/scripts/data/demohog/d3-${HOG_NAME}-demohog.txt"
112112
# "${CMAKE_BINARY_DIR}/scripts/"

tools/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
cmake_minimum_required(VERSION 3.20) # For using CMAKE_<LANG>_BYTE_ORDER
2+
3+
project(HogMaker LANGUAGES CXX)
4+
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
18
add_executable(
29
HogMaker
310
HogMaker/HogFormat.cpp
411
HogMaker/HogMaker.cpp
512
)
6-
target_include_directories(HogMaker PRIVATE ${PROJECT_BINARY_DIR}/lib)
7-
export(TARGETS HogMaker FILE "${CMAKE_BINARY_DIR}/HogMakerConfig.cmake")
13+
14+
target_include_directories(HogMaker PRIVATE ${PROJECT_SOURCE_DIR}/../lib ${PROJECT_BINARY_DIR}/lib)

0 commit comments

Comments
 (0)