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
|
|
|
|
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)
|
|
|
|
|
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
|
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)
|
2022-09-18 11:20:33 +00:00
|
|
|
target_link_libraries(obliteration PRIVATE bcrypt imm32 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)
|