From 019b6fef94c8c8893ab8c4d6a87655b2e8999259 Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 12 Apr 2024 21:04:21 +0200 Subject: Build with Nix flakes (x86_64-darwin only, for now) --- CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 649bd6f..663889f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,17 @@ project(meowcraft) set(CMAKE_CXX_STANDARD 17) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +include(GNUInstallDirs) + # Enable assertions for RelWithDebInfo builds. string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +# FIXME: Nixpkgs LLVM currently has problems with LTO on Darwin. +# See related PR: https://github.com/NixOS/nixpkgs/pull/302481 +# Enable LTO for release builds +# set_property(TARGET meowcraft PROPERTY +# INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) + if (NOT UNIX) set(GLEW_USE_STATIC_LIBS ON) endif (NOT UNIX) @@ -92,10 +100,6 @@ add_executable(meowcraft src/Input.cpp src/Input.hpp ) -# Enable LTO for release builds -set_property(TARGET meowcraft PROPERTY - INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) - if (WIN32) set(LINK_FLAGS "-static-libgcc -static-libstdc++ -static -mwindows") endif (WIN32) @@ -120,4 +124,8 @@ make_assets(images/atlas.ppm shaders/clouds.frag.glsl shaders/clouds.vert.glsl shaders/image_viewer.frag.glsl shaders/image_viewer.vert.glsl shaders/block_outline.frag.glsl shaders/block_outline.vert.glsl +) + +install(TARGETS meowcraft + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) \ No newline at end of file -- cgit 1.4.1