Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - harry

Pages: [1]
1
General / SFML 2.6.2 - MacOS
« on: Today at 12:43:19 am »
I have been trying to get sfml 2.6.2 working on my mac (m4, sequoia 15.4.1) and it always gives me the same error no matter how i try to compile it. My normal workflow (im coming from windows) is using clion. To eliminate that as the issue i tried following the tutorial on the SFML site which is with xcode, but this gives the same issue.

I always get this error
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk/usr/include/c++/v1/string:821:42 Implicit instantiation of undefined template &#39;std::char_traits<unsigned int>&#39;
 

I have tried many things from reinstalling sfml entirely changing the compilers within cmake reinstalling xcode, reinstalling clion - all to no avail.

This is one of my CMake files which results in the same error:
cmake_minimum_required(VERSION 3.16)
project(SFMLProject)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-std=c++17 -stdlib=libc++")

set(CMAKE_OSX_DEPLOYMENT_TARGET 15.4)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
set(CMAKE_OSX_ARCHITECTURES "arm64")

#---- Fetch SFML (Ensuring dynamic linking for macOS) ----#

include(FetchContent)

FetchContent_Declare(
        SFML
        GIT_REPOSITORY https://github.com/SFML/SFML.git
        GIT_TAG 5383d2b3948f805af55c9f8a4587ac72ec5981d1 # SFML version 2.6.2
        CMAKE_CACHE_ARGS
        -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
)

FetchContent_MakeAvailable(SFML)

#---- Source Files ----#
set(SOURCE_FILES
        src/main.cpp
        src/Game.cpp
        src/Game.h
        src/Sim/FluidSim.h
        src/Sim/FluidSim.cpp
)

if(WIN32)
    list(APPEND SOURCE_FILES src/resources.rc)
endif()

# Create the executable target before manipulating its properties
add_executable(SFMLProject ${SOURCE_FILES})

#---- Link SFML Libraries ----#
target_link_libraries(SFMLProject PRIVATE sfml-graphics sfml-window sfml-system sfml-audio sfml-network)

#---- Platform-Specific Handling ----#

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Data/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Data/)

# macOS-specific frameworks (no need for static linking)
if(APPLE)
    find_library(COCOA_LIBRARY Cocoa REQUIRED)
    find_library(IOKIT_LIBRARY IOKit REQUIRED)
    find_library(COREVIDEO_LIBRARY CoreVideo REQUIRED)
    find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)

    target_link_libraries(SFMLProject PRIVATE
            ${COCOA_LIBRARY}
            ${IOKIT_LIBRARY}
            ${COREVIDEO_LIBRARY}
            ${COREFOUNDATION_LIBRARY}
    )

    # Bundle settings for macOS app bundle
    set(MACOSX_BUNDLE TRUE)
    set_target_properties(SFMLProject PROPERTIES
            MACOSX_BUNDLE TRUE
            MACOSX_BUNDLE_BUNDLE_NAME "SFMLProject"
            MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/Info.plist"
    )
endif()

#---- OpenAL DLL Handling for Windows ----#
if(WIN32)
    add_custom_command(
            TARGET SFMLProject
            COMMENT "Copy OpenAL DLL to build directory"
            PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy
            ${SFML_SOURCE_DIR}/extlibs/bin/$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x64,x86>/openal32.dll
            $<TARGET_FILE_DIR:SFMLProject>
    )

    if(CMAKE_BUILD_TYPE STREQUAL "Release")
        set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
    endif()
endif()
 

I should note this is on a project which works perfectly on windows, but cloning the repo on my mac, and updating a few things within the cmake for mac os doesnt work.

The XCode attempt is just using the default template project.

I hope i have included as much info as is needed to help debug this issue.

Many Thanks

Pages: [1]