Re-added OS X file. Now to just prune everything again.
This commit is contained in:
parent
bbb8791a47
commit
abcf1edf43
|
@ -5,7 +5,11 @@ cmake_minimum_required(VERSION 2.8.11)
|
||||||
# - MSVC static linking does not include the .res file in out\, so executables lack the necessary resources
|
# - MSVC static linking does not include the .res file in out\, so executables lack the necessary resources
|
||||||
# - same thing with MinGW?
|
# - same thing with MinGW?
|
||||||
# - MinGW doesn't work in general; windres doesn't like _UI_EXTERN (we could mitigate this by moving the stuff into ui.h and taking advantage of the libui_EXPORTS macro cmake makes for us) but
|
# - MinGW doesn't work in general; windres doesn't like _UI_EXTERN (we could mitigate this by moving the stuff into ui.h and taking advantage of the libui_EXPORTS macro cmake makes for us) but
|
||||||
# - Unix: gcc static linking extra step makes the above a moot point; PUBLIC properties don't propagate
|
# - Unix, Darwin: static linking makes the above a moot point; PUBLIC properties don't propagate
|
||||||
|
# - what is it, the static linking or the extra build step?
|
||||||
|
|
||||||
|
# the docs say we need to set this up prior to project()
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")
|
||||||
|
|
||||||
project(libui LANGUAGES C CXX)
|
project(libui LANGUAGES C CXX)
|
||||||
option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
|
option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
|
||||||
|
@ -17,6 +21,14 @@ set(CMAKE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(_OSNAME darwin)
|
set(_OSNAME darwin)
|
||||||
|
set(_HASVERSION TRUE)
|
||||||
|
set(_VERSION "A")
|
||||||
|
|
||||||
|
# always use our rpath
|
||||||
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
|
# the / is required by some older versions of OS X
|
||||||
|
set(CMAKE_INSTALL_RPATH "@executable_path/")
|
||||||
|
set(CMAKE_MACOSX_RPATH TRUE)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
set(_OSNAME windows)
|
set(_OSNAME windows)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
# 3 june 2016
|
||||||
|
|
||||||
|
list(APPEND _LIBUI_SOURCES
|
||||||
|
darwin/alloc.m
|
||||||
|
darwin/area.m
|
||||||
|
darwin/areaevents.m
|
||||||
|
darwin/autolayout.m
|
||||||
|
darwin/box.m
|
||||||
|
darwin/button.m
|
||||||
|
darwin/checkbox.m
|
||||||
|
darwin/colorbutton.m
|
||||||
|
darwin/combobox.m
|
||||||
|
darwin/control.m
|
||||||
|
darwin/datetimepicker.m
|
||||||
|
darwin/debug.m
|
||||||
|
darwin/draw.m
|
||||||
|
darwin/drawtext.m
|
||||||
|
darwin/editablecombo.m
|
||||||
|
darwin/entry.m
|
||||||
|
darwin/fontbutton.m
|
||||||
|
darwin/group.m
|
||||||
|
darwin/label.m
|
||||||
|
darwin/main.m
|
||||||
|
darwin/map.m
|
||||||
|
darwin/menu.m
|
||||||
|
darwin/multilineentry.m
|
||||||
|
darwin/progressbar.m
|
||||||
|
darwin/radiobuttons.m
|
||||||
|
darwin/scrollview.m
|
||||||
|
darwin/separator.m
|
||||||
|
darwin/slider.m
|
||||||
|
darwin/spinbox.m
|
||||||
|
darwin/stddialogs.m
|
||||||
|
darwin/tab.m
|
||||||
|
darwin/text.m
|
||||||
|
darwin/util.m
|
||||||
|
darwin/window.m
|
||||||
|
)
|
||||||
|
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
|
||||||
|
|
||||||
|
list(APPEND _LIBUI_INCLUDEDIRS
|
||||||
|
darwin
|
||||||
|
)
|
||||||
|
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(_LIBUINAME libui PARENT_SCOPE)
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
set(_LIBUINAME libui-temporary PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
# thanks to Mr-Hide in irc.freenode.net/#cmake
|
||||||
|
macro(_handle_static)
|
||||||
|
set_target_properties(${_LIBUINAME} PROPERTIES
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||||
|
set(_aname $<TARGET_FILE:${_LIBUINAME}>)
|
||||||
|
set(_lname libui-combined.list)
|
||||||
|
set(_oname libui-combined.o)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_oname}
|
||||||
|
COMMAND
|
||||||
|
nm -m ${_aname} | sed -E -n "'s/^[0-9a-f]* \\([A-Z_]+,[a-z_]+\\) external //p'" > ${_lname}
|
||||||
|
COMMAND
|
||||||
|
ld -exported_symbols_list ${_lname} -r -all_load ${_aname} -o ${_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(_lname)
|
||||||
|
set(_oname)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
set(_LIBUI_LIBS
|
||||||
|
objc "-framework Foundation" "-framework AppKit"
|
||||||
|
PARENT_SCOPE)
|
|
@ -53,44 +53,6 @@ macro(append2 _var1 _var2 _val)
|
||||||
append(${_var2} "${_val}")
|
append(${_var2} "${_val}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set(_OSDIR darwin)
|
|
||||||
set(_SETVERSION TRUE)
|
|
||||||
set(_VERSION "A")
|
|
||||||
|
|
||||||
set(_PLATFORM_LIBS
|
|
||||||
-lobjc "-framework Foundation" "-framework AppKit"
|
|
||||||
)
|
|
||||||
|
|
||||||
# always use our rpath
|
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
||||||
# the / is required by some older versions of OS X
|
|
||||||
set(CMAKE_INSTALL_RPATH "@executable_path/")
|
|
||||||
set(CMAKE_MACOSX_RPATH TRUE)
|
|
||||||
elseif(WIN32)
|
|
||||||
set(_OSDIR windows)
|
|
||||||
set(_SETVERSION FALSE)
|
|
||||||
|
|
||||||
# note that usp10 comes before gdi32
|
|
||||||
# TODO prune this list
|
|
||||||
set(_PLATFORM_LIBS
|
|
||||||
user32 kernel32 usp10 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid
|
|
||||||
)
|
|
||||||
# and don't include the default libraries
|
|
||||||
# note the CACHE FORCE stuff is required here
|
|
||||||
set(CMAKE_C_STANDARD_LIBRARIES CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_CXX_STANDARD_LIBRARIES CACHE STRING "" FORCE)
|
|
||||||
|
|
||||||
set(_RESOURCES_RC resources.rc)
|
|
||||||
else()
|
|
||||||
set(_OSDIR unix)
|
|
||||||
|
|
||||||
string(REPLACE ";" " " _LIBUI_CFLAGS "${GTK_CFLAGS}")
|
|
||||||
set(_PLATFORM_LIBS "${GTK_LDFLAGS} -lm -ldl")
|
|
||||||
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
append2(CMAKE_C_FLAGS CMAKE_CXX_FLAGS
|
append2(CMAKE_C_FLAGS CMAKE_CXX_FLAGS
|
||||||
"/W4 /wd4100 /bigobj /RTC1 /RTCs /RTCu")
|
"/W4 /wd4100 /bigobj /RTC1 /RTCs /RTCu")
|
||||||
|
|
|
@ -42,26 +42,3 @@ set_target_properties(libui-darwin PROPERTIES
|
||||||
COMPILE_FLAGS "${_LIBUI_CFLAGS}"
|
COMPILE_FLAGS "${_LIBUI_CFLAGS}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# 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(_lname ${_name}-combined.list)
|
|
||||||
set(_oname ${_name}-combined.o)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${_oname}
|
|
||||||
COMMAND
|
|
||||||
nm -m ${_aname} | sed -E -n "'s/^[0-9a-f]* \\([A-Z_]+,[a-z_]+\\) external //p'" > ${_lname}
|
|
||||||
COMMAND
|
|
||||||
ld -exported_symbols_list ${_lname} -r -all_load ${_aname} -o ${_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(_lname)
|
|
||||||
set(_oname)
|
|
||||||
endmacro()
|
|
||||||
|
|
Loading…
Reference in New Issue