Tweaks for building with macOS 26#11605
Conversation
jmarrec
left a comment
There was a problem hiding this comment.
I don't really get why we have XCode specific stuff but maybe it's really needed?
I pushed a branch with only 2 changes that allows me to build on Apple Clang 21 (macOS 26.5 fully up to date)
https://github.com/NatLabRockies/EnergyPlus/compare/build_apple-clang-21?expand=1
| if(CMAKE_GENERATOR STREQUAL "Xcode") | ||
| target_compile_options(project_warnings INTERFACE -Wno-shorten-64-to-32) | ||
| endif() |
There was a problem hiding this comment.
I have tweaks locally to build on apple-clang 21, and I haven't needed to add this?
Also, is this really Xcode generator specific?
(I would have expected CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
||
| add_executable(generate_embeddable_epJSON_schema embedded/generate_embeddable_epJSON_schema.cpp) | ||
| target_link_libraries(generate_embeddable_epJSON_schema PRIVATE project_options project_fp_options project_warnings fmt::fmt) | ||
| target_link_libraries(generate_embeddable_epJSON_schema PRIVATE project_options project_fp_options project_warnings fmt::fmt nlohmann_json) |
There was a problem hiding this comment.
Haven't needed that either
| #ifndef CLI11_HAS_CODECVT | ||
| #if defined(__APPLE__) && defined(__clang__) | ||
| #define CLI11_HAS_CODECVT 0 | ||
| #elif defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && __GNUC__ < 5 |
There was a problem hiding this comment.
I see what you're doing. This is better than my own
target_compile_options(project_warnings INTERFACE -Wno-deprecated-declarations) # wstring_convert deprecated in newer libc++
I wonder if it's better to have it inline in CLI11.hpp or if it should be in CMake via target_compile_definitions(xxx PRIVATE CLI11_HAS_CODECVT=0) (for targets energyplus and convertInputFormat). I guess inline is fine.
|
@RKStrand can you give @jmarrec's branch a try? https://github.com/NatLabRockies/EnergyPlus/tree/build_apple-clang-21 |
|
OK. I also see this with Xcode and Apple Clang 17. Can you try a Unix makefile build with CLion? |
|
I was just able to successfully build using CLion--both energyplus and energyplus_tests. Was able to successfully run 1ZoneUncontrolled.idf using this energyplus build and the test suite completed 1260 test successfully. Not sure why it didn't do every unit test but at least it successfully completed what it did. I'd love to get Xcode running again, but at least having CLion up and running is super helpful. |
|
For the record, in case it helps, I'm running a Nov 2023 MacBook Pro 16-inch, with the Apple M3 Max chip, 128 GB of memory, macOS Tahoe26.5, and Xcode Version 26.5 (17F42). |
@RKStrand can you post anything regarding what caused the failure in completing all the tests? |
|
Thanks @RKStrand. I saw that as well. |
|
@RKStrand can you try this branch for both? https://github.com/NatLabRockies/EnergyPlus/tree/build_apple-clang-21_msm |
|
@mitchute Ok, here is what I got on my machine: Big Picture for "msm" branch: Xcode builds and runs successfully, CLion encounters an error building energyplus_tests (details below) Xcode: CLion: .../third_party/gtest/googletest/include/gtest/gtest-printers.h:478:35: error: implicit conversion from 'char8_t' to 'char32_t' may change the meaning of the represented code unit [-Werror,-Wcharacter-conversion] It points to the (c) in that line as the issue. |
|
Right... I missed that change here. I'll push a patch soon. |
|
@RKStrand give it another shot now. |
|
@mitchute Ok, after that, now I can say: Xcode--same as before (everything good). CLion--energyplus still builds and runs. energyplus_tests builds now. What is a bit weird is that when I run it, it only does 1260 tests and then at some point, I get the following pop-up window (see left of image below).
If I click on ignore, it just stops right there. If I click on "Reopen", it launches a terminal window and tries to run energyplus_tests from the terminal. But that doesn't finish either because as you can see from the right side of the image, it seems to crash in a Solar Shading test. |
|
Penumbra tests on arm64 debug have always been problematic for what it's worth. |
| if(APPLE AND CMAKE_GENERATOR STREQUAL "Xcode") | ||
| set(_gtest_discovery_mode PRE_TEST) | ||
| else() | ||
| set(_gtest_discovery_mode POST_BUILD) | ||
| endif() |
There was a problem hiding this comment.
IIRC, this was due to something related to Xcode and code signing, which we are not doing during development builds.
|
|
||
| add_executable(generate_embeddable_epJSON_schema embedded/generate_embeddable_epJSON_schema.cpp) | ||
| target_link_libraries(generate_embeddable_epJSON_schema PRIVATE project_options project_fp_options project_warnings fmt::fmt) | ||
| target_compile_options(generate_embeddable_epJSON_schema PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wno-shorten-64-to-32>) |
There was a problem hiding this comment.
Turns this into a warning. I think this should just apply to AppleClang and I thought I changed it to that everywhere else, but now I see that I missed this one. I'll probably just leave it.
|
|
||
| target_include_directories(airflownetworklib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
| target_link_libraries(airflownetworklib PUBLIC btwxt fmt::fmt) | ||
| target_link_libraries(airflownetworklib PUBLIC btwxt fmt::fmt PRIVATE nlohmann_json) |
There was a problem hiding this comment.
My machine was complaining about the nlohman json.hpp #include <doj/alphanum.hpp>. This fixed it.
| } | ||
| # else | ||
| constexpr auto operator"" _a(const char* s, size_t) -> detail::udl_arg<char> { | ||
| constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg<char> { |
There was a problem hiding this comment.
There were a couple random things like this that it didn't like.
| $<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wno-character-conversion> | ||
| $<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wno-deprecated-declarations> |
There was a problem hiding this comment.
Applies these based on what's available in each compiler.
| if(APPLE AND CMAKE_GENERATOR STREQUAL "Xcode" AND OPENGL_FOUND) | ||
| set(OPENGL_FOUND FALSE) | ||
| message(STATUS "Disabling OpenGL for Xcode-generated builds to avoid Cocoa window creation during build/test execution") | ||
| endif() |
There was a problem hiding this comment.
Penumbra want to create some windows behind the scenes when OpenGL is enabled, which it is by default. We could probably have worked through that, but since this isn't likely to be used by many of our developers, I figured we'd just turn it off when running from an Xcode generated build.



Pull request overview
Description of the purpose of this PR
Pull Request Author
Reviewer