Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
aef9a1b5
Commit
aef9a1b5
authored
4 years ago
by
Marco Z
Browse files
Options
Downloads
Patches
Plain Diff
CMAKE: Add CCACHE support
parent
c63ead5a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!992
CMAKE additions: SDL Mixer X, *.debug adjustments, CPACK adjustments, CCACHE
,
!991
CMAKE additions: SDL Mixer X, *.debug adjustments, CPACK adjustments, CCACHE
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+17
-0
17 additions, 0 deletions
CMakeLists.txt
launch-c.in
+3
-0
3 additions, 0 deletions
launch-c.in
launch-cxx.in
+3
-0
3 additions, 0 deletions
launch-cxx.in
src/CMakeLists.txt
+21
-0
21 additions, 0 deletions
src/CMakeLists.txt
with
44 additions
and
0 deletions
CMakeLists.txt
+
17
−
0
View file @
aef9a1b5
cmake_minimum_required
(
VERSION 3.0
)
# Enable CCache early
set
(
SRB2_USE_CCACHE OFF CACHE BOOL
"Use CCache"
)
if
(
${
SRB2_USE_CCACHE
}
)
find_program
(
CCACHE_PROGRAM ccache
)
if
(
CCACHE_PROGRAM
)
message
(
STATUS
"Found CCache:
${
CCACHE_PROGRAM
}
"
)
set_property
(
GLOBAL PROPERTY RULE_LAUNCH_COMPILE
"
${
CCACHE_PROGRAM
}
"
)
else
()
message
(
WARNING
"You have specified to use CCACHE but it was not found. Object files will not be cached."
)
endif
()
endif
()
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
# Version change is fine.
project
(
SRB2
...
...
@@ -9,6 +22,10 @@ if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
message
(
FATAL_ERROR
"In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from."
)
endif
()
if
((
${
SRB2_USE_CCACHE
}
)
AND
(
${
CMAKE_C_COMPILER
}
MATCHES
"clang"
))
message
(
WARNING
"Using clang and CCache: You may want to set environment variable CCACHE_CPP2=yes to prevent include errors during compile."
)
endif
()
# Set up CMAKE path
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/Modules/"
)
...
...
This diff is collapsed.
Click to expand it.
launch-c.in
0 → 100644
+
3
−
0
View file @
aef9a1b5
#!/bin/sh
export
CCACHE_CPP2
=
true
exec
"
${
RULE_LAUNCH_COMPILE
}
"
"
${
CMAKE_C_COMPILER
}
"
"
$@
"
This diff is collapsed.
Click to expand it.
launch-cxx.in
0 → 100644
+
3
−
0
View file @
aef9a1b5
#!/bin/sh
export
CCACHE_CPP2
=
true
exec
"
${
RULE_LAUNCH_COMPILE
}
"
"
${
CMAKE_C_COMPILER
}
"
"
$@
"
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
21
−
0
View file @
aef9a1b5
...
...
@@ -523,6 +523,27 @@ endif()
# Targets
# If using CCACHE, then force it.
# https://github.com/Cockatrice/Cockatrice/pull/3052/files
if
(
${
CMAKE_SYSTEM
}
MATCHES
"Darwin"
)
get_property
(
RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE
)
if
(
RULE_LAUNCH_COMPILE
)
MESSAGE
(
STATUS
"Force enabling CCache usage under macOS"
)
# Set up wrapper scripts
configure_file
(
${
CMAKE_MODULE_PATH
}
/launch-c.in launch-c
)
configure_file
(
${
CMAKE_MODULE_PATH
}
/launch-cxx.in launch-cxx
)
execute_process
(
COMMAND chmod a+rx
"
${
CMAKE_BINARY_DIR
}
/launch-c"
"
${
CMAKE_BINARY_DIR
}
/launch-cxx"
)
# Set Xcode project attributes to route compilation through our scripts
set
(
CMAKE_XCODE_ATTRIBUTE_CC
"
${
CMAKE_BINARY_DIR
}
/launch-c"
)
set
(
CMAKE_XCODE_ATTRIBUTE_CXX
"
${
CMAKE_BINARY_DIR
}
/launch-cxx"
)
set
(
CMAKE_XCODE_ATTRIBUTE_LD
"
${
CMAKE_BINARY_DIR
}
/launch-c"
)
set
(
CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS
"
${
CMAKE_BINARY_DIR
}
/launch-cxx"
)
endif
()
endif
()
# Compatibility flag with later versions of GCC
# We should really fix our code to not need this
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment