2022-09-18 02:57:50 +00:00
|
|
|
# CMake modules
|
|
|
|
include(ExternalProject)
|
|
|
|
|
2022-09-15 21:29:53 +00:00
|
|
|
# External dependencies.
|
2022-09-24 09:01:22 +00:00
|
|
|
find_package(Qt6 COMPONENTS Widgets REQUIRED)
|
2022-09-18 07:04:02 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2022-09-15 05:22:22 +00:00
|
|
|
|
2023-02-26 19:22:42 +00:00
|
|
|
# Setup LLVM target.
|
|
|
|
set(LLVM_OPTS -DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
|
|
|
|
list(APPEND LLVM_OPTS -DLLVM_TARGETS_TO_BUILD:STRING=X86)
|
2023-02-27 23:30:15 +00:00
|
|
|
# turn off zstd due to potential shared libray issue
|
|
|
|
list(APPEND LLVM_OPTS -DLLVM_ENABLE_ZSTD:BOOL=OFF)
|
|
|
|
|
2023-02-26 19:22:42 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Target CPU is not supported")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
|
|
|
|
list(APPEND LLVM_OPTS -DLLVM_TARGETS_TO_BUILD:STRING=X86)
|
2023-02-27 23:30:15 +00:00
|
|
|
list(APPEND LLVM_OPTS -DLLVM_ENABLE_ZSTD:BOOL=OFF)
|
|
|
|
|
2023-02-26 19:22:42 +00:00
|
|
|
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
|
|
|
|
list(APPEND LLVM_OPTS -DLLVM_TARGETS_TO_BUILD:STRING=AArch64)
|
2023-02-27 23:30:15 +00:00
|
|
|
list(APPEND LLVM_OPTS -DLLVM_ENABLE_ZSTD:BOOL=OFF)
|
2023-02-26 19:22:42 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Target CPU is not supported")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND LLVM_OPTS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ExternalProject_Add(llvm
|
2023-03-24 08:54:05 +00:00
|
|
|
URL https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/llvm-project-16.0.0.src.tar.xz
|
|
|
|
URL_HASH SHA256=9A56D906A2C81F16F06EFC493A646D497C53C2F4F28F0CB1F3C8DA7F74350254
|
2023-02-26 19:22:42 +00:00
|
|
|
DOWNLOAD_NO_PROGRESS true
|
|
|
|
CMAKE_ARGS -Wno-dev
|
|
|
|
CMAKE_CACHE_ARGS ${LLVM_OPTS}
|
|
|
|
SOURCE_SUBDIR llvm
|
2023-02-27 09:28:02 +00:00
|
|
|
BUILD_ALWAYS ON
|
2023-02-26 19:22:42 +00:00
|
|
|
INSTALL_DIR ${CMAKE_SOURCE_DIR}/lib/llvm)
|
|
|
|
|
2022-09-18 02:57:50 +00:00
|
|
|
# Setup Rust target.
|
2022-10-06 14:49:39 +00:00
|
|
|
set(RUST_OUTPUTS $<IF:$<CONFIG:Debug>,${CMAKE_CURRENT_SOURCE_DIR}/target/debug,${CMAKE_CURRENT_SOURCE_DIR}/target/release>)
|
2023-02-03 06:59:24 +00:00
|
|
|
set(KERNEL ${RUST_OUTPUTS}/obkrnl${CMAKE_EXECUTABLE_SUFFIX})
|
2022-10-06 14:49:39 +00:00
|
|
|
|
2022-09-21 13:19:35 +00:00
|
|
|
if(WIN32)
|
2022-10-06 14:49:39 +00:00
|
|
|
set(LIBCORE ${RUST_OUTPUTS}/core.lib)
|
2022-09-21 13:19:35 +00:00
|
|
|
else()
|
2022-10-06 14:49:39 +00:00
|
|
|
set(LIBCORE ${RUST_OUTPUTS}/libcore.a)
|
2022-09-21 13:19:35 +00:00
|
|
|
endif()
|
|
|
|
|
2022-10-06 14:49:39 +00:00
|
|
|
ExternalProject_Add(core
|
2022-09-18 02:57:50 +00:00
|
|
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
CONFIGURE_COMMAND ""
|
2022-12-03 02:56:47 +00:00
|
|
|
BUILD_COMMAND cargo build $<IF:$<CONFIG:Debug>,--profile=dev,--release>
|
2022-09-18 02:57:50 +00:00
|
|
|
BUILD_IN_SOURCE ON
|
|
|
|
BUILD_ALWAYS ON
|
2022-10-06 14:49:39 +00:00
|
|
|
BUILD_BYPRODUCTS ${KERNEL} ${LIBCORE}
|
2022-09-18 02:57:50 +00:00
|
|
|
INSTALL_COMMAND ""
|
|
|
|
TEST_COMMAND cargo test
|
|
|
|
TEST_EXCLUDE_FROM_MAIN ON)
|
|
|
|
|
2023-02-26 19:22:42 +00:00
|
|
|
add_dependencies(core llvm)
|
|
|
|
|
2022-09-15 21:29:53 +00:00
|
|
|
# Setup application target.
|
2022-09-16 04:10:22 +00:00
|
|
|
add_executable(obliteration WIN32
|
2023-02-06 16:36:05 +00:00
|
|
|
ansi_escape.cpp
|
2022-10-16 14:07:56 +00:00
|
|
|
app_data.cpp
|
2022-09-17 08:03:04 +00:00
|
|
|
game_models.cpp
|
2022-09-18 10:07:45 +00:00
|
|
|
game_settings.cpp
|
2022-09-18 09:31:53 +00:00
|
|
|
game_settings_dialog.cpp
|
2023-02-16 18:47:18 +00:00
|
|
|
initialize_wizard.cpp
|
2023-02-06 16:36:05 +00:00
|
|
|
log_formatter.cpp
|
2022-09-16 02:12:25 +00:00
|
|
|
main.cpp
|
|
|
|
main_window.cpp
|
2022-10-23 12:43:35 +00:00
|
|
|
path.cpp
|
2022-10-02 21:26:37 +00:00
|
|
|
progress_dialog.cpp
|
2022-09-19 07:08:26 +00:00
|
|
|
resources.qrc
|
2022-09-20 14:50:30 +00:00
|
|
|
settings.cpp
|
2022-10-23 12:43:35 +00:00
|
|
|
system.cpp
|
2023-02-22 16:27:31 +00:00
|
|
|
system_downloader.cpp
|
|
|
|
update_firmware.cpp
|
2022-09-20 14:50:30 +00:00
|
|
|
util.cpp)
|
2022-09-15 21:29:53 +00:00
|
|
|
|
2022-10-01 18:33:26 +00:00
|
|
|
if(WIN32)
|
|
|
|
target_sources(obliteration PRIVATE resources.rc)
|
|
|
|
endif()
|
|
|
|
|
2022-10-06 14:49:39 +00:00
|
|
|
add_dependencies(obliteration core)
|
2022-09-18 02:57:50 +00:00
|
|
|
|
2022-10-05 17:02:47 +00:00
|
|
|
set_target_properties(obliteration PROPERTIES AUTOMOC ON AUTORCC ON)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set_target_properties(obliteration PROPERTIES OUTPUT_NAME Obliteration)
|
|
|
|
endif()
|
2022-09-15 21:29:53 +00:00
|
|
|
|
|
|
|
target_compile_features(obliteration PRIVATE cxx_std_17)
|
|
|
|
|
2022-09-24 09:01:22 +00:00
|
|
|
target_link_libraries(obliteration PRIVATE Qt6::Widgets)
|
2022-09-18 07:04:02 +00:00
|
|
|
target_link_libraries(obliteration PRIVATE Threads::Threads)
|
2022-09-27 12:48:37 +00:00
|
|
|
target_link_libraries(obliteration PRIVATE ${LIBCORE})
|
2022-09-15 05:31:45 +00:00
|
|
|
|
2022-09-18 07:04:02 +00:00
|
|
|
if(WIN32)
|
2023-06-10 09:24:26 +00:00
|
|
|
target_link_libraries(obliteration PRIVATE bcrypt imm32 ntdll setupapi userenv version winmm ws2_32)
|
2022-09-18 07:30:25 +00:00
|
|
|
else()
|
|
|
|
target_link_libraries(obliteration PRIVATE ${CMAKE_DL_LIBS})
|
2022-09-18 07:04:02 +00:00
|
|
|
endif()
|
2022-09-24 10:20:29 +00:00
|
|
|
|
|
|
|
# Setup installation.
|
|
|
|
if(WIN32)
|
|
|
|
install(TARGETS obliteration DESTINATION .)
|
|
|
|
else()
|
|
|
|
install(TARGETS obliteration DESTINATION bin)
|
|
|
|
endif()
|
|
|
|
|
2022-10-06 14:49:39 +00:00
|
|
|
install(PROGRAMS ${KERNEL} TYPE BIN)
|
2022-09-24 10:20:29 +00:00
|
|
|
install(SCRIPT post-install.cmake)
|