Fix building with Clang
This commit is contained in:
parent
bc9c989f61
commit
675b3f882f
|
@ -23,7 +23,18 @@ endif()
|
||||||
if(ENABLE_LTO)
|
if(ENABLE_LTO)
|
||||||
add_compile_options(-O3 -flto)
|
add_compile_options(-O3 -flto)
|
||||||
add_link_options(-flto)
|
add_link_options(-flto)
|
||||||
set(CMAKE_AR "gcc-ar")
|
|
||||||
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
||||||
|
find_program(LLD ld.lld)
|
||||||
|
if (LLD)
|
||||||
|
add_link_options(-fuse-ld=lld)
|
||||||
|
else()
|
||||||
|
add_link_options(-fuse-linker-plugin)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_AR "llvm-ar")
|
||||||
|
else()
|
||||||
|
set(CMAKE_AR "gcc-ar")
|
||||||
|
endif()
|
||||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||||
set(CMAKE_C_ARCHIVE_FINISH true)
|
set(CMAKE_C_ARCHIVE_FINISH true)
|
||||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||||
|
|
|
@ -419,8 +419,8 @@ void Update(bool opengl, uiAreaDrawParams* params)
|
||||||
item.DrawBitmapLoaded = true;
|
item.DrawBitmapLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiRect rc_src = {0, 0, item.Width, item.Height};
|
uiRect rc_src = {0, 0, (int) item.Width, (int) item.Height};
|
||||||
uiRect rc_dst = {kOSDMargin, y, item.Width, item.Height};
|
uiRect rc_dst = {kOSDMargin, (int) y, (int) item.Width, (int) item.Height};
|
||||||
|
|
||||||
uiDrawBitmapDraw(params->Context, item.DrawBitmap, &rc_src, &rc_dst, 0);
|
uiDrawBitmapDraw(params->Context, item.DrawBitmap, &rc_src, &rc_dst, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,27 +54,9 @@ set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
|
||||||
|
|
||||||
set(_LIBUINAME libui PARENT_SCOPE)
|
set(_LIBUINAME libui PARENT_SCOPE)
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
set(_LIBUINAME libui-temporary PARENT_SCOPE)
|
# set(_LIBUINAME libui-temporary PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
macro(_handle_static)
|
macro(_handle_static)
|
||||||
set_target_properties(${_LIBUINAME} PROPERTIES
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
|
||||||
set(_aname $<TARGET_FILE:${_LIBUINAME}>)
|
|
||||||
set(_oname libui-combined.o)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${_oname}
|
|
||||||
DEPENDS ${_LIBUINAME}
|
|
||||||
COMMAND
|
|
||||||
${CMAKE_LINKER} -r --whole-archive ${_aname} -o ${_oname}
|
|
||||||
COMMAND
|
|
||||||
objcopy --localize-hidden ${_oname}
|
|
||||||
COMMENT "Removing hidden symbols")
|
|
||||||
add_library(libui STATIC ${_oname})
|
|
||||||
# otherwise cmake won't know which linker to use
|
|
||||||
set_target_properties(libui PROPERTIES
|
|
||||||
LINKER_LANGUAGE C)
|
|
||||||
set(_aname)
|
|
||||||
set(_oname)
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# TODO the other variables don't work?
|
# TODO the other variables don't work?
|
||||||
|
|
Loading…
Reference in New Issue