Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
abbc28fc
Commit
abbc28fc
authored
1 year ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Use native cmake LTO support
parent
aff44f56
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/cmake/00-Common.cmake
+8
-37
8 additions, 37 deletions
indra/cmake/00-Common.cmake
indra/cmake/Variables.cmake
+0
-3
0 additions, 3 deletions
indra/cmake/Variables.cmake
indra/deps/CMakeLists.txt
+4
-14
4 additions, 14 deletions
indra/deps/CMakeLists.txt
with
12 additions
and
54 deletions
indra/cmake/00-Common.cmake
+
8
−
37
View file @
abbc28fc
...
@@ -55,6 +55,10 @@ endif()
...
@@ -55,6 +55,10 @@ endif()
# Warnings
# Warnings
option
(
DISABLE_FATAL_WARNINGS
"Disable warnings as errors"
ON
)
option
(
DISABLE_FATAL_WARNINGS
"Disable warnings as errors"
ON
)
if
(
USE_LTO
)
set
(
CMAKE_INTERPROCEDURAL_OPTIMIZATION
${
USE_LTO
}
)
endif
()
# Platform-specific compilation flags.
# Platform-specific compilation flags.
if
(
WINDOWS
)
if
(
WINDOWS
)
# Don't build DLLs.
# Don't build DLLs.
...
@@ -139,31 +143,10 @@ if (WINDOWS)
...
@@ -139,31 +143,10 @@ if (WINDOWS)
endif
()
endif
()
if
(
USE_LTO
)
if
(
USE_LTO
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"MSVC"
)
add_link_options
(
if
(
INCREMENTAL_LINK
)
$<$<CONFIG:Release>:/OPT:REF>
add_link_options
(
/LTCG:incremental
)
$<$<CONFIG:Release>:/OPT:ICF>
set
(
CMAKE_STATIC_LINKER_FLAGS
"
${
CMAKE_STATIC_LINKER_FLAGS
}
/LTCG"
)
)
else
()
add_link_options
(
/LTCG
)
set
(
CMAKE_STATIC_LINKER_FLAGS
"
${
CMAKE_STATIC_LINKER_FLAGS
}
/LTCG"
)
endif
()
add_link_options
(
$<$<CONFIG:Release>:/OPT:REF>
$<$<CONFIG:Release>:/OPT:ICF>
$<$<CONFIG:Release>:/INCREMENTAL:NO>
)
add_compile_options
(
/GL /Gy /Gw
)
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"Clang"
)
if
(
INCREMENTAL_LINK
)
add_compile_options
(
-flto=thin -fwhole-program-vtables /clang:-fforce-emit-vtables
)
else
()
add_compile_options
(
-flto=full -fwhole-program-vtables /clang:-fforce-emit-vtables
)
endif
()
add_link_options
(
$<$<CONFIG:Release>:/OPT:REF>
$<$<CONFIG:Release>:/OPT:ICF>
)
endif
()
elseif
(
INCREMENTAL_LINK
)
elseif
(
INCREMENTAL_LINK
)
add_link_options
(
$<$<CONFIG:Release>:/INCREMENTAL>
)
add_link_options
(
$<$<CONFIG:Release>:/INCREMENTAL>
)
else
()
else
()
...
@@ -233,14 +216,6 @@ if (LINUX)
...
@@ -233,14 +216,6 @@ if (LINUX)
add_compile_options
(
-mfpmath=sse -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1
)
add_compile_options
(
-mfpmath=sse -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1
)
endif
()
endif
()
if
(
USE_LTO
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
)
add_compile_options
(
-flto=thin -fwhole-program-vtables -fforce-emit-vtables
)
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
add_compile_options
(
-flto=auto -fno-fat-lto-objects
)
endif
()
endif
()
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
)
if
(
USE_ASAN
)
if
(
USE_ASAN
)
add_compile_options
(
-fsanitize=address -fsanitize-recover=address
)
add_compile_options
(
-fsanitize=address -fsanitize-recover=address
)
...
@@ -262,10 +237,6 @@ if (LINUX)
...
@@ -262,10 +237,6 @@ if (LINUX)
add_compile_options
(
-O3 -ffast-math
)
add_compile_options
(
-O3 -ffast-math
)
endif
()
endif
()
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
AND USE_LTO
)
add_link_options
(
-fuse-ld=lld
)
endif
()
# Enable these flags so we have a read only GOT and some linking opts
# Enable these flags so we have a read only GOT and some linking opts
add_link_options
(
"LINKER:-z,relro"
"LINKER:-z,now"
"LINKER:--as-needed"
)
add_link_options
(
"LINKER:-z,relro"
"LINKER:-z,now"
"LINKER:--as-needed"
)
endif
()
endif
()
...
...
This diff is collapsed.
Click to expand it.
indra/cmake/Variables.cmake
+
0
−
3
View file @
abbc28fc
...
@@ -172,9 +172,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
...
@@ -172,9 +172,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH NO
)
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH NO
)
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_STRICT_ALIASING NO
)
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_STRICT_ALIASING NO
)
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES
)
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES
)
if
(
USE_LTO
)
set
(
CMAKE_XCODE_ATTRIBUTE_LLVM_LTO YES_THIN
)
endif
()
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS YES
)
set
(
CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS YES
)
if
(
FULL_DEBUG_SYMS OR USE_SENTRY
)
if
(
FULL_DEBUG_SYMS OR USE_SENTRY
)
...
...
This diff is collapsed.
Click to expand it.
indra/deps/CMakeLists.txt
+
4
−
14
View file @
abbc28fc
project
(
deps
)
project
(
deps
)
include
(
00-Common
)
include
(
00-Common
)
include
(
FetchContent
)
include
(
FetchContent
)
set
(
CMAKE_FOLDER
"Third Party"
)
set
(
CMAKE_FOLDER
"Third Party"
)
set
(
CMAKE_POSITION_INDEPENDENT_CODE ON
)
set
(
CMAKE_POLICY_DEFAULT_CMP0069 NEW
)
set
(
CMAKE_POLICY_DEFAULT_CMP0077 NEW
)
set
(
deps_SOURCE_FILES
set
(
deps_SOURCE_FILES
CMakeLists.txt
CMakeLists.txt
...
@@ -18,17 +20,6 @@ add_library(deps
...
@@ -18,17 +20,6 @@ add_library(deps
${
deps_SOURCE_FILES
}
${
deps_SOURCE_FILES
}
)
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.14
)
macro
(
FetchContent_MakeAvailable NAME
)
FetchContent_GetProperties
(
${
NAME
}
)
if
(
NOT
${
NAME
}
_POPULATED
)
FetchContent_Populate
(
${
NAME
}
)
add_subdirectory
(
${${
NAME
}
_SOURCE_DIR
}
${${
NAME
}
_BINARY_DIR
}
)
endif
()
endmacro
()
endif
()
FetchContent_Declare
(
FetchContent_Declare
(
meshoptimizer
meshoptimizer
GIT_REPOSITORY https://git.alchemyviewer.org/alchemy/mirrors/meshoptimizer.git
GIT_REPOSITORY https://git.alchemyviewer.org/alchemy/mirrors/meshoptimizer.git
...
@@ -79,8 +70,7 @@ if(USE_TRACY)
...
@@ -79,8 +70,7 @@ if(USE_TRACY)
set
(
TRACY_ON_DEMAND ON
)
set
(
TRACY_ON_DEMAND ON
)
set
(
TRACY_ONLY_LOCALHOST ON
)
set
(
TRACY_ONLY_LOCALHOST ON
)
set
(
TRACY_FIBERS ON
)
set
(
TRACY_FIBERS ON
)
FetchContent_MakeAvailable
(
tracy
)
FetchContent_MakeAvailable
(
tracy
)
endif
()
endif
()
unset
(
CMAKE_FOLDER
)
unset
(
CMAKE_FOLDER
)
unset
(
CMAKE_POSITION_INDEPENDENT_CODE
)
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