Skip to content

Commit 686e590

Browse files
committed
Trying to fix CI
1 parent b23fb11 commit 686e590

5 files changed

Lines changed: 127 additions & 20 deletions

File tree

.github/workflows/linux.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Linux Validation
2-
on: [pull_request]
2+
3+
on:
4+
pull_request:
5+
branches: [ "*" ]
36

47
jobs:
58
build:
@@ -34,9 +37,15 @@ jobs:
3437
cmake ..
3538
make
3639
sudo make install
40+
- name: Setup Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.12'
44+
- name: Install Python dependencies
45+
run: pip install -r libultraship/requirements.txt
3746
- name: Build
3847
run: |
39-
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
48+
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE=$(which python3)
4049
cmake --build build-cmake -j
4150
- name: Create Package
4251
run: |

.github/workflows/main.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: GenerateBuilds
2+
23
on:
34
push:
45

@@ -57,12 +58,16 @@ jobs:
5758
submodules: recursive
5859
- name: Setup MSVC
5960
uses: ilammy/msvc-dev-cmd@v1
61+
- name: Setup Python
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version: '3.12'
6065
- name: Install Python dependencies
61-
run: python -m pip install -r libultraship/requirements.txt
66+
run: pip install -r libultraship/requirements.txt
6267
- name: Build
6368
run: |
6469
$env:VCPKG_ROOT=""
65-
cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=Release
70+
cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
6671
cmake --build ./build/x64 --config Release --parallel 10
6772
- name: Download ghostship.o2r
6873
uses: actions/download-artifact@v4
@@ -174,8 +179,6 @@ jobs:
174179
run: sudo apt update
175180
- name: Install dependencies
176181
run: sudo apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
177-
- name: Install python dependencies
178-
run: pip3 install cryptography --break-system-packages
179182
- name: ccache
180183
uses: hendrikmuhs/ccache-action@v1.2.14
181184
with:
@@ -231,25 +234,34 @@ jobs:
231234
make
232235
sudo make install
233236
sudo cp -av /usr/local/lib/libzip* /lib/x86_64-linux-gnu/
237+
- name: Setup Python
238+
uses: actions/setup-python@v5
239+
with:
240+
python-version: '3.12'
241+
- name: Install Python dependencies
242+
run: pip install -r libultraship/requirements.txt
234243
- name: Download ghostship.o2r
235244
uses: actions/download-artifact@v4
236245
with:
237246
name: ghostship.o2r
238247
path: ./build-cmake
239248
- name: Build
240249
run: |
241-
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
250+
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE=$(which python3)
242251
cmake --build build-cmake --config Release -j3
243252
(cd build-cmake && cpack -G External)
244-
wget -O gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt
253+
wget -O gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt
245254
mv README.md readme.txt
246255
mv build-cmake/*.appimage ghostship.appimage
247256
- name: Upload build
248257
uses: actions/upload-artifact@v4
249258
with:
250259
name: Ghostship-linux
251260
path: |
261+
.tcc
252262
ghostship.appimage
263+
config.yml
264+
assets
253265
gamecontrollerdb.txt
254266
255267
build-switch:

.github/workflows/windows.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Windows Validation
2-
on: [pull_request]
2+
3+
on:
4+
pull_request:
5+
branches: [ "*" ]
36

47
jobs:
58
build:
@@ -10,12 +13,16 @@ jobs:
1013
submodules: recursive
1114
- name: Setup MSVC
1215
uses: ilammy/msvc-dev-cmd@v1
16+
- name: Setup Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.12'
1320
- name: Install Python dependencies
14-
run: python -m pip install -r libultraship/requirements.txt
21+
run: pip install -r libultraship/requirements.txt
1522
- name: Build
1623
run: |
1724
$env:VCPKG_ROOT=""
18-
cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=Release
25+
cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
1926
cmake --build ./build/x64
2027
- name: Upload build
2128
uses: actions/upload-artifact@v4

CMakeLists.txt

Lines changed: 87 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,49 @@ include(FetchContent)
77
include(cmake/ghostship-cvars.cmake)
88
include(cmake/lus-cvars.cmake)
99

10+
set(VENV_PATH "${CMAKE_CURRENT_BINARY_DIR}/venv")
11+
12+
if(WIN32)
13+
set(VENV_PYTHON "${VENV_PATH}/Scripts/python.exe")
14+
else()
15+
set(VENV_PYTHON "${VENV_PATH}/bin/python")
16+
endif()
17+
18+
if(NOT EXISTS "${VENV_PYTHON}")
19+
message(STATUS "Creating Python virtual environment...")
20+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
21+
execute_process(
22+
COMMAND ${Python3_EXECUTABLE} -m venv ${VENV_PATH}
23+
RESULT_VARIABLE VENV_RET
24+
)
25+
if(NOT VENV_RET EQUAL 0)
26+
message(FATAL_ERROR "Failed to create virtual environment")
27+
endif()
28+
endif()
29+
30+
message(STATUS "Ensuring cryptography is installed in venv...")
31+
execute_process(
32+
COMMAND "${VENV_PYTHON}" -m pip install cryptography
33+
RESULT_VARIABLE PIP_RET
34+
)
35+
36+
if(NOT PIP_RET EQUAL 0)
37+
message(FATAL_ERROR "Failed to install cryptography in venv")
38+
endif()
39+
40+
set(Python3_EXECUTABLE ${VENV_PYTHON} CACHE FILEPATH "Path to venv python" FORCE)
41+
set(Python_EXECUTABLE ${VENV_PYTHON} CACHE FILEPATH "Path to venv python" FORCE)
42+
set(Python3_ROOT_DIR "${VENV_PATH}" CACHE PATH "Root dir of venv python" FORCE)
43+
set(Python3_FIND_VIRTUALENV FIRST CACHE STRING "Prefer venv python" FORCE)
44+
45+
unset(Python3_FOUND CACHE)
46+
unset(Python3_Interpreter_FOUND CACHE)
47+
unset(Python3_INTERPRETER_ID CACHE)
48+
49+
find_package(Python3 REQUIRED COMPONENTS Interpreter)
50+
51+
message(STATUS "Using Python from venv: ${Python3_EXECUTABLE}")
52+
1053
set(NATO_PHONETIC_ALPHABET
1154
"Alfa" "Bravo" "Charlie" "Delta" "Echo" "Foxtrot" "Golf" "Hotel"
1255
"India" "Juliett" "Kilo" "Lima" "Mike" "November" "Oscar" "Papa"
@@ -327,6 +370,32 @@ target_link_libraries(${PROJECT_NAME} PRIVATE "$<LINK_LIBRARY:WHOLE_ARCHIVE,libu
327370
set_target_properties(${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS TRUE)
328371
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
329372

373+
#=================== cimgui ===================
374+
FetchContent_Declare(
375+
cimgui
376+
GIT_REPOSITORY https://github.com/cimgui/cimgui.git
377+
GIT_TAG 1.91.9bdock
378+
GIT_SUBMODULES ""
379+
)
380+
FetchContent_Populate(cimgui)
381+
FetchContent_GetProperties(ImGui)
382+
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/_deps")
383+
file(CREATE_LINK "${imgui_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/_deps/imgui" SYMBOLIC)
384+
385+
add_library(cimgui STATIC ${cimgui_SOURCE_DIR}/cimgui.cpp)
386+
387+
target_include_directories(cimgui
388+
PRIVATE "${CMAKE_BINARY_DIR}/_deps"
389+
PUBLIC "${cimgui_SOURCE_DIR}"
390+
)
391+
392+
target_compile_definitions(cimgui
393+
INTERFACE CIMGUI_DEFINE_ENUMS_AND_STRUCTS
394+
)
395+
396+
target_link_libraries(cimgui PUBLIC ImGui)
397+
target_link_libraries(${PROJECT_NAME} PRIVATE "$<LINK_LIBRARY:WHOLE_ARCHIVE,cimgui>")
398+
330399
if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
331400
get_property(IOS_TOOLCHAIN_FILE GLOBAL PROPERTY IOS_TOOLCHAIN_FILE)
332401
include(${IOS_TOOLCHAIN_FILE})
@@ -622,31 +691,41 @@ if (MSVC)
622691
)
623692
add_custom_command(
624693
TARGET ${PROJECT_NAME} POST_BUILD
625-
COMMENT "DEBUG: Checking what is inside the tinycc-src lib folder..."
626-
COMMAND cmd /c "dir \"${CMAKE_BINARY_DIR}/_deps/tinycc-src/win32/lib/\""
694+
COMMENT "Copying libtcc headers and libs..."
695+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/"
696+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/"
697+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
698+
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/_deps/tinycc-src/include/" "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
699+
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/_deps/tinycc-src/win32/include/" "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
700+
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:libtcc1>" "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/libtcc1$<TARGET_FILE_SUFFIX:libtcc1>"
627701
VERBATIM
628702
)
629703
add_custom_command(
630704
TARGET ${PROJECT_NAME} POST_BUILD
631-
COMMENT "DEBUG: Checking what is inside the tinycc-src lib folder..."
632-
COMMAND cmd /c "dir \"${CMAKE_BINARY_DIR}/_deps/tinycc-src/win32/\""
705+
COMMENT "Generating .def file..."
706+
COMMAND "${CMAKE_BINARY_DIR}/_deps/tinycc-src/win32/tcc.exe" -impdef "$<TARGET_FILE:Ghostship>" -o "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/Ghostship.def"
633707
VERBATIM
634708
)
709+
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
635710
add_custom_command(
636711
TARGET ${PROJECT_NAME} POST_BUILD
637712
COMMENT "Copying libtcc headers and libs..."
638713
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/"
639714
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/"
640715
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
641716
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/_deps/tinycc-src/include/" "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
642-
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/_deps/tinycc-src/win32/include/" "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
643-
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/_deps/tinycc-src/win32/lib/libtcc1.a" "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/libtcc1.a"
717+
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:libtcc1>" "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/libtcc1.a"
644718
VERBATIM
645719
)
720+
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
646721
add_custom_command(
647722
TARGET ${PROJECT_NAME} POST_BUILD
648-
COMMENT "Generating .def file..."
649-
COMMAND "${CMAKE_BINARY_DIR}/_deps/tinycc-src/win32/tcc.exe" -impdef "$<TARGET_FILE:Ghostship>" -o "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/Ghostship.def"
723+
COMMENT "Copying libtcc headers and libs..."
724+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/"
725+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/"
726+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
727+
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/_deps/tinycc-src/include/" "$<TARGET_FILE_DIR:Ghostship>/.tcc/include/"
728+
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:libtcc1>" "$<TARGET_FILE_DIR:Ghostship>/.tcc/lib/libtcc1.a"
650729
VERBATIM
651730
)
652731
endif()

libultraship

Submodule libultraship updated 49 files

0 commit comments

Comments
 (0)