From 5bc2662319ef130b3b7a5008b1a34044d3c9263b Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 15 Sep 2024 07:55:40 -0500 Subject: [PATCH 1/3] cmake cleanup: Remove CBSE remnants --- CMakeLists.txt | 1 - cmake/DaemonCBSE.cmake | 81 ------------------------------------------ 2 files changed, 82 deletions(-) delete mode 100644 cmake/DaemonCBSE.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 07a1d5c44f..d33f97b3e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,6 @@ set(DEFAULT_NACL_VM_INHERITED_OPTIONS BUILD_CGAME BUILD_SGAME CMAKE_BUILD_TYPE - DAEMON_CBSE_PYTHON_PATH USE_ARCH_INTRINSICS USE_COMPILER_CUSTOMIZATION USE_COMPILER_INTRINSICS diff --git a/cmake/DaemonCBSE.cmake b/cmake/DaemonCBSE.cmake deleted file mode 100644 index 6cfdbbbc8c..0000000000 --- a/cmake/DaemonCBSE.cmake +++ /dev/null @@ -1,81 +0,0 @@ -# Daemon BSD Source Code -# Copyright (c) 2013-2016, Daemon Developers -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Allow overriding the python path with a cached variable. -set(DAEMON_CBSE_PYTHON_PATH "NOTFOUND" CACHE FILEPATH "Python executable for CBSE code generation") -if (NOT DAEMON_CBSE_PYTHON_PATH OR NOT EXISTS ${DAEMON_CBSE_PYTHON_PATH}) - find_package(Python REQUIRED) - set(DAEMON_CBSE_PYTHON_PATH "${Python_EXECUTABLE}" CACHE FILEPATH "Python executable for CBSE code generation" FORCE) -endif() -message(STATUS "Using CBSE Python executable: ${DAEMON_CBSE_PYTHON_PATH}") - -function(maybe_add_dep target dep) - if (TARGET ${target}) - add_dependencies(${target} ${dep}) - endif() -endfunction() - -function(CBSE target definition output) - # Check if python has all the dependencies - # TODO: Execute pip directly here and install them - execute_process( - COMMAND ${DAEMON_CBSE_PYTHON_PATH} -c "import jinja2, yaml, collections, argparse, sys, os.path, re" - RESULT_VARIABLE RET) - if (NOT RET EQUAL 0) - message(FATAL_ERROR "Missing dependences for CBSE generation. Please ensure you have python ≥ 2, python-yaml, and python-jinja installed. - Use pip install -r src/utils/cbse/requirements.txt to install") - endif() - set(GENERATED_CBSE ${output}/backend/CBSEBackend.cpp - ${output}/backend/CBSEBackend.h - ${output}/backend/CBSEComponents.h - ${output}/backend/CBSEEntities.h) - add_custom_command( - OUTPUT ${GENERATED_CBSE} - COMMENT "Generating CBSE entities for ${definition}" - DEPENDS ${definition} - ${CMAKE_SOURCE_DIR}/src/utils/cbse/CBSE.py - ${CMAKE_SOURCE_DIR}/src/utils/cbse/templates/Backend.cpp - ${CMAKE_SOURCE_DIR}/src/utils/cbse/templates/Backend.h - ${CMAKE_SOURCE_DIR}/src/utils/cbse/templates/Component.cpp - ${CMAKE_SOURCE_DIR}/src/utils/cbse/templates/Component.h - ${CMAKE_SOURCE_DIR}/src/utils/cbse/templates/Components.h - ${CMAKE_SOURCE_DIR}/src/utils/cbse/templates/Entities.h - ${CMAKE_SOURCE_DIR}/src/utils/cbse/templates/Helper.h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/utils/cbse - COMMAND - ${DAEMON_CBSE_PYTHON_PATH} - ${CMAKE_SOURCE_DIR}/src/utils/cbse/CBSE.py - -s -o - "${output}" - "${definition}" - ) - string(REPLACE ${CMAKE_SOURCE_DIR}/ "" rel_path ${definition}) - string(REPLACE "/" "-" new_target ${rel_path}) - add_custom_target(${new_target} ALL - DEPENDS ${GENERATED_CBSE} - ) - set(${target}_GENERATED_CBSE ${GENERATED_CBSE} PARENT_SCOPE) -endfunction() From 4a64c9f7401e4959b34a22c4ceda7a1ff79d40a2 Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 15 Sep 2024 07:57:34 -0500 Subject: [PATCH 2/3] cmake cleanup: force nacl-vms build an easier way There is a BUILD_ALWAYS option now which can be used instead of a custom step that runs before the build to force it. --- cmake/DaemonGame.cmake | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cmake/DaemonGame.cmake b/cmake/DaemonGame.cmake index 9d3c2a6ff3..52bd953150 100644 --- a/cmake/DaemonGame.cmake +++ b/cmake/DaemonGame.cmake @@ -81,6 +81,7 @@ function(GAMEMODULE) ExternalProject_Add(${vm} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${vm} + BUILD_ALWAYS TRUE CMAKE_GENERATOR ${VM_GENERATOR} CMAKE_ARGS -DFORK=2 @@ -97,14 +98,6 @@ function(GAMEMODULE) ${inherited_option_args} INSTALL_COMMAND "" ) - ExternalProject_Add_Step(${vm} forcebuild - COMMAND ${CMAKE_COMMAND} -E remove - ${CMAKE_CURRENT_BINARY_DIR}/${vm}-prefix/src/${vm}-stamp/${vm}-configure - COMMENT "Forcing build step for '${vm}'" - DEPENDEES build - ALWAYS 1 - ) - endif() else() if (FORK EQUAL 2) From e8d64b99490ec5ff0d026ef582b8d445787518db Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 15 Sep 2024 09:24:29 -0500 Subject: [PATCH 3/3] cmake: remove a couple unnecessary flags on NaCl --- cmake/DaemonFlags.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/DaemonFlags.cmake b/cmake/DaemonFlags.cmake index 0ddbd16761..06ddb81f22 100644 --- a/cmake/DaemonFlags.cmake +++ b/cmake/DaemonFlags.cmake @@ -305,7 +305,7 @@ else() # The -pthread flag sets some preprocessor defines, # it is also used to link with libpthread on Linux. - if (NOT APPLE) + if (LINUX OR FREEBSD) try_c_cxx_flag(PTHREAD "-pthread") endif() @@ -315,7 +315,7 @@ else() endif() # Hardening. - if (USE_HARDENING OR NOT MINGW) + if (USE_HARDENING OR (NOT MINGW AND NOT NACL)) # MinGW with _FORTIFY_SOURCE and without -fstack-protector # causes unsatisfied dependency on libssp. # https://github.com/msys2/MINGW-packages/issues/5868