Re-added the Unix stuff.
This commit is contained in:
parent
838851f55a
commit
5c01a8dec3
|
@ -25,6 +25,12 @@ elseif(WIN32)
|
|||
set(CMAKE_CXX_STANDARD_LIBRARIES CACHE STRING "" FORCE)
|
||||
else()
|
||||
set(_OSNAME unix)
|
||||
set(_HASVERSION TRUE)
|
||||
set(_VERSION "0")
|
||||
|
||||
# always use our rpath
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
|
||||
endif()
|
||||
|
||||
# common flags
|
||||
|
@ -115,6 +121,18 @@ else()
|
|||
target_compile_definitions(${_LIBUINAME}
|
||||
PRIVATE "_UI_EXTERN=__attribute__((visibility(\"default\"))) extern")
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
# on non-Windows platforms cmake adds an extra lib-
|
||||
# note that we apply this to libui, not to any intermediates
|
||||
set_target_properties(libui PROPERTIES
|
||||
OUTPUT_NAME ui)
|
||||
endif()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(_HASVERSION)
|
||||
set_target_properties(${_LIBUINAME} PROPERTIES
|
||||
SOVERSION "${_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(_add_exec _name)
|
||||
add_executable(${_name}
|
||||
|
|
|
@ -84,17 +84,11 @@ elseif(WIN32)
|
|||
set(_RESOURCES_RC resources.rc)
|
||||
else()
|
||||
set(_OSDIR unix)
|
||||
set(_SETVERSION TRUE)
|
||||
set(_VERSION "0")
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED gtk+-3.0)
|
||||
string(REPLACE ";" " " _LIBUI_CFLAGS "${GTK_CFLAGS}")
|
||||
set(_PLATFORM_LIBS "${GTK_LDFLAGS} -lm -ldl")
|
||||
|
||||
# always use our rpath
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
|
||||
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
|
|
@ -44,22 +44,5 @@ set_target_properties(libui-unix PROPERTIES
|
|||
|
||||
# thanks to Mr-Hide in irc.freenode.net/#cmake
|
||||
macro(_add_static _name)
|
||||
add_library(${_name}-temporary STATIC "${ARGN}")
|
||||
set_target_properties(${_name}-temporary PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||
set(_aname $<TARGET_FILE:${_name}-temporary>)
|
||||
set(_oname ${_name}-combined.o)
|
||||
add_custom_command(
|
||||
OUTPUT ${_oname}
|
||||
COMMAND
|
||||
ld -r --whole-archive ${_aname} -o ${_oname}
|
||||
COMMAND
|
||||
objcopy --localize-hidden ${_oname}
|
||||
COMMENT "Removing hidden symbols")
|
||||
add_library(${_name} STATIC ${_oname})
|
||||
# otherwise cmake won't know which linker to use
|
||||
set_target_properties(${_name} PROPERTIES
|
||||
LINKER_LANGUAGE C)
|
||||
set(_aname)
|
||||
set(_oname)
|
||||
|
||||
endmacro()
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
# 3 june 2016
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED gtk+-3.0)
|
||||
|
||||
list(APPEND _LIBUI_SOURCES
|
||||
unix/alloc.c
|
||||
unix/area.c
|
||||
unix/box.c
|
||||
unix/button.c
|
||||
unix/checkbox.c
|
||||
unix/child.c
|
||||
unix/colorbutton.c
|
||||
unix/combobox.c
|
||||
unix/control.c
|
||||
unix/datetimepicker.c
|
||||
unix/debug.c
|
||||
unix/draw.c
|
||||
unix/drawmatrix.c
|
||||
unix/drawpath.c
|
||||
unix/drawtext.c
|
||||
unix/editablecombo.c
|
||||
unix/entry.c
|
||||
unix/fontbutton.c
|
||||
unix/graphemes.c
|
||||
unix/group.c
|
||||
unix/label.c
|
||||
unix/main.c
|
||||
unix/menu.c
|
||||
unix/multilineentry.c
|
||||
unix/progressbar.c
|
||||
unix/radiobuttons.c
|
||||
unix/separator.c
|
||||
unix/slider.c
|
||||
unix/spinbox.c
|
||||
unix/stddialogs.c
|
||||
unix/tab.c
|
||||
unix/text.c
|
||||
unix/util.c
|
||||
unix/window.c
|
||||
)
|
||||
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
|
||||
|
||||
list(APPEND _LIBUI_INCLUDEDIRS
|
||||
unix
|
||||
)
|
||||
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
|
||||
|
||||
set(_LIBUINAME libui PARENT_SCOPE)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set(_LIBUINAME libui-temporary PARENT_SCOPE)
|
||||
endif()
|
||||
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}
|
||||
COMMAND
|
||||
ld -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()
|
||||
|
||||
# TODO the other variables don't work?
|
||||
set(_LIBUI_CFLAGS
|
||||
${GTK_CFLAGS}
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(_LIBUI_LIBS
|
||||
${GTK_LDFLAGS} m dl
|
||||
PARENT_SCOPE)
|
Loading…
Reference in New Issue