mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-16 22:24:07 +00:00
fix cmake
This commit is contained in:
@@ -9,16 +9,16 @@ include(GNUInstallDirs)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
option(TRY_OPENGL "Try to compile OpenGL widget or not" ON)
|
||||
option(TRY_VULKAN "Try to compile Vulkan widget or not" ON)
|
||||
option(CLASSIC_THEME "Use classic theme" OFF)
|
||||
option(BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(USE_STB_IMAGE "Use stb_image" ON)
|
||||
option(USE_STB_TRUETYPE "Use stb_truetype" OFF)
|
||||
option(USE_FREETYPE2 "Use FreeType 2" ON)
|
||||
option(BUILD_SHARED "Build a shared library" ON)
|
||||
option(BUILD_STATIC "Build a static library" OFF)
|
||||
option(INSTALL_HEADERS "Install headers" ON)
|
||||
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" ON)
|
||||
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" ON)
|
||||
option(MW_CLASSIC_THEME "Use classic theme" OFF)
|
||||
option(MW_BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(MW_USE_STB_IMAGE "Use stb_image" ON)
|
||||
option(MW_USE_STB_TRUETYPE "Use stb_truetype" OFF)
|
||||
option(MW_USE_FREETYPE2 "Use FreeType 2" ON)
|
||||
option(MW_BUILD_SHARED "Build a shared library" ON)
|
||||
option(MW_BUILD_STATIC "Build a static library" OFF)
|
||||
option(MW_INSTALL_HEADERS "Install headers" ON)
|
||||
|
||||
file(
|
||||
GLOB
|
||||
@@ -29,11 +29,11 @@ file(
|
||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||
|
||||
if(NOT USE_STB_IMAGE)
|
||||
if(NOT MW_USE_STB_IMAGE)
|
||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
|
||||
endif()
|
||||
|
||||
if(NOT USE_STB_TRUETYPE)
|
||||
if(NOT MW_USE_STB_TRUETYPE)
|
||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_truetype.c")
|
||||
endif()
|
||||
|
||||
@@ -42,10 +42,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
|
||||
endif()
|
||||
|
||||
if(TRY_OPENGL)
|
||||
if(MW_TRY_OPENGL)
|
||||
check_include_files(GL/gl.h HAVE_GL_GL_H)
|
||||
if(HAVE_GL_GL_H)
|
||||
set(BUILD_OPENGL ON)
|
||||
set(MW_BUILD_OPENGL ON)
|
||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||
message(STATUS "OpenGL widget has been enabled")
|
||||
else()
|
||||
@@ -53,10 +53,10 @@ if(TRY_OPENGL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TRY_OPENGL)
|
||||
if(MW_TRY_VULKAN)
|
||||
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
|
||||
if(HAVE_VULKAN_VULKAN_H)
|
||||
set(BUILD_VULKAN ON)
|
||||
set(MW_BUILD_VULKAN ON)
|
||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||
message(STATUS "Vulkan widget has been enabled")
|
||||
else()
|
||||
@@ -64,13 +64,13 @@ if(TRY_OPENGL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC)
|
||||
if(MW_BUILD_STATIC)
|
||||
message(STATUS "Building Milsko as a static library")
|
||||
add_library(
|
||||
Mw
|
||||
${SOURCES}
|
||||
)
|
||||
elseif(BUILD_SHARED)
|
||||
elseif(MW_BUILD_SHARED)
|
||||
message(STATUS "Building Milsko as a shared library")
|
||||
add_library(
|
||||
Mw
|
||||
@@ -81,7 +81,7 @@ else()
|
||||
message(ERROR "Must either build a shared library or a static library")
|
||||
endif()
|
||||
|
||||
if(USE_STB_IMAGE)
|
||||
if(MW_USE_STB_IMAGE)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
@@ -96,7 +96,7 @@ else()
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
${IMAGE_SOURCES}
|
||||
${MW_IMAGE_SOURCES}
|
||||
)
|
||||
target_include_directories(
|
||||
Mw
|
||||
@@ -105,7 +105,7 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_STB_TRUETYPE)
|
||||
if(MW_USE_STB_TRUETYPE)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
@@ -113,7 +113,7 @@ if(USE_STB_TRUETYPE)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_FREETYPE2)
|
||||
if(MW_USE_FREETYPE2)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
@@ -133,7 +133,7 @@ target_include_directories(
|
||||
include
|
||||
)
|
||||
|
||||
if(CLASSIC_THEME)
|
||||
if(MW_CLASSIC_THEME)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
@@ -197,7 +197,7 @@ target_link_libraries(
|
||||
${LIBRARIES}
|
||||
)
|
||||
|
||||
if(BUILD_VULKAN)
|
||||
if(MW_BUILD_VULKAN)
|
||||
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
|
||||
if(HAS_VK_ENUM_STRING_HELPER)
|
||||
target_compile_definitions(
|
||||
@@ -221,7 +221,7 @@ install(
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
if(INSTALL_HEADERS)
|
||||
if(MW_INSTALL_HEADERS)
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
@@ -229,6 +229,6 @@ if(INSTALL_HEADERS)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BUILD_EXAMPLES)
|
||||
if(MW_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user