Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 38 additions & 28 deletions .teamcity/MacOS/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ val x64_Internal = CarbonBuildMacOS("Internal MacOS x64", "Internal", "x64-osx-i
val x64_TrinityDev = CarbonBuildMacOS("TrinityDev MacOS x64", "TrinityDev", "x64-osx-trinitydev", "x86_64")
val x64_Release = CarbonBuildMacOS("Release MacOS x64", "Release", "x64-osx-release", "x86_64")

val arm64_NoPch = CarbonBuildMacOS("No PCH MacOS arm64", "Debug", "arm64-osx-debug", "aarch64", enablePch = false)

object Project : Project({
id("MacOS")
name = "macOS"
Expand All @@ -45,13 +47,17 @@ object Project : Project({
buildType(x64_Internal)
buildType(x64_TrinityDev)
buildType(x64_Release)

buildType(arm64_NoPch)
})

class CarbonBuildMacOS(buildName: String, configType: String, preset: String, agentArchitecture: String) : BuildType({
class CarbonBuildMacOS(buildName: String, configType: String, preset: String, agentArchitecture: String, enablePch: Boolean = true) : BuildType({
id(buildName.toId())
name = buildName

artifactRules = "%env.CMAKE_INSTALL_PREFIX%"
if (enablePch) {
artifactRules = "%env.CMAKE_INSTALL_PREFIX%"
}

params {
param("env.SENTRY_CLI_DEBUG_SYMBOL_TYPE", "dsym")
Expand Down Expand Up @@ -104,34 +110,36 @@ class CarbonBuildMacOS(buildName: String, configType: String, preset: String, ag
exec {
name = "Configure"
path = "cmake"
arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees"
arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DCCP_ENABLE_PCH=${if (enablePch) "ON" else "OFF"} -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees"
}
exec {
name = "Build"
path = "cmake"
arguments = "--build %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE% --target %env.CMAKE_BUILD_TARGETS%"
}
exec {
name = "Run Tests"
workingDir = "%env.CMAKE_BUILD_FOLDER%"
path = "ctest"
arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%"
}
exec {
name = "Package artifact"
path = "cmake"
arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%"
}
exec {
name = "Upload symbols to sentry"
path = "sentry-cli"
arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%"
param("script.content", """
#!/usr/bin/env bash -eu
filesWithSymbols = (
# insert your binary files with symbols here!
)
""".trimIndent())
if (enablePch) {
exec {
name = "Run Tests"
workingDir = "%env.CMAKE_BUILD_FOLDER%"
path = "ctest"
arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%"
}
exec {
name = "Package artifact"
path = "cmake"
arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%"
}
exec {
name = "Upload symbols to sentry"
path = "sentry-cli"
arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%"
param("script.content", """
#!/usr/bin/env bash -eu
filesWithSymbols = (
# insert your binary files with symbols here!
)
""".trimIndent())
}
}
}

Expand Down Expand Up @@ -163,10 +171,12 @@ class CarbonBuildMacOS(buildName: String, configType: String, preset: String, ag
}
}
}
xmlReport {
reportType = XmlReport.XmlReportType.JUNIT
rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%"
verbose = true
if (enablePch) {
xmlReport {
reportType = XmlReport.XmlReportType.JUNIT
rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%"
verbose = true
}
}
perfmon {
}
Expand Down
183 changes: 96 additions & 87 deletions .teamcity/Windows/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ val Internal_v145 = CarbonBuildWindows("Internal Windows v145", "Internal", "x64
val TrinityDev_v145 = CarbonBuildWindows("TrinityDev Windows v145", "TrinityDev", "x64-windows-v145-trinitydev", "-arch=x64 -vcvars_ver=14.51")
val Release_v145 = CarbonBuildWindows("Release Windows v145", "Release", "x64-windows-v145-release", "-arch=x64 -vcvars_ver=14.51")

val NoPch = CarbonBuildWindows("No PCH Windows", "Debug", "x64-windows-debug", enablePch = false)

object Project : Project({
id("Windows")
name = "Windows"
Expand All @@ -43,14 +45,17 @@ object Project : Project({
buildType(Internal_v145)
buildType(TrinityDev_v145)
buildType(Release_v145)
})

buildType(NoPch)
})

class CarbonBuildWindows(buildName: String, configType: String, preset: String, vsDevBatSwitches: String = "-arch=x64 -vcvars_ver=14.1") : BuildType({
class CarbonBuildWindows(buildName: String, configType: String, preset: String, vsDevBatSwitches: String = "-arch=x64 -vcvars_ver=14.1", enablePch: Boolean = true) : BuildType({
id(buildName.toId())
this.name = buildName

artifactRules = "%env.CMAKE_INSTALL_PREFIX%"
if (enablePch) {
artifactRules = "%env.CMAKE_INSTALL_PREFIX%"
}

params {
param("env.GIT_TAG_HASH_OVERRIDE", "")
Expand Down Expand Up @@ -108,95 +113,97 @@ class CarbonBuildWindows(buildName: String, configType: String, preset: String,
exec {
name = "Configure"
path = "cmake"
arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees"
arguments = "--preset %env.CMAKE_PRESET% -S %teamcity.build.checkoutDir%/%github_checkout_folder% -B %env.CMAKE_BUILD_FOLDER% -DINSTALL_TO_MONOLITH=ON -DCMAKE_INSTALL_PREFIX=%env.CMAKE_INSTALL_PREFIX% -DCCP_ENABLE_PCH=${if (enablePch) "ON" else "OFF"} -DVCPKG_INSTALL_OPTIONS=--x-buildtrees-root=%teamcity.build.checkoutDir%/%github_checkout_folder%/buildtrees"
}
exec {
name = "Build"
path = "cmake"
arguments = "--build %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE% --target %env.CMAKE_BUILD_TARGETS%"
}
exec {
name = "Run Tests"
workingDir = "%env.CMAKE_BUILD_FOLDER%"
path = "ctest"
arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%"
}
exec {
name = "Package artifact"
path = "cmake"
arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%"
}
exec {
name = "Upload symbols to sentry"
path = "sentry-cli"
arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%"
param("script.content", """
#!/usr/bin/env bash -eu
filesWithSymbols = (
# insert your binary files with symbols here!
)
""".trimIndent())
}
script {
name = "(Windows) CMD Upload debug symbols to internal symbol server"
scriptContent = """
@echo off
(
echo ${'$'}User = "%DOMAIN_USER%"
echo ${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force
echo ${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password
echo New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential
echo Write-Host "##teamcity[progressMessage 'Storing symbols']"
echo ${'$'}symstoreFlags = ^@^("add","/compress","/t", "CCP Games", "/c", "TeamCity %build.number%", "/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", "/o", "/r", "/f", "%env.CMAKE_BUILD_FOLDER%"^)
echo ^& ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags ^| Tee-Object -file symstore.txt
echo ${'$'}stored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}"
echo ${'$'}stored = ${'$'}stored.Matches.Groups[1].Value
echo ${'$'}errors = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of errors = (.*)${'$'}"
echo ${'$'}errors = ${'$'}errors.Matches.Groups[1].Value
echo ${'$'}ignored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}"
echo ${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value
echo Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']"
) > file.ps1
powershell -File file.ps1
""".trimIndent()
}
powerShell {
name = "(Windows) Upload debug symbols to internal symbol server"
enabled = false

conditions {
startsWith("teamcity.agent.jvm.os.name", "Windows")
if (enablePch) {
exec {
name = "Run Tests"
workingDir = "%env.CMAKE_BUILD_FOLDER%"
path = "ctest"
arguments = "-C %env.CMAKE_CONFIG_TYPE% -V --output-on-failure --output-junit %env.CTEST_JUNIT_OUTPUT_FILE%"
}
exec {
name = "Package artifact"
path = "cmake"
arguments = "--install %env.CMAKE_BUILD_FOLDER% --config %env.CMAKE_CONFIG_TYPE%"
}
exec {
name = "Upload symbols to sentry"
path = "sentry-cli"
arguments = "upload-dif --wait %env.CMAKE_BUILD_FOLDER%"
param("script.content", """
#!/usr/bin/env bash -eu
filesWithSymbols = (
# insert your binary files with symbols here!
)
""".trimIndent())
}
scriptMode = script {
content = """
${'$'}User = "%DOMAIN_USER%"
${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force
${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password
New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential

Write-Host "##teamcity[progressMessage 'Storing symbols']"
${'$'}symstoreFlags = @("add",
"/compress",
"/t", "CCP Games", # Product Name
"/c", "TeamCity %build.number%", #Comment
"/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", # Store destination
"/o", # Verbose
"/r", # Recursive
"/f", "%env.CMAKE_BUILD_FOLDER%") # source folder
& ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags | Tee-Object -file symstore.txt

${'$'}stored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}"
${'$'}stored = ${'$'}stored.Matches.Groups[1].Value

${'$'}errors = get-content symstore.txt | Select-String "^SYMSTORE: Number of errors = (.*)${'$'}"
${'$'}errors = ${'$'}errors.Matches.Groups[1].Value

${'$'}ignored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}"
${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value

Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']"
script {
name = "(Windows) CMD Upload debug symbols to internal symbol server"
scriptContent = """
@echo off
(
echo ${'$'}User = "%DOMAIN_USER%"
echo ${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force
echo ${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password
echo New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential
echo Write-Host "##teamcity[progressMessage 'Storing symbols']"
echo ${'$'}symstoreFlags = ^@^("add","/compress","/t", "CCP Games", "/c", "TeamCity %build.number%", "/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", "/o", "/r", "/f", "%env.CMAKE_BUILD_FOLDER%"^)
echo ^& ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags ^| Tee-Object -file symstore.txt
echo ${'$'}stored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}"
echo ${'$'}stored = ${'$'}stored.Matches.Groups[1].Value
echo ${'$'}errors = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of errors = (.*)${'$'}"
echo ${'$'}errors = ${'$'}errors.Matches.Groups[1].Value
echo ${'$'}ignored = get-content symstore.txt ^| Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}"
echo ${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value
echo Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']"
) > file.ps1
powershell -File file.ps1
""".trimIndent()
}
powerShell {
name = "(Windows) Upload debug symbols to internal symbol server"
enabled = false

conditions {
startsWith("teamcity.agent.jvm.os.name", "Windows")
}
scriptMode = script {
content = """
${'$'}User = "%DOMAIN_USER%"
${'$'}Password = ConvertTo-SecureString -String "%DOMAIN_USER_PASSWORD%" -AsPlainText -Force
${'$'}Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ${'$'}User, ${'$'}Password
New-PSDrive -Name "symbols" -PSProvider FileSystem -Root ${'$'}Env:TC_SYMBOL_STORE_PATH -Credential ${'$'}Credential

Write-Host "##teamcity[progressMessage 'Storing symbols']"
${'$'}symstoreFlags = @("add",
"/compress",
"/t", "CCP Games", # Product Name
"/c", "TeamCity %build.number%", #Comment
"/s", "${'$'}Env:TC_SYMBOL_STORE_PATH", # Store destination
"/o", # Verbose
"/r", # Recursive
"/f", "%env.CMAKE_BUILD_FOLDER%") # source folder
& ${'$'}Env:TC_SYMSTORE_PATH ${'$'}symstoreFlags | Tee-Object -file symstore.txt

${'$'}stored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files stored = (.*)${'$'}"
${'$'}stored = ${'$'}stored.Matches.Groups[1].Value

${'$'}errors = get-content symstore.txt | Select-String "^SYMSTORE: Number of errors = (.*)${'$'}"
${'$'}errors = ${'$'}errors.Matches.Groups[1].Value

${'$'}ignored = get-content symstore.txt | Select-String "^SYMSTORE: Number of files ignored = (.*)${'$'}"
${'$'}ignored = ${'$'}ignored.Matches.Groups[1].Value

Write-Host "##teamcity[buildStatus text='Stored: ${'$'}stored, Errors: ${'$'}errors, Ignored: ${'$'}ignored']"
""".trimIndent()
}
}
}
}

Expand Down Expand Up @@ -228,10 +235,12 @@ class CarbonBuildWindows(buildName: String, configType: String, preset: String,
}
}
}
xmlReport {
reportType = XmlReport.XmlReportType.JUNIT
rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%"
verbose = true
if (enablePch) {
xmlReport {
reportType = XmlReport.XmlReportType.JUNIT
rules = "+:%env.CMAKE_BUILD_FOLDER%/%env.CTEST_JUNIT_OUTPUT_FILE%"
verbose = true
}
}
perfmon {
}
Expand Down
41 changes: 40 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,46 @@ set(PUBLIC_HEADER_FILES
)
target_sources(CcpCore PRIVATE ${PUBLIC_HEADER_FILES})

target_precompile_headers(CcpCore PRIVATE StdAfx.h)
# The precompiled header is a build-speed optimisation, not a way to hand
# declarations to every translation unit. Building with -DCCP_ENABLE_PCH=OFF
# proves that each source and header still works without PCH.
option(CCP_ENABLE_PCH "Use a precompiled header to speed up compilation." ON)

if(CCP_ENABLE_PCH)
target_precompile_headers(CcpCore PRIVATE StdAfx.h)
endif()

# Every public header must compile on its own, without the PCH and without any
# other header having been included first. Consumers of the installed package get
# no PCH, so a header that only compiles behind one is already broken for them.
#
# Each header gets a generated translation unit that includes it twice, to also
# ensure "#pragma once" is applied correctly.
option(CCP_BUILD_HEADER_SELFTEST "Verify that every public header is self-contained." ON)

if(CCP_BUILD_HEADER_SELFTEST)
set(HEADER_SELFTEST_SOURCES "")
foreach(_header IN LISTS PUBLIC_HEADER_FILES)
get_filename_component(_header_abs "${_header}" ABSOLUTE)
get_filename_component(_header_name "${_header}" NAME_WE)
set(_selftest_source "${CMAKE_CURRENT_BINARY_DIR}/header_selftest/${_header_name}_selftest.cpp")
file(GENERATE
OUTPUT "${_selftest_source}"
CONTENT "#include \"${_header_abs}\"\n#include \"${_header_abs}\"\n"
)
list(APPEND HEADER_SELFTEST_SOURCES "${_selftest_source}")
endforeach()

add_library(CcpCoreHeaderSelftest OBJECT ${HEADER_SELFTEST_SOURCES})
target_include_directories(CcpCoreHeaderSelftest PRIVATE
$<TARGET_PROPERTY:CcpCore,INTERFACE_INCLUDE_DIRECTORIES>
${CMAKE_CURRENT_BINARY_DIR}
)
target_compile_definitions(CcpCoreHeaderSelftest PRIVATE
$<TARGET_PROPERTY:CcpCore,INTERFACE_COMPILE_DEFINITIONS>
)
set_target_properties(CcpCoreHeaderSelftest PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
endif()

if(APPLE)
set_prefix_and_suffix(CcpCore)
Expand Down
1 change: 1 addition & 0 deletions CcpAssert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "include/CcpSecureCrt.h"

#ifdef _WIN32
#include <windows.h>
#include <winuser.h>
#endif

Expand Down
Loading