Skip to content

Commit

Permalink
Add CI build mode
Browse files Browse the repository at this point in the history
Some small improvements
  • Loading branch information
Masterkatze committed Jul 12, 2024
1 parent 2681c52 commit 02d49c6
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
cmake
--preset ${{ env.preset_name }}
-DCMAKE_INSTALL_PREFIX=${{ env.install_dir }}
-DNEO_CI_BUILD=ON
-DNEO_USE_CCACHE=OFF
-DNEO_COPY_LIBRARIES=OFF
-DNEO_USE_SEPARATE_BUILD_INFO=ON
Expand Down
26 changes: 14 additions & 12 deletions mp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ set(CMAKE_VERBOSE_MAKEFILE TRUE)
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")

string(TIMESTAMP BUILD_DATETIME UTC)
message(STATUS "${BUILD_DATETIME}")
message(STATUS "TIMESTAMP: ${BUILD_DATETIME}")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

include(cmake/utils.cmake)
include(cmake/build_info.cmake)
include(cmake/packaging.cmake)

if(NOT OS_WINDOWS AND NOT OS_LINUX AND NOT OS_MACOS)
message(FATAL_ERROR "Unknown OS")
endif()

option(NEO_CI_BUILD "CI build mode" OFF)
option(NEO_CHROOT_BUILD "chroot build mode" OFF)
option(NEO_USE_CCACHE "Use ccache" ${OS_LINUX})
option(NEO_USE_VALVE_BINDIR "Use /valve bindir" OFF) # NOTE probably should be used with NEO_DEDICATED
Expand All @@ -30,21 +30,17 @@ option(NEO_RAD_TELEMETRY_DISABLED "Telemetry disabled" ON)
option(NEO_QUICKTIME_VIDEO "Use Quicktime video on Windows" OFF)
option(NEO_BUILD_REPLAY "Build replay system" OFF) # NOTE not implemented for neo
option(NEO_BUILD_WEAPON_PBK56S "Build PBK56S weapon" OFF)
if(OS_WINDOWS)
set(NEO_BUILD_TIER1 ON CACHE BOOL "" FORCE)
set(NEO_BUILD_MATHLIB ON CACHE BOOL "" FORCE)
set(NEO_BUILD_VGUI_CONTROLS ON CACHE BOOL "" FORCE)
else()
option(NEO_BUILD_TIER1 "Build tier1 library" ON)
option(NEO_BUILD_MATHLIB "Build mathlib library" ON)
option(NEO_BUILD_VGUI_CONTROLS "Build vgui_controls library" ON)
endif()
option(NEO_BUILD_TIER1 "Build tier1 library" ${OS_WINDOWS})
option(NEO_BUILD_MATHLIB "Build mathlib library" ${OS_WINDOWS})
option(NEO_BUILD_VGUI_CONTROLS "Build vgui_controls library" ${OS_WINDOWS})
option(NEO_COPY_LIBRARIES "Copy libraries to bin directory by default" ON)
set(NEO_OUTPUT_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/../game/neo/bin" CACHE PATH "Directory for output libraries")
option(NEO_INSTALL_LIBRARIES "Install game libraries" OFF)
option(NEO_INSTALL_RESOURCES "Install game resources" OFF)
option(NEO_USE_SEPARATE_BUILD_INFO "Use separate build info on Linux" OFF)
option(NEO_ENABLE_CPACK "Enable CPack" OFF)

message(STATUS "CI build mode: ${NEO_CI_BUILD}")
message(STATUS "chroot build mode: ${NEO_CHROOT_BUILD}")
message(STATUS "Use ccache: ${NEO_USE_CCACHE}")
message(STATUS "Use /valve bindir: ${NEO_USE_VALVE_BINDIR}")
Expand All @@ -64,11 +60,17 @@ message(STATUS "Directory for output libraries: ${NEO_OUTPUT_LIBRARY_PATH}")
message(STATUS "Install game libraries: ${NEO_INSTALL_LIBRARIES}")
message(STATUS "Install game resources: ${NEO_INSTALL_RESOURCES}")
message(STATUS "Use separate build info on Linux: ${NEO_USE_SEPARATE_BUILD_INFO}")
message(STATUS "Enable CPack: ${NEO_ENABLE_CPACK}")
message("")

if(NEO_COPY_LIBRARIES)
file(MAKE_DIRECTORY "${NEO_OUTPUT_LIBRARY_PATH}")
endif()

if(NEO_ENABLE_CPACK)
include(cmake/packaging.cmake)
endif()

if(CMAKE_VERBOSE_MAKEFILE)
set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT)
endif()
Expand Down Expand Up @@ -410,7 +412,7 @@ add_custom_target(
VERBATIM
)

if("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
if(NEO_CI_BUILD AND "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set(BUILD_TYPE_NAME "Release")
else()
set(BUILD_TYPE_NAME "${CMAKE_BUILD_TYPE}")
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindBitmap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_file(BITMAP_LIBRARY
NAMES ${BITMAP_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindChoreoObjects.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_file(CHOREO_OBJECTS_LIBRARY
NAMES ${CHOREO_OBJECTS_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindDMXLoader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_file(DMX_LOADER_LIBRARY
NAMES ${DMX_LOADER_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindMatSysControls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_file(MATSYS_CONTROLS_LIBRARY
NAMES ${MATSYS_CONTROLS_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindMathlib.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
find_library(MATHLIB_LIBRARY
NAMES mathlib.a
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindParticles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_file(PARTICLES_LIBRARY
NAMES ${PARTICLES_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindSteamAPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ endif()
find_file(STEAM_API_LIBRARY
NAMES ${STEAM_API_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindTier0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ endif()
find_file(TIER0_LIBRARY
NAMES ${TIER0_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindTier1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_library(TIER1_LIBRARY
NAMES ${TIER1_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindTier2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_library(TIER2_LIBRARY
NAMES ${TIER2_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindTier3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_library(TIER3_LIBRARY
NAMES ${TIER3_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindVGUIControls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_file(VGUI_CONTROLS_LIBRARY
NAMES ${VGUI_CONTROLS_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindVSTDLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ endif()
find_library(VSTDLIB_LIBRARY
NAMES ${VSTDLIB_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
1 change: 1 addition & 0 deletions mp/src/cmake/FindVTF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
find_file(VTF_LIBRARY
NAMES ${VTF_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)
Expand Down
7 changes: 4 additions & 3 deletions mp/src/cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ function(split_debug_information)
SPLIT_DEBUG_INFO_FILE ${SPLITDEBUG_TARGET}
)

# Make sure the file is deleted on `make clean`
set_property(DIRECTORY APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${SPLITDEBUG_TARGET}
# Make sure the file is deleted when cleaning
set_target_properties(${PARSED_ARGS_TARGET}
PROPERTIES
ADDITIONAL_CLEAN_FILES ${SPLITDEBUG_TARGET}
)
endfunction()

0 comments on commit 02d49c6

Please sign in to comment.