Skip to content

libc++ compatible version for Unreal #71

@narthur157

Description

@narthur157

Is your feature request related to a problem? Please describe.
Linux servers in Unreal require the library to be compiled against libc++ to be statically linked.
I tried compiling dynamic versions of the library, but didn't have any luck with this when it came to actually packaging the project in Unreal

Describe the solution you'd like
library compiled against libc++

Describe alternatives you've considered
I tried for quite some time to compile this through VS, however I kept getting issues with jsoncpp trying to link against libstd.

Additional context
I solved this by using a modified version of the CMakeList from this PR: #70

project(GSDK_CPP_Linux)

set(CMAKE_CXX_COMPILER "clang++")

set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++")

add_library(GSDK_CPP_Linux
    cpp/cppsdk/gsdk.cpp
    cpp/cppsdk/gsdkConfig.cpp
    cpp/cppsdk/gsdkLog.cpp
    cpp/cppsdk/gsdkUtils.cpp
    cpp/cppsdk/jsoncpp.cpp
    cpp/cppsdk/ManualResetEvent.cpp
)

target_compile_options(GSDK_CPP_Linux PRIVATE -DGSDK_LINUX)
set_target_properties(GSDK_CPP_Linux PROPERTIES CXX_STANDARD 14)
target_include_directories(GSDK_CPP_Linux PRIVATE "cpp/cppsdk")

This is the CMakeLists.txt I used, with Ubuntu on WSL 2 in Windows. I was able to take the resulting .a file and link it in Unreal + deploy to PlayFab.

Note that I'm not sure the CMake version needs to be >= 3.2, so you could try setting this lower.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions