Started the Windows cmake stuff and tried to get it to work on MinGW again.
This commit is contained in:
parent
e4a66b786e
commit
ee373a94d6
|
@ -15,6 +15,13 @@ if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||||
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
||||||
set(_SHARED TRUE)
|
set(_SHARED TRUE)
|
||||||
endif()
|
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(WIN32)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
if(_SHARED)
|
if(_SHARED)
|
||||||
|
@ -24,12 +31,6 @@ if(WIN32)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# and we need to set this up prior to project() too
|
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")
|
|
||||||
|
|
||||||
project(libui)
|
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||||
|
@ -77,6 +78,8 @@ elseif(WIN32)
|
||||||
set(_PLATFORM_LIBS
|
set(_PLATFORM_LIBS
|
||||||
user32 kernel32 usp10 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid
|
user32 kernel32 usp10 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(_RESOURCES_RC resources.rc)
|
||||||
else()
|
else()
|
||||||
set(_OSDIR unix)
|
set(_OSDIR unix)
|
||||||
set(_SETVERSION TRUE)
|
set(_SETVERSION TRUE)
|
||||||
|
@ -112,8 +115,13 @@ else()
|
||||||
append(CMAKE_EXE_LINKER_FLAGS_RELEASE " -fPIC")
|
append(CMAKE_EXE_LINKER_FLAGS_RELEASE " -fPIC")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
append(_LIBUI_CFLAGS
|
if(WIN32)
|
||||||
" -D_UI_EXTERN='__attribute__((visibility(\"default\"))) extern' -fvisibility=hidden ${_PLATFORM_CFLAGS}")
|
append(_LIBUI_CFLAGS
|
||||||
|
" -D _UI_EXTERN=\"__declspec(dllexport) extern\" ${_PLATFORM_CFLAGS}")
|
||||||
|
else()
|
||||||
|
append(_LIBUI_CFLAGS
|
||||||
|
" -D_UI_EXTERN='__attribute__((visibility(\"default\"))) extern' -fvisibility=hidden ${_PLATFORM_CFLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
append(CMAKE_SHARED_LINKER_FLAGS " -fvisibility=hidden")
|
append(CMAKE_SHARED_LINKER_FLAGS " -fvisibility=hidden")
|
||||||
# don't amend CMAKE_STATIC_LINKER_FLAGS; that's for ar
|
# don't amend CMAKE_STATIC_LINKER_FLAGS; that's for ar
|
||||||
|
@ -143,7 +151,8 @@ set_target_properties(libui PROPERTIES
|
||||||
macro(_add_exec _name)
|
macro(_add_exec _name)
|
||||||
add_executable(${_name}
|
add_executable(${_name}
|
||||||
WIN32 EXCLUDE_FROM_ALL
|
WIN32 EXCLUDE_FROM_ALL
|
||||||
${ARGN})
|
${ARGN}
|
||||||
|
${_RESOURCES_RC})
|
||||||
target_link_libraries(${_name} libui)
|
target_link_libraries(${_name} libui)
|
||||||
if(NOT _SHARED)
|
if(NOT _SHARED)
|
||||||
target_link_libraries(${_name} ${_PLATFORM_LIBS})
|
target_link_libraries(${_name} ${_PLATFORM_LIBS})
|
||||||
|
@ -155,4 +164,8 @@ set_target_properties(tester PROPERTIES
|
||||||
OUTPUT_NAME test
|
OUTPUT_NAME test
|
||||||
WIN32_EXECUTABLE FALSE)
|
WIN32_EXECUTABLE FALSE)
|
||||||
|
|
||||||
|
# the same resources.rc is shared by all the examples
|
||||||
|
if(_RESOURCES_RC)
|
||||||
|
set(_RESOURCES_RC "../${_RESOURCES_RC}")
|
||||||
|
endif()
|
||||||
add_subdirectory("examples")
|
add_subdirectory("examples")
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
# 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()
|
|
@ -8,9 +8,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MinGW
|
// LONGTERM MinGW
|
||||||
#ifdef __MINGW32__
|
|
||||||
#error At present, MinGW is not supported; see README.md for details.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// other compilers can be added here as necessary
|
// other compilers can be added here as necessary
|
||||||
|
|
|
@ -79,6 +79,8 @@ uiDrawTextFont *mkTextFont(IDWriteFont *df, BOOL addRef, WCHAR *family, BOOL cop
|
||||||
|
|
||||||
// TODO consider moving these all to dwrite.cpp
|
// TODO consider moving these all to dwrite.cpp
|
||||||
|
|
||||||
|
// TODO MinGW-w64 is missing this one
|
||||||
|
#define DWRITE_FONT_WEIGHT_SEMI_LIGHT (DWRITE_FONT_WEIGHT(350))
|
||||||
static const struct {
|
static const struct {
|
||||||
bool lastOne;
|
bool lastOne;
|
||||||
uiDrawTextWeight uival;
|
uiDrawTextWeight uival;
|
||||||
|
|
|
@ -8,7 +8,8 @@ struct handler {
|
||||||
uiControl *c;
|
uiControl *c;
|
||||||
|
|
||||||
// just to ensure handlers[new HWND] initializes properly
|
// just to ensure handlers[new HWND] initializes properly
|
||||||
struct handler()
|
// TODO gcc can't handle a struct keyword here? or is that a MSVC extension?
|
||||||
|
handler()
|
||||||
{
|
{
|
||||||
this->commandHandler = NULL;
|
this->commandHandler = NULL;
|
||||||
this->notifyHandler = NULL;
|
this->notifyHandler = NULL;
|
||||||
|
|
|
@ -50,9 +50,17 @@ extern WCHAR *itoutf16(intmax_t i);
|
||||||
#define _wsn(m) _ws2n(m)
|
#define _wsn(m) _ws2n(m)
|
||||||
#define debugargs const WCHAR *file, const WCHAR *line, const WCHAR *func
|
#define debugargs const WCHAR *file, const WCHAR *line, const WCHAR *func
|
||||||
extern HRESULT _logLastError(debugargs, const WCHAR *s);
|
extern HRESULT _logLastError(debugargs, const WCHAR *s);
|
||||||
|
#ifdef _MSC_VER
|
||||||
#define logLastError(s) _logLastError(_ws(__FILE__), _wsn(__LINE__), _ws(__FUNCTION__), s)
|
#define logLastError(s) _logLastError(_ws(__FILE__), _wsn(__LINE__), _ws(__FUNCTION__), s)
|
||||||
|
#else
|
||||||
|
#define logLastError(s) _logLastError(_ws(__FILE__), _wsn(__LINE__), L"TODO none of the function name macros are macros in MinGW", s)
|
||||||
|
#endif
|
||||||
extern HRESULT _logHRESULT(debugargs, const WCHAR *s, HRESULT hr);
|
extern HRESULT _logHRESULT(debugargs, const WCHAR *s, HRESULT hr);
|
||||||
|
#ifdef _MSC_VER
|
||||||
#define logHRESULT(s, hr) _logHRESULT(_ws(__FILE__), _wsn(__LINE__), _ws(__FUNCTION__), s, hr)
|
#define logHRESULT(s, hr) _logHRESULT(_ws(__FILE__), _wsn(__LINE__), _ws(__FUNCTION__), s, hr)
|
||||||
|
#else
|
||||||
|
#define logHRESULT(s, hr) _logHRESULT(_ws(__FILE__), _wsn(__LINE__), L"TODO none of the function name macros are macros in MinGW", s, hr)
|
||||||
|
#endif
|
||||||
|
|
||||||
// winutil.cpp
|
// winutil.cpp
|
||||||
extern int windowClassOf(HWND hwnd, ...);
|
extern int windowClassOf(HWND hwnd, ...);
|
||||||
|
|
Loading…
Reference in New Issue