Fix the lto setup for the serene build script
This commit is contained in:
parent
639d340f46
commit
036c767cbd
|
@ -89,13 +89,6 @@ target_compile_options(serene
|
|||
# LLVM has it's own RTTI
|
||||
-fno-rtti
|
||||
-fno-builtin-strlen
|
||||
# Don't link against system's default libc++ or libstdc++
|
||||
# -nostdinc++
|
||||
# -nostdlib++
|
||||
|
||||
# Do not link any default library, We want to be explicit
|
||||
# -nodefaultlibs
|
||||
# -nostdinc
|
||||
|
||||
# Dedicate a section to each function, so the linker
|
||||
# can do a better job on dead code elimination
|
||||
|
@ -127,6 +120,7 @@ target_link_options(serene
|
|||
PRIVATE
|
||||
-stdlib=libc++
|
||||
-lc++abi
|
||||
#--rtlib=compiler-rt
|
||||
-Wl,--gc-sections
|
||||
$<$<CONFIG:RELEASE>:-s>
|
||||
|
||||
|
@ -149,6 +143,7 @@ if(SERENE_ENABLE_THINLTO)
|
|||
# Optional IPO. Do not use IPO if it's not supported by compiler.
|
||||
check_ipo_supported(RESULT result OUTPUT output)
|
||||
if(result)
|
||||
message(STATUS "IPO is supported and is turned on")
|
||||
set_property(TARGET serene PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(WARNING "IPO is not supported: ${output}")
|
||||
|
|
|
@ -16,36 +16,32 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <iomanip>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
struct Vec3
|
||||
{
|
||||
int x, y, z;
|
||||
struct Vec3 {
|
||||
int x, y, z;
|
||||
|
||||
// following constructor is no longer needed since C++20
|
||||
Vec3(int x = 0, int y = 0, int z = 0) noexcept : x(x), y(y), z(z) { }
|
||||
// following constructor is no longer needed since C++20
|
||||
Vec3(int x = 0, int y = 0, int z = 0) noexcept : x(x), y(y), z(z) {}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const Vec3& v)
|
||||
{
|
||||
return os << "{ x=" << v.x << ", y=" << v.y << ", z=" << v.z << " }";
|
||||
}
|
||||
friend std::ostream &operator<<(std::ostream &os, const Vec3 &v) {
|
||||
return os << "{ x=" << v.x << ", y=" << v.y << ", z=" << v.z << " }";
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// Use the default constructor.
|
||||
std::unique_ptr<Vec3> v1 = std::make_unique<Vec3>();
|
||||
// Use the constructor that matches these arguments
|
||||
std::unique_ptr<Vec3> v2 = std::make_unique<Vec3>(0,1,2);
|
||||
// Create a unique_ptr to an array of 5 elements
|
||||
std::unique_ptr<Vec3[]> v3 = std::make_unique<Vec3[]>(5);
|
||||
int main() {
|
||||
// Use the default constructor.
|
||||
std::unique_ptr<Vec3> v1 = std::make_unique<Vec3>();
|
||||
// Use the constructor that matches these arguments
|
||||
std::unique_ptr<Vec3> v2 = std::make_unique<Vec3>(0, 1, 2);
|
||||
// Create a unique_ptr to an array of 5 elements
|
||||
std::unique_ptr<Vec3[]> v3 = std::make_unique<Vec3[]>(5);
|
||||
|
||||
std::cout << "make_unique<Vec3>(): " << *v1 << '\n'
|
||||
<< "make_unique<Vec3>(0,1,2): " << *v2 << '\n'
|
||||
<< "make_unique<Vec3[]>(5): ";
|
||||
for (int i = 0; i < 5; i++)
|
||||
std::cout << std::setw(i ? 30 : 0) << v3[static_cast<size_t>(i)] << '\n';
|
||||
std::cout << "make_unique<Vec3>(): " << *v1 << '\n'
|
||||
<< "make_unique<Vec3>(0,1,2): " << *v2 << '\n'
|
||||
<< "make_unique<Vec3[]>(5): ";
|
||||
for (int i = 0; i < 5; i++)
|
||||
std::cout << std::setw(i ? 30 : 0) << v3[static_cast<size_t>(i)] << '\n';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue