Skip to content

Commit 14f1503

Browse files
jeongseok-metafacebook-github-bot
authored andcommitted
Fix build with fmt 11 (#95)
Summary: - fmt 11 requires building with /utf-8 for MSVC, otherwise it will result in a build error: ``` D:\a\momentum\momentum\.pixi\envs\default\Library\include\fmt\base.h(458,28): error C2338: static_assert failed: 'Unicode support requires compiling with /utf-8' [D:\a\momentum\momentum\build\simd_test.vcxproj] ``` - Remove unnecessary version constraints of dependencies in pixi.toml, as the build error was not caught due to fmt being constrained to version 10. - Update the pixi lock file - Print more info in CMake log ``` 1>-- [ Build Tools ] 1>-- - CMake : 3.30.4 1>-- - CMake Generator : Visual Studio 17 2022 1>-- - C Compiler : MSVC 19.41.34120.0 1>-- - C++ Compiler : MSVC 19.41.34120.0 1>-- - CMake Toolchain File: 1>-- 1>-- [ CMake Variables ] 1>-- CMAKE_C_FLAGS: 1>-- - /DWIN32 1>-- - /D_WINDOWS 1>-- CMAKE_CXX_FLAGS: 1>-- - /DWIN32 1>-- - /D_WINDOWS 1>-- - /GR 1>-- - /EHsc 1>-- CMAKE_CUDA_FLAGS: (not set) ``` ## Checklist: - [x] Adheres to the [style guidelines](https://facebookincubator.github.io/momentum/docs/developer_guide/style_guide) - [x] Codebase formatted by running `pixi run lint` Pull Request resolved: #95 Test Plan: ``` pixi run test ``` Reviewed By: yutingye Differential Revision: D63944026 Pulled By: jeongseok-meta fbshipit-source-id: d0378da180222d912001ddb7bf01d3c6c5b7659b
1 parent e5b16f2 commit 14f1503

File tree

5 files changed

+6080
-5234
lines changed

5 files changed

+6080
-5234
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
# python
66
*.egg-info/
77
*.cpython-*.so
8+
9+
# build artifacts
10+
build/

CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ project(momentum)
1313

1414
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
1515

16+
# Needed by mt_defs.cmake
17+
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
18+
include(cmake/mt_defs.cmake)
19+
1620
# Print intro
1721
message(STATUS "")
1822
message(STATUS "============================================")
@@ -29,22 +33,26 @@ message(STATUS "")
2933
# Print build tool information
3034
message(STATUS "[ Build Tools ]")
3135
message(STATUS "- CMake : ${CMAKE_VERSION}")
36+
message(STATUS "- CMake Generator : ${CMAKE_GENERATOR}")
3237
message(STATUS "- C Compiler : ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
3338
message(STATUS "- C++ Compiler : ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
3439
if(MSVC)
3540
message(STATUS "- CMake Toolchain File: ${CMAKE_TOOLCHAIN_FILE}")
3641
endif()
3742
message(STATUS "")
3843

44+
# Print CMake variables
45+
message(STATUS "[ CMake Variables ]")
46+
mt_print_flags(CMAKE_C_FLAGS)
47+
mt_print_flags(CMAKE_CXX_FLAGS)
48+
mt_print_flags(CMAKE_CUDA_FLAGS)
49+
message(STATUS "")
50+
3951
#===============================================================================
4052
# Build dependencies
4153
#===============================================================================
4254

43-
# Needed by mt_defs.cmake
44-
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
45-
4655
include(GNUInstallDirs)
47-
include(cmake/mt_defs.cmake)
4856

4957
#===============================================================================
5058
# Build Options
@@ -104,6 +112,7 @@ endif()
104112

105113
if(MSVC)
106114
add_compile_options(/bigobj)
115+
add_compile_options(/utf-8)
107116
endif()
108117

109118
#===============================================================================

cmake/mt_defs.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ function(mt_get_max_string_length var)
7575
set(${var} ${choice} PARENT_SCOPE)
7676
endfunction()
7777

78+
# Function to print each flag on a new line with indentation
79+
# mt_print_flags(<variable>)
80+
function(mt_print_flags var_name)
81+
if(NOT "${${var_name}}" STREQUAL "")
82+
string(REPLACE " " ";" FLAGS_LIST "${${var_name}}")
83+
message(STATUS "${var_name}:")
84+
foreach(flag IN LISTS FLAGS_LIST)
85+
message(STATUS " - ${flag}")
86+
endforeach()
87+
else()
88+
message(STATUS "${var_name}: (not set)")
89+
endif()
90+
endfunction()
91+
7892
# mt_option(<variable> "<help_text>" <value>)
7993
function(mt_option variable help_text default_value)
8094
set_property(

0 commit comments

Comments
 (0)