From f40d09cb8f712e87691af4912f3630d92d692779 Mon Sep 17 00:00:00 2001 From: untodesu Date: Thu, 11 Dec 2025 15:14:26 +0500 Subject: Shuffle stuff around - Use the new and improved hierarchy I figured out when making Prospero chat - Re-add NSIS scripts, again from Prospero - Update most build and utility scripts with their most recent versions --- CMakeLists.txt | 64 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ba2db83..81d15f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,51 +1,53 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) project(Voxelius LANGUAGES C CXX VERSION 16.0.1) -## Declare build options option(BUILD_VCLIENT "Build Voxelius client" ON) option(BUILD_VSERVER "Build Voxelius server" ON) -## If possible, enable solution directories; this allows -## built-in pseudotargets like ALL_BUILD and ZERO_CHECK to -## be moved out of sight into a separate directory -set_property(GLOBAL PROPERTY USE_FOLDERS ON) +if(NOT BUILD_VCLIENT AND NOT BUILD_VSERVER) + message(FATAL_ERROR "Neither client or server is enabled; nothing to build") +endif() -## Ensure we are never building dependencies as dynamic -## libraries; we only use dynamic libraries for non-compiled -## third-party dependencies (such as SDL3 and maybe Discord-RPC); -set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -## Microsoft-vendored STL has been permissively licensed for quite -## a while, so it makes all the sense to statically link with it to -## avoid pulling redistributable installers alongside the game package +set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - -## Output binaries into build root set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") -## Set C++ standard to C++20 -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +if(MSVC) + add_compile_options(/MP) + add_compile_options(/W3) +endif() + +execute_process(COMMAND git rev-parse --short=8 HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) +execute_process(COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) -add_subdirectory(core) -add_subdirectory(deps) -add_subdirectory(game) +add_subdirectory(assets) +add_subdirectory(external) +add_subdirectory(src) -install(FILES "${CMAKE_CURRENT_LIST_DIR}/LICENSE" DESTINATION ".") -install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/data" DESTINATION ".") +install(FILES "${PROJECT_SOURCE_DIR}/LICENSE.txt" DESTINATION "doc/voxelius") set(CPACK_PACKAGE_NAME "Voxelius") set(CPACK_PACKAGE_VENDOR "untodesu") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Block game on steroids") -set(CPACK_PACKAGE_CONTACT "https://github.com/untodesu/voxelius/issues") +set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt") +set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}-${GIT_BRANCH}-${GIT_COMMIT}") +set(CPACK_PACKAGE_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/packages") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") -set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) -set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) -set(CPACK_PACKAGE_VERSION_TWEAK ${PROJECT_VERSION_TWEAK}) +set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}\\\\media\\\\nsis-installer.ico") +set(CPACK_NSIS_MUI_HEADERIMAGE "${PROJECT_SOURCE_DIR}\\\\media\\\\nsis-header.bmp") +set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${PROJECT_SOURCE_DIR}\\\\media\\\\nsis-splash.bmp") +unset(CPACK_NSIS_MENU_LINKS) -set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") +if(BUILD_CLIENT) + list(APPEND CPACK_NSIS_MENU_LINKS "bin/vclient.exe" "Voxelius Client") +endif() + +if(BUILD_SERVER) + list(APPEND CPACK_NSIS_MENU_LINKS "bin/vserver.exe" "Voxelius Server") +endif() include(CPack) -- cgit