refactor font.c into an MwFL section #9
1 changed files with 160 additions and 160 deletions
undo cmake formatting, also remove some reundant/non-existent files
commit
f59c8ce414
316
CMakeLists.txt
316
CMakeLists.txt
|
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(
|
project(
|
||||||
milsko
|
milsko
|
||||||
)
|
)
|
||||||
|
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
|
|
@ -21,231 +21,231 @@ option(MW_BUILD_STATIC "Build a static library" OFF)
|
||||||
option(MW_INSTALL_HEADERS "Install headers" ON)
|
option(MW_INSTALL_HEADERS "Install headers" ON)
|
||||||
|
|
||||||
file(
|
file(
|
||||||
GLOB
|
GLOB
|
||||||
SOURCES
|
SOURCES
|
||||||
src/*.c src/cursor/*.c src/icon/*.c src/text.c src/widget/*.c src/math/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c
|
src/*.c src/cursor/*.c src/icon/*.c src/widget/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c
|
||||||
)
|
)
|
||||||
|
|
||||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||||
|
|
||||||
if(NOT MW_USE_STB_IMAGE)
|
if(NOT MW_USE_STB_IMAGE)
|
||||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
|
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT MW_USE_STB_TRUETYPE)
|
if(NOT MW_USE_STB_TRUETYPE)
|
||||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_truetype.c")
|
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_truetype.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
|
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
|
||||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
|
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_TRY_OPENGL)
|
if(MW_TRY_OPENGL)
|
||||||
check_include_files(GL/gl.h HAVE_GL_GL_H)
|
check_include_files(GL/gl.h HAVE_GL_GL_H)
|
||||||
if(HAVE_GL_GL_H)
|
if(HAVE_GL_GL_H)
|
||||||
set(MW_BUILD_OPENGL ON)
|
set(MW_BUILD_OPENGL ON)
|
||||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||||
message(STATUS "OpenGL widget has been enabled")
|
message(STATUS "OpenGL widget has been enabled")
|
||||||
else()
|
else()
|
||||||
message(WARNING "OpenGL widget has been disabled")
|
message(WARNING "OpenGL widget has been disabled")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_TRY_VULKAN)
|
if(MW_TRY_VULKAN)
|
||||||
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
|
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
|
||||||
if(HAVE_VULKAN_VULKAN_H)
|
if(HAVE_VULKAN_VULKAN_H)
|
||||||
set(MW_BUILD_VULKAN ON)
|
set(MW_BUILD_VULKAN ON)
|
||||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||||
message(STATUS "Vulkan widget has been enabled")
|
message(STATUS "Vulkan widget has been enabled")
|
||||||
else()
|
else()
|
||||||
message(WARNING "Vulkan widget has been disabled")
|
message(WARNING "Vulkan widget has been disabled")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_BUILD_STATIC)
|
if(MW_BUILD_STATIC)
|
||||||
message(STATUS "Building Milsko as a static library")
|
message(STATUS "Building Milsko as a static library")
|
||||||
add_library(
|
add_library(
|
||||||
Mw
|
Mw
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
)
|
)
|
||||||
elseif(MW_BUILD_SHARED)
|
elseif(MW_BUILD_SHARED)
|
||||||
message(STATUS "Building Milsko as a shared library")
|
message(STATUS "Building Milsko as a shared library")
|
||||||
add_library(
|
add_library(
|
||||||
Mw
|
Mw
|
||||||
SHARED
|
SHARED
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message(ERROR "Must either build a shared library or a static library")
|
message(ERROR "Must either build a shared library or a static library")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_USE_STB_IMAGE)
|
if(MW_USE_STB_IMAGE)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_STB_IMAGE
|
USE_STB_IMAGE
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
file(
|
file(
|
||||||
GLOB
|
GLOB
|
||||||
IMAGE_SOURCES
|
IMAGE_SOURCES
|
||||||
external/libz/src/*.c external/libjpeg/src/*.c external/libpng/src/*.c
|
external/libz/src/*.c external/libjpeg/src/*.c external/libpng/src/*.c
|
||||||
)
|
)
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${MW_IMAGE_SOURCES}
|
${MW_IMAGE_SOURCES}
|
||||||
)
|
)
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
external/libz/include external/libjpeg/include external/libpng/include
|
external/libz/include external/libjpeg/include external/libpng/include
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_USE_STB_TRUETYPE)
|
if(MW_USE_STB_TRUETYPE)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_STB_TRUETYPE
|
USE_STB_TRUETYPE
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_USE_FREETYPE2)
|
if(MW_USE_FREETYPE2)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_FREETYPE2
|
USE_FREETYPE2
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(FT2 REQUIRED freetype2)
|
pkg_check_modules(FT2 REQUIRED freetype2)
|
||||||
list(APPEND INCLUDE_DIRS ${FT2_INCLUDE_DIRS})
|
list(APPEND INCLUDE_DIRS ${FT2_INCLUDE_DIRS})
|
||||||
list(APPEND LIBRARY_DIRS ${FT2_LIBRARY_DIRS})
|
list(APPEND LIBRARY_DIRS ${FT2_LIBRARY_DIRS})
|
||||||
list(APPEND LIBRARIES ${FT2_LIBRARIES})
|
list(APPEND LIBRARIES ${FT2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
Mw
|
Mw
|
||||||
PUBLIC
|
PUBLIC
|
||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MW_CLASSIC_THEME)
|
if(MW_CLASSIC_THEME)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_CLASSIC_THEME
|
USE_CLASSIC_THEME
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/backend/gdi.c
|
src/backend/gdi.c
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_GDI
|
USE_GDI
|
||||||
)
|
)
|
||||||
list(APPEND LIBRARIES gdi32)
|
list(APPEND LIBRARIES gdi32)
|
||||||
target_link_options(
|
target_link_options(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
-static-libgcc
|
-static-libgcc
|
||||||
)
|
)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/backend/cocoa.m
|
src/backend/cocoa.m
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_COCOA
|
USE_COCOA
|
||||||
)
|
)
|
||||||
list(APPEND LIBRARIES objc)
|
list(APPEND LIBRARIES objc)
|
||||||
target_link_options(
|
target_link_options(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
-framework Cocoa
|
-framework Cocoa
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(X11 REQUIRED x11)
|
pkg_check_modules(X11 REQUIRED x11)
|
||||||
pkg_check_modules(XRENDER REQUIRED xrender)
|
pkg_check_modules(XRENDER REQUIRED xrender)
|
||||||
|
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/backend/x11.c
|
src/backend/x11.c
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_X11
|
USE_X11
|
||||||
)
|
)
|
||||||
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS})
|
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS})
|
||||||
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS} ${XRENDER_LIBRARY_DIRS})
|
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS} ${XRENDER_LIBRARY_DIRS})
|
||||||
list(APPEND LIBRARIES ${X11_LIBRARIES} ${XRENDER_LIBRARIES} m)
|
list(APPEND LIBRARIES ${X11_LIBRARIES} ${XRENDER_LIBRARIES} m)
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
list(APPEND LIBRARIES dl)
|
list(APPEND LIBRARIES dl)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${INCLUDE_DIRS}
|
${INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
target_link_directories(
|
target_link_directories(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${LIBRARY_DIRS}
|
${LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${LIBRARIES}
|
${LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MW_BUILD_VULKAN)
|
if(MW_BUILD_VULKAN)
|
||||||
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
|
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
|
||||||
if(HAS_VK_ENUM_STRING_HELPER)
|
if(HAS_VK_ENUM_STRING_HELPER)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
HAS_VK_ENUM_STRING_HELPER
|
HAS_VK_ENUM_STRING_HELPER
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
_MILSKO
|
_MILSKO
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS Mw
|
TARGETS Mw
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MW_INSTALL_HEADERS)
|
if(MW_INSTALL_HEADERS)
|
||||||
install(
|
install(
|
||||||
DIRECTORY include/
|
DIRECTORY include/
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
FILES_MATCHING PATTERN "*.h"
|
FILES_MATCHING PATTERN "*.h"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_BUILD_EXAMPLES)
|
if(MW_BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue