Let's start removing the old files, putting in any missed bells and whistles.

This commit is contained in:
Pietro Gagliardi 2016-06-04 15:40:59 -04:00
parent fac03b050b
commit cb5fa98e75
8 changed files with 3 additions and 352 deletions

View File

@ -89,6 +89,9 @@ else()
string(APPEND CMAKE_C_FLAGS " --std=c99")
string(APPEND CMAKE_CXX_FLAGS " --std=c++11")
set(_COMMON_LDFLAGS
-fvisibility=hidden
)
endif()
# problem:

View File

@ -1,133 +0,0 @@
# 30 may 2016
cmake_minimum_required(VERSION 2.8.12)
# TODOs
# - ensure all set_target_properties() calls are approrpiately set, APPEND, and APPEND_STRING
# set up our configurations
set(CMAKE_CONFIGURATION_TYPES Debug Static Release ReleaseStatic)
# we load the variables after calling project()
# default to Debug if no configuration specified
if(NOT CMAKE_BUILD_TYPE)
# the CACHE FORCE is necessary for this to work properly
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type; one of: Debug Release Static ReleaseStatic" FORCE)
endif()
# and save whether this is shared in a variable
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(_SHARED TRUE)
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
set(_SHARED TRUE)
endif()
# and we need to set this up prior to project() too
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")
project(libui)
# TODO can this be above the project()?
if(WIN32)
if(NOT MSVC)
if(_SHARED)
message(FATAL_ERROR
"Sorry, libui for Windows cannot be built as a DLL with MinGW. You will need to either build as a static library or build with MSVC.")
endif()
endif()
endif()
# now that we called project(), load our config variables
macro(cfgcopy _prefix)
set(${_prefix}_STATIC "${${_prefix}_DEBUG}")
set(${_prefix}_RELEASESTATIC "${${_prefix}_RELEASE}")
endmacro()
cfgcopy(CMAKE_C_FLAGS)
cfgcopy(CMAKE_CXX_FLAGS)
cfgcopy(CMAKE_SHARED_LINKER_FLAGS)
cfgcopy(CMAKE_STATIC_LINKER_FLAGS)
cfgcopy(CMAKE_EXE_LINKER_FLAGS)
macro(append _var _val)
set(${_var} "${${_var}} ${_val}")
endmacro()
macro(append2 _var1 _var2 _val)
append(${_var1} "${_val}")
append(${_var2} "${_val}")
endmacro()
if(MSVC)
append2(CMAKE_C_FLAGS CMAKE_CXX_FLAGS
"/W4 /wd4100 /bigobj /RTC1 /RTCs /RTCu")
# shut the compiler up in some cases
# LONGTERM still needed?
append(CMAKE_CXX_FLAGS " /EHsc")
append(_LIBUI_CFLAGS " ${_PLATFORM_CFLAGS}")
# note the /MANIFEST:NO (which must be / and uppercase); thanks FraGag (https://github.com/andlabs/libui/issues/93#issuecomment-223183436)
# also don't apply to CMAKE_STATIC_LINKER_FLAGS; those are passed to a different tool that doesn't support them
append2(CMAKE_SHARED_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS
" /LARGEADDRESSAWARE /INCREMENTAL:NO /MANIFEST:NO")
else()
append2(CMAKE_C_FLAGS CMAKE_CXX_FLAGS
" -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-switch")
if(NOT WIN32)
append(CMAKE_C_FLAGS_DEBUG " -fPIC")
append(CMAKE_CXX_FLAGS_DEBUG " -fPIC")
append(CMAKE_SHARED_LINKER_FLAGS_DEBUG " -fPIC")
append(CMAKE_EXE_LINKER_FLAGS_DEBUG " -fPIC")
append(CMAKE_C_FLAGS_RELEASE " -fPIC")
append(CMAKE_CXX_FLAGS_RELEASE " -fPIC")
append(CMAKE_SHARED_LINKER_FLAGS_RELEASE " -fPIC")
append(CMAKE_EXE_LINKER_FLAGS_RELEASE " -fPIC")
endif()
if(WIN32)
append(_LIBUI_CFLAGS " ${_PLATFORM_CFLAGS}")
else()
append(_LIBUI_CFLAGS " -fvisibility=hidden ${_PLATFORM_CFLAGS}")
endif()
append(CMAKE_SHARED_LINKER_FLAGS " -fvisibility=hidden")
# don't amend CMAKE_STATIC_LINKER_FLAGS; that's for ar
endif()
if(NOT _SHARED)
append(_LIBUI_CFLAGS " -D_UI_STATIC")
endif()
add_subdirectory("common")
add_subdirectory("${_OSDIR}")
if(_SHARED)
add_library(libui SHARED
$<TARGET_OBJECTS:libui-common>
$<TARGET_OBJECTS:libui-${_OSDIR}>
)
if(_SETVERSION)
set_target_properties(libui PROPERTIES
SOVERSION "${_VERSION}")
endif()
target_link_libraries(libui PRIVATE ${_PLATFORM_LIBS})
else()
_add_static(libui
$<TARGET_OBJECTS:libui-common>
$<TARGET_OBJECTS:libui-${_OSDIR}>
)
endif()
# non-Windows platforms add an extra lib- at the beginning
if(NOT WIN32)
set_target_properties(libui PROPERTIES
OUTPUT_NAME ui)
endif()
# let cmake handle quoting and escaping for us
if(WIN32)
target_compile_definitions(libui
PRIVATE "_UI_EXTERN=__declspec(dllexport) extern")
else()
target_compile_definitions(libui
PRIVATE "_UI_EXTERN=__attribute__((visibility(\"default\"))) extern")
endif()
add_subdirectory("test")
add_subdirectory("examples")

View File

@ -1,15 +0,0 @@
# 31 may 2016
include_directories(.. .)
add_library(libui-common OBJECT
areaevents.c
control.c
debug.c
matrix.c
shouldquit.c
userbugs.c
)
set_target_properties(libui-common PROPERTIES
COMPILE_FLAGS "${_LIBUI_CFLAGS}"
)

View File

@ -1,44 +0,0 @@
# 31 may 2016
include_directories(.. . ../common)
add_library(libui-darwin OBJECT
alloc.m
area.m
areaevents.m
autolayout.m
box.m
button.m
checkbox.m
colorbutton.m
combobox.m
control.m
datetimepicker.m
debug.m
draw.m
drawtext.m
editablecombo.m
entry.m
fontbutton.m
group.m
label.m
main.m
map.m
menu.m
multilineentry.m
progressbar.m
radiobuttons.m
scrollview.m
separator.m
slider.m
spinbox.m
stddialogs.m
tab.m
text.m
util.m
window.m
)
set_target_properties(libui-darwin PROPERTIES
COMPILE_FLAGS "${_LIBUI_CFLAGS}"
)

View File

@ -1,22 +0,0 @@
# 1 june 2016
include_directories(..)
_add_exec(controlgallery
controlgallery/main.c
)
_add_exec(histogram
histogram/main.c
)
_add_exec(cpp-multithread
cpp-multithread/main.cpp
)
target_link_libraries(cpp-multithread pthread)
add_custom_target(examples
DEPENDS
controlgallery
histogram
cpp-multithread)

View File

@ -1,26 +0,0 @@
# 1 june 2016
include_directories(.. .)
_add_exec(tester
drawtests.c
main.c
menus.c
page1.c
page10.c
page11.c
page12.c
page13.c
page2.c
page3.c
page4.c
page5.c
page6.c
page7.c
page7a.c
page7b.c
page7c.c
page8.c
page9.c
spaced.c
)

View File

@ -1,48 +0,0 @@
# 1 june 2016
include_directories(.. . ../common)
add_library(libui-unix OBJECT
alloc.c
area.c
box.c
button.c
checkbox.c
child.c
colorbutton.c
combobox.c
control.c
datetimepicker.c
debug.c
draw.c
drawmatrix.c
drawpath.c
drawtext.c
editablecombo.c
entry.c
fontbutton.c
graphemes.c
group.c
label.c
main.c
menu.c
multilineentry.c
progressbar.c
radiobuttons.c
separator.c
slider.c
spinbox.c
stddialogs.c
tab.c
text.c
util.c
window.c
)
set_target_properties(libui-unix PROPERTIES
COMPILE_FLAGS "${_LIBUI_CFLAGS}"
)
# thanks to Mr-Hide in irc.freenode.net/#cmake
macro(_add_static _name)
endmacro()

View File

@ -1,64 +0,0 @@
# 1 june 2016
include_directories(.. . ../common)
add_library(libui-windows OBJECT
alloc.cpp
area.cpp
areadraw.cpp
areaevents.cpp
areascroll.cpp
areautil.cpp
box.cpp
button.cpp
checkbox.cpp
colorbutton.cpp
colordialog.cpp
combobox.cpp
container.cpp
control.cpp
d2dscratch.cpp
datetimepicker.cpp
debug.cpp
draw.cpp
drawmatrix.cpp
drawpath.cpp
drawtext.cpp
dwrite.cpp
editablecombo.cpp
entry.cpp
events.cpp
fontbutton.cpp
fontdialog.cpp
graphemes.cpp
group.cpp
init.cpp
label.cpp
main.cpp
menu.cpp
multilineentry.cpp
parent.cpp
progressbar.cpp
radiobuttons.cpp
separator.cpp
sizing.cpp
slider.cpp
spinbox.cpp
stddialogs.cpp
tab.cpp
tabpage.cpp
text.cpp
utf16.cpp
utilwin.cpp
window.cpp
winpublic.cpp
winutil.cpp
resources.rc
)
set_target_properties(libui-windows PROPERTIES
COMPILE_FLAGS "${_LIBUI_CFLAGS}"
)
macro(_add_static _name)
add_library(${_name} STATIC "${ARGN}")
endmacro()