obliteration/src/CMakeLists.txt

80 lines
2.0 KiB
CMake
Raw Normal View History

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.
set(RUST_OUTPUTS $<IF:$<CONFIG:Debug>,${CMAKE_CURRENT_SOURCE_DIR}/target/debug,${CMAKE_CURRENT_SOURCE_DIR}/target/release>)
set(KERNEL ${RUST_OUTPUTS}/obkrnl${CMAKE_EXECUTABLE_SUFFIX})
if(WIN32)
set(LIBCORE ${RUST_OUTPUTS}/core.lib)
else()
set(LIBCORE ${RUST_OUTPUTS}/libcore.a)
endif()
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
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.
add_executable(obliteration WIN32
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
initialize_wizard.cpp
log_formatter.cpp
main.cpp
main_window.cpp
path.cpp
progress_dialog.cpp
resources.qrc
2022-09-20 14:50:30 +00:00
settings.cpp
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()
add_dependencies(obliteration core)
2022-09-18 02:57:50 +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()
# Setup installation.
if(WIN32)
install(TARGETS obliteration DESTINATION .)
else()
install(TARGETS obliteration DESTINATION bin)
endif()
install(PROGRAMS ${KERNEL} TYPE BIN)
install(SCRIPT post-install.cmake)