Uses Corrosion to build libgui (#1058)
Some checks failed
Development Build / Build (push) Has been cancelled
Development Build / Update PRs (push) Has been cancelled

This commit is contained in:
Putta Khunchalee 2024-10-22 03:35:32 +07:00 committed by GitHub
parent c2cc076d80
commit 01693fa90d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 19 deletions

View File

@ -84,7 +84,7 @@ jobs:
working-directory: src
- name: Create Application Bundle
run: |
cmake --install build --prefix .
cmake --install build --prefix "$(pwd)"
mkdir dist
mv obliteration.app dist/Obliteration.app
- name: Fix library paths

View File

@ -1,15 +1,20 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.22)
include(FetchContent)
# Fetch external CMake scripts.
FetchContent_Declare(
corrosion
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
)
FetchContent_Declare(
msvc
GIT_REPOSITORY https://github.com/MarkSchofield/WindowsToolchain.git
GIT_TAG v0.11.0
)
FetchContent_MakeAvailable(msvc)
FetchContent_MakeAvailable(msvc corrosion)
# Set project properties.
project(obliteration)
@ -50,25 +55,13 @@ endif()
set(KERNEL_OUTPUTS $<IF:$<CONFIG:Debug>,${CMAKE_CURRENT_SOURCE_DIR}/target/${KERNEL_TARGET}/debug,${CMAKE_CURRENT_SOURCE_DIR}/target/${KERNEL_TARGET}/release>)
set(KERNEL ${KERNEL_OUTPUTS}/obkrnl)
set(HOST_OUTPUTS $<IF:$<CONFIG:Debug>,${CMAKE_CURRENT_SOURCE_DIR}/target/debug,${CMAKE_CURRENT_SOURCE_DIR}/target/release>)
if(WIN32)
set(LIBGUI ${HOST_OUTPUTS}/gui.lib)
else()
set(LIBGUI ${HOST_OUTPUTS}/libgui.a)
endif()
add_custom_target(libgui
COMMAND cargo build $<IF:$<CONFIG:Debug>,--profile=dev,--release>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gui
BYPRODUCTS ${LIBGUI})
add_custom_target(kernel
COMMAND cargo ${KERNEL_TOOLCHAIN} build $<IF:$<CONFIG:Debug>,--profile=dev,--release> --target ${KERNEL_TARGET} ${KERNEL_OPTS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/kernel
BYPRODUCTS ${KERNEL})
add_dependencies(libgui kernel)
corrosion_import_crate(MANIFEST_PATH Cargo.toml CRATES gui)
# Add GUI.
add_subdirectory(gui)

View File

@ -10,7 +10,7 @@ if(APPLE)
find_library(HYPERVISOR Hypervisor REQUIRED)
endif()
# Setup application target.
# Setup GUI.
add_executable(obliteration WIN32 MACOSX_BUNDLE
ansi_escape.cpp
app_data.cpp
@ -43,7 +43,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_sources(obliteration PRIVATE kvm.cpp vulkan.cpp)
endif()
add_dependencies(obliteration libgui)
add_dependencies(obliteration kernel)
set_target_properties(obliteration PROPERTIES AUTOMOC ON AUTORCC ON)
@ -66,7 +66,7 @@ target_compile_features(obliteration PRIVATE cxx_std_17)
target_link_libraries(obliteration PRIVATE Qt6::Svg Qt6::Widgets)
target_link_libraries(obliteration PRIVATE Threads::Threads)
target_link_libraries(obliteration PRIVATE ${LIBGUI})
target_link_libraries(obliteration PRIVATE gui)
if(WIN32)
target_link_libraries(obliteration PRIVATE bcrypt imm32 ntdll setupapi userenv version winhvplatform winmm ws2_32)