Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2396b67522 | ||
|
ac7e89a2e6 | ||
|
0761cfc6c1 | ||
|
ec222c2e86 | ||
|
8d7b6822c4 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,3 +9,5 @@ docs/src
|
||||
*.swo
|
||||
*.swp
|
||||
/private/
|
||||
*build*
|
||||
.idea
|
||||
|
105
CMakeLists.txt
Normal file
105
CMakeLists.txt
Normal file
@ -0,0 +1,105 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(Nuklear VERSION 0.0.1 LANGUAGES C)
|
||||
|
||||
#===============#
|
||||
# Compiler args #
|
||||
#===============#
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
|
||||
set(CMAKE_C_STANDARD 90)
|
||||
|
||||
add_library("${PROJECT_NAME}_compiler_flags" INTERFACE)
|
||||
target_compile_features("${PROJECT_NAME}_compiler_flags" INTERFACE "c_std_${CMAKE_C_STANDARD}")
|
||||
|
||||
# add compiler warning flags just when building this project via
|
||||
# the BUILD_INTERFACE genex
|
||||
set(gcc_like "$<COMPILE_LANG_AND_ID:C,CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
|
||||
set(msvc "$<COMPILE_LANG_AND_ID:C,CXX,MSVC>")
|
||||
target_compile_options(
|
||||
"${PROJECT_NAME}_compiler_flags"
|
||||
INTERFACE
|
||||
"$<${gcc_like}:$<BUILD_INTERFACE:-Wall;-Wextra;-pedantic;-Wno-misleading-indentation;-Wno-shift-negative-value;-O2>>"
|
||||
"$<${msvc}:$<BUILD_INTERFACE:-W3;-WX;-Zi;-permissive->>"
|
||||
)
|
||||
|
||||
# Set the build directories
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
|
||||
#===========#
|
||||
# Configure #
|
||||
#===========#
|
||||
|
||||
# configure a header file to pass the version number only
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in"
|
||||
"${PROJECT_NAME}Config.h"
|
||||
)
|
||||
|
||||
#=============#
|
||||
# Sub-targets #
|
||||
#=============#
|
||||
|
||||
option(BUILD_HEADER_ONLY "Header only variant" "ON")
|
||||
option(BUILD_DEMOS "Build demos" "ON")
|
||||
option(BUILD_EXAMPLES "Build examples" "ON")
|
||||
|
||||
add_subdirectory("src")
|
||||
if (BUILD_DEMOS)
|
||||
add_subdirectory("demo")
|
||||
endif (BUILD_DEMOS)
|
||||
if (BUILD_EXAMPLES)
|
||||
add_subdirectory("example")
|
||||
endif (BUILD_EXAMPLES)
|
||||
|
||||
include(CTest)
|
||||
if (BUILD_TESTING)
|
||||
#add_subdirectory("tests")
|
||||
endif (BUILD_TESTING)
|
||||
|
||||
#=========#
|
||||
# Install #
|
||||
#=========#
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.h"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nuklear")
|
||||
include(InstallRequiredSystemLibraries)
|
||||
set(CPACK_BUNDLE_NAME "${PROJECT_NAME}")
|
||||
set(CPACK_PACKAGE_VENDOR "Micha Mettke")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "A single-header ANSI C immediate mode cross-platform GUI library")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
||||
if (APPLE)
|
||||
set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Info.plist")
|
||||
set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Info.plist")
|
||||
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CustomVolumeIcon.icns")
|
||||
endif (APPLE)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/src/LICENSE")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${${PROJECT_NAME}_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${${PROJECT_NAME}_VERSION_MINOR}")
|
||||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/cmake/README.txt")
|
||||
set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Welcome.txt")
|
||||
set(CPACK_PACKAGE_CONTACT "https://github.com/Immediate-Mode-UI/Nuklear")
|
||||
|
||||
include(CPack)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# generate the config file that is includes the exports
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/nuklear"
|
||||
NO_SET_AND_CHECK_MACRO
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
)
|
||||
|
||||
# generate the version file for the config file
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}"
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/nuklear")
|
BIN
cmake/BundleIcon.icns
Normal file
BIN
cmake/BundleIcon.icns
Normal file
Binary file not shown.
7
cmake/CTestConfig.cmake
Normal file
7
cmake/CTestConfig.cmake
Normal file
@ -0,0 +1,7 @@
|
||||
set(CTEST_PROJECT_NAME "nuklear")
|
||||
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
|
||||
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "my.cdash.org")
|
||||
set(CTEST_DROP_LOCATION "/submit.php?project=nuklear")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
4
cmake/Config.cmake.in
Normal file
4
cmake/Config.cmake.in
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include ( "${CMAKE_CURRENT_LIST_DIR}/nuklearTargets.cmake" )
|
BIN
cmake/CustomVolumeIcon.icns
Normal file
BIN
cmake/CustomVolumeIcon.icns
Normal file
Binary file not shown.
14
cmake/Info.plist
Normal file
14
cmake/Info.plist
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>BundleGeneratorTest</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>BundleGeneratorTest.icns</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
</dict>
|
||||
</plist>
|
6
cmake/MultiCPackConfig.cmake
Normal file
6
cmake/MultiCPackConfig.cmake
Normal file
@ -0,0 +1,6 @@
|
||||
include("release/CPackConfig.cmake")
|
||||
|
||||
set(CPACK_INSTALL_CMAKE_PROJECTS
|
||||
"debug;nuklear;ALL;/"
|
||||
"release;nuklear;ALL;/"
|
||||
)
|
7
cmake/README.txt
Normal file
7
cmake/README.txt
Normal file
@ -0,0 +1,7 @@
|
||||
nuklear
|
||||
|
||||
Minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Licensed under (Unlicense OR MIT)
|
1
cmake/Welcome.txt
Normal file
1
cmake/Welcome.txt
Normal file
@ -0,0 +1 @@
|
||||
This installs nuklear.
|
9
cmake/config.h.in
Normal file
9
cmake/config.h.in
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef NUKLEAR_CONFIG_H
|
||||
#define NUKLEAR_CONFIG_H
|
||||
|
||||
#define NUKLEAR_VERSION_MAJOR @Nuklear_VERSION_MAJOR@
|
||||
#define NUKLEAR_VERSION_MINOR @Nuklear_VERSION_MINOR@
|
||||
#define NUKLEAR_VERSION_PATCH @Nuklear_VERSION_PATCH@
|
||||
#define NUKLEAR_VERSION "@Nuklear_VERSION@"
|
||||
|
||||
#endif /* !NUKLEAR_CONFIG_H */
|
53
cmake/modules/CMakeFindM.cmake
Normal file
53
cmake/modules/CMakeFindM.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# - Find math
|
||||
# Find the native M includes and library
|
||||
#
|
||||
# M_INCLUDE_DIRS - where to find math.h, etc.
|
||||
# M_LIBRARIES - List of libraries when using math.
|
||||
# M_FOUND - True if math found.
|
||||
|
||||
|
||||
IF (M_INCLUDE_DIRS)
|
||||
# Already in cache, be silent
|
||||
SET(M_FIND_QUIETLY TRUE)
|
||||
ENDIF (M_INCLUDE_DIRS)
|
||||
|
||||
#
|
||||
# On OS X, make sure we do *NOT* find math.h in the Kernel framework,
|
||||
# as that will convince CMake to cause the build to look there for
|
||||
# headers.
|
||||
#
|
||||
# For some unknown reason, on Yosemite, math.h is included in the Kernel
|
||||
# framework. That framework exists to supply headers for building
|
||||
# *kernel* modules; it includes versions of C headers that are similar
|
||||
# to the standard userland headers, but not similar enough to be usable
|
||||
# when building userland code.
|
||||
#
|
||||
# Unless told not to look first in the framework paths, CMake will, on
|
||||
# Yosemite, or when using the Yosemite SDK, find math.h in the Kernel
|
||||
# framework, and add the header directory for the Kernel framework to
|
||||
# the list of places to look for headers, causing it to pick up other
|
||||
# headers from there as well. This causes the build to fail.
|
||||
#
|
||||
SET(SAVED_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
|
||||
SET(CMAKE_FIND_FRAMEWORK LAST)
|
||||
FIND_PATH(M_INCLUDE_DIR math.h)
|
||||
SET(CMAKE_FIND_FRAMEWORK ${SAVED_CMAKE_FIND_FRAMEWORK})
|
||||
|
||||
SET(M_NAMES m)
|
||||
FIND_LIBRARY(M_LIBRARY NAMES ${M_NAMES} )
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set M_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(M DEFAULT_MSG M_LIBRARY M_INCLUDE_DIR)
|
||||
|
||||
IF(M_FOUND)
|
||||
SET( M_LIBRARIES ${M_LIBRARY} )
|
||||
SET( M_INCLUDE_DIRS ${M_INCLUDE_DIR} )
|
||||
ELSE(M_FOUND)
|
||||
SET( M_LIBRARIES )
|
||||
SET( M_INCLUDE_DIRS )
|
||||
ENDIF(M_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED( M_LIBRARIES M_INCLUDE_DIRS )
|
29
demo/CMakeLists.txt
Normal file
29
demo/CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
||||
set(demos
|
||||
"allegro5"
|
||||
# "common"
|
||||
# "d3d11"
|
||||
# "d3d12"
|
||||
# "d3d9"
|
||||
# "gdi"
|
||||
# "gdip"
|
||||
# "glfw_opengl2"
|
||||
# "glfw_opengl3"
|
||||
# "glfw_opengl4"
|
||||
# "sdl2surface_rawfb"
|
||||
# "sdl_opengl2"
|
||||
# "sdl_opengl3"
|
||||
# "sdl_opengles2"
|
||||
# "sdl_renderer"
|
||||
# "sfml_opengl2"
|
||||
# "sfml_opengl3"
|
||||
# "wayland_rawfb"
|
||||
# "x11"
|
||||
# "x11_opengl2"
|
||||
# "x11_opengl3"
|
||||
# "x11_rawfb"
|
||||
# "x11_xft"
|
||||
)
|
||||
|
||||
foreach (demo ${demos})
|
||||
add_subdirectory("${demo}")
|
||||
endforeach (demo ${demos})
|
66
demo/allegro5/CMakeLists.txt
Normal file
66
demo/allegro5/CMakeLists.txt
Normal file
@ -0,0 +1,66 @@
|
||||
###################
|
||||
# KeyboardHandler #
|
||||
###################
|
||||
#get_filename_component(LIBRARY_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||
#set(LIBRARY_NAME "${PROJECT_NAME}_demo_${LIBRARY_NAME}")
|
||||
#
|
||||
#set(Header_Files "KeyboardHandleriOS.h")
|
||||
#source_group("Header Files" FILES "${Header_Files}")
|
||||
#
|
||||
#set(Source_Files "KeyboardHandleriOS.m")
|
||||
#source_group("Source Files" FILES "${Source_Files}")
|
||||
#
|
||||
#add_library("${LIBRARY_NAME}" "${Header_Files}" "${Source_Files}")
|
||||
#include(GNUInstallDirs)
|
||||
#target_include_directories(
|
||||
# "${LIBRARY_NAME}"
|
||||
# PUBLIC
|
||||
# "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
# "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
#)
|
||||
#
|
||||
#target_link_libraries(
|
||||
# "${LIBRARY_NAME}"
|
||||
# PRIVATE
|
||||
# "${PROJECT_NAME}_compiler_flags"
|
||||
#)
|
||||
#
|
||||
#set_target_properties("${LIBRARY_NAME}" PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
#################
|
||||
# allegro5 demo #
|
||||
#################
|
||||
|
||||
get_filename_component(EXEC_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||
set(EXEC_NAME "${PROJECT_NAME}_demo_${EXEC_NAME}")
|
||||
|
||||
set(Header_Files "nuklear_allegro5.h")
|
||||
source_group("Header Files" FILES "${Header_Files}")
|
||||
|
||||
set(Source_Files "main.c")
|
||||
source_group("Source Files" FILES "${Source_Files}")
|
||||
|
||||
add_executable("${EXEC_NAME}" "${Header_Files}" "${Source_Files}")
|
||||
include(GNUInstallDirs)
|
||||
target_include_directories(
|
||||
"${EXEC_NAME}"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
"${EXEC_NAME}"
|
||||
PRIVATE
|
||||
"${PROJECT_NAME}_compiler_flags"
|
||||
)
|
||||
|
||||
find_package(unofficial-allegro5 CONFIG REQUIRED)
|
||||
target_link_libraries(
|
||||
"${EXEC_NAME}"
|
||||
PRIVATE
|
||||
"unofficial-allegro5::allegro"
|
||||
"unofficial-allegro5::allegro_ttf"
|
||||
"unofficial-allegro5::allegro_font"
|
||||
"unofficial-allegro5::allegro_main"
|
||||
)
|
30
example/CMakeLists.txt
Normal file
30
example/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
||||
set(_libs "file_browser" "extended" "canvas" "skinning")
|
||||
|
||||
find_package(glfw3 CONFIG REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
|
||||
include(FindOpenGL)
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/cmake/modules/CMakeFindM.cmake")
|
||||
|
||||
set(deps "glfw" "GLEW::GLEW" "OpenGL::GL" "${M_LIBRARIES}")
|
||||
if (APPLE)
|
||||
#SET(GUI_TYPE MACOSX_BUNDLE)
|
||||
#INCLUDE_DIRECTORIES ( /Developer/Headers/FlatCarbon )
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(COREVIDEO_LIBRARY CoreVideo)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
mark_as_advanced(COCOA_LIBRARY COREVIDEO_LIBRARY IOKIT_LIBRARY)
|
||||
list(APPEND deps "${COCOA_LIBRARY}" "${COREVIDEO_LIBRARY}" "${IOKIT_LIBRARY}")
|
||||
# -L/usr/local/lib
|
||||
# -I/usr/local/include
|
||||
endif (APPLE)
|
||||
|
||||
foreach (_lib ${_libs})
|
||||
set(src "${_lib}.c")
|
||||
source_group("${_lib} Files" FILES "${src}")
|
||||
add_executable("${_lib}" "${src}")
|
||||
target_link_libraries("${_lib}" PRIVATE "${deps}")
|
||||
target_include_directories("${_lib}" PRIVATE "${M_INCLUDE_DIRS}")
|
||||
endforeach (_lib ${_libs})
|
165
src/CMakeLists.txt
Normal file
165
src/CMakeLists.txt
Normal file
@ -0,0 +1,165 @@
|
||||
set(LIBRARY_NAME "nuklear")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(pub "nuklear.h")
|
||||
source_group("Public Header Files" FILES "${pub}")
|
||||
|
||||
set(priv1
|
||||
"nuklear_internal.h" "nuklear_math.c" "nuklear_util.c"
|
||||
"nuklear_color.c" "nuklear_utf8.c" "nuklear_buffer.c"
|
||||
"nuklear_string.c" "nuklear_draw.c" "nuklear_vertex.c")
|
||||
source_group("Private [1] Files" FILES "${priv1}")
|
||||
|
||||
set(extern "stb_rect_pack.h" "stb_truetype.h")
|
||||
source_group("External Files" FILES "${extern}")
|
||||
|
||||
set(priv2
|
||||
"nuklear_font.c" "nuklear_input.c" "nuklear_style.c"
|
||||
"nuklear_context.c" "nuklear_pool.c" "nuklear_page_element.c"
|
||||
"nuklear_table.c" "nuklear_panel.c" "nuklear_window.c"
|
||||
"nuklear_popup.c" "nuklear_contextual.c" "nuklear_menu.c"
|
||||
"nuklear_layout.c" "nuklear_tree.c" "nuklear_group.c"
|
||||
"nuklear_list_view.c" "nuklear_widget.c" "nuklear_text.c"
|
||||
"nuklear_image.c" "nuklear_9slice.c" "nuklear_button.c"
|
||||
"nuklear_toggle.c" "nuklear_selectable.c" "nuklear_slider.c"
|
||||
"nuklear_progress.c" "nuklear_scrollbar.c" "nuklear_text_editor.c"
|
||||
"nuklear_edit.c" "nuklear_property.c" "nuklear_chart.c"
|
||||
"nuklear_color_picker.c" "nuklear_combo.c" "nuklear_tooltip.c")
|
||||
source_group("Private [2] Files" FILES "${priv2}")
|
||||
|
||||
|
||||
if (NOT BUILD_HEADER_ONLY)
|
||||
add_library("${LIBRARY_NAME}" "${pub}" "${priv1}" "${extern}" "${priv2}")
|
||||
|
||||
target_link_libraries("${LIBRARY_NAME}" PRIVATE "${PROJECT_NAME}_compiler_flags")
|
||||
|
||||
#include(GenerateExportHeader)
|
||||
#set(_export_file "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h")
|
||||
#generate_export_header("${LIBRARY_NAME}" EXPORT_FILE_NAME "${_export_file}")
|
||||
|
||||
target_include_directories(
|
||||
"${LIBRARY_NAME}"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
#"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
|
||||
# setup the version numbering
|
||||
set_property(TARGET "${LIBRARY_NAME}" PROPERTY VERSION "${${PROJECT_NAME}_VERSION}")
|
||||
set_property(TARGET "${LIBRARY_NAME}" PROPERTY SOVERSION "${${PROJECT_NAME}_VERSION_MAJOR}")
|
||||
endif (NOT BUILD_HEADER_ONLY)
|
||||
|
||||
#============================#
|
||||
# Amalgamation (header-only) #
|
||||
#============================#
|
||||
|
||||
function (omit_includes new_file_contents file_contents blacklist)
|
||||
set(_new_file_contents "${file_contents}")
|
||||
foreach (omit ${blacklist})
|
||||
string(REPLACE "#include \"${omit}\"" "" _new_file_contents "${_new_file_contents}")
|
||||
string(REPLACE "#include <${omit}>" "" _new_file_contents "${_new_file_contents}")
|
||||
endforeach (omit ${blacklist})
|
||||
set(${new_file_contents} "${_new_file_contents}" PARENT_SCOPE)
|
||||
endfunction (omit_includes new_file_contents file_contents blacklist)
|
||||
|
||||
function (fix_comments new_contents contents)
|
||||
string(REGEX REPLACE "//(.*)" "/*1 */" _contents "${contents}")
|
||||
set(${new_contents} "${_contents}" PARENT_SCOPE)
|
||||
endfunction (fix_comments new_contents contents)
|
||||
|
||||
if (BUILD_HEADER_ONLY)
|
||||
set(macro "NK")
|
||||
|
||||
set(intro "HEADER")
|
||||
|
||||
set(outro "LICENSE" "CHANGELOG" "CREDITS")
|
||||
|
||||
set(intro_contents "")
|
||||
foreach (filename ${intro})
|
||||
file(READ "${filename}" file_contents)
|
||||
set(intro_contents "${file_contents}")
|
||||
endforeach (filename ${intro})
|
||||
|
||||
set(pub_contents "")
|
||||
foreach (filename ${pub})
|
||||
file(READ "${filename}" file_contents)
|
||||
set(pub_contents "${file_contents}")
|
||||
endforeach (filename ${pub})
|
||||
|
||||
set(priv_blacklist ${pub} ${priv1} ${priv2} ${extern})
|
||||
|
||||
set(amalgam_contents "")
|
||||
foreach (filename ${priv1})
|
||||
file(READ "${filename}" file_contents)
|
||||
omit_includes(new_file_contents
|
||||
"\n${file_contents}"
|
||||
"${priv_blacklist}")
|
||||
string(APPEND amalgam_contents "${new_file_contents}")
|
||||
endforeach (filename ${priv1})
|
||||
|
||||
foreach (filename ${extern})
|
||||
file(READ "${filename}" file_contents)
|
||||
fix_comments(new_file_contents "${file_contents}")
|
||||
string(APPEND amalgam_contents "${new_file_contents}")
|
||||
endforeach (filename ${extern})
|
||||
|
||||
foreach (filename ${priv2})
|
||||
file(READ "${filename}" file_contents)
|
||||
omit_includes(new_file_contents
|
||||
"${file_contents}"
|
||||
"${priv_blacklist}")
|
||||
string(APPEND amalgam_contents "${new_file_contents}")
|
||||
endforeach (filename ${priv2})
|
||||
|
||||
set(outro_contents "")
|
||||
foreach (filename ${outro})
|
||||
file(READ "${filename}" file_contents)
|
||||
string(APPEND outro_contents "${file_contents}")
|
||||
endforeach (filename ${outro})
|
||||
|
||||
set(macro "NK")
|
||||
|
||||
set(Header_Files "${CMAKE_SOURCE_DIR}/nuklear.h")
|
||||
file(WRITE "${Header_Files}"
|
||||
"/*\n"
|
||||
"${intro_contents}"
|
||||
"*/\n"
|
||||
"#ifndef ${macro}_SINGLE_HEADER\n"
|
||||
" #define ${macro}_SINGLE_HEADER\n"
|
||||
"#endif\n\n"
|
||||
"${pub_contents}"
|
||||
#"#endif /* ${macro}_SINGLE_HEADER */\n\n"
|
||||
|
||||
"#ifdef ${macro}_IMPLEMENTATION\n"
|
||||
"${amalgam_contents}"
|
||||
"#endif /* ${macro}_IMPLEMENTATION */\n"
|
||||
|
||||
"/*\n"
|
||||
"${outro_contents}"
|
||||
"*/\n\n")
|
||||
source_group("Header Files" FILES "${Header_Files}")
|
||||
|
||||
add_library("${LIBRARY_NAME}" INTERFACE "${Header_Files}")
|
||||
|
||||
target_link_libraries("${LIBRARY_NAME}" INTERFACE "${PROJECT_NAME}_compiler_flags")
|
||||
endif (BUILD_HEADER_ONLY)
|
||||
|
||||
#====================#
|
||||
# Package to install #
|
||||
#====================#
|
||||
|
||||
install(FILES ${Header_Files}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBRARY_NAME}")
|
||||
|
||||
set(installable_libs "${LIBRARY_NAME}" "${PROJECT_NAME}_compiler_flags")
|
||||
if (TARGET "${DEPENDANT_LIBRARY}")
|
||||
list(APPEND installable_libs "${DEPENDANT_LIBRARY}")
|
||||
endif ()
|
||||
install(TARGETS ${installable_libs}
|
||||
EXPORT "${LIBRARY_NAME}Targets"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
install(EXPORT "${LIBRARY_NAME}Targets" DESTINATION "${CMAKE_INSTALL_DATADIR}/${LIBRARY_NAME}")
|
12
vcpkg.json
Normal file
12
vcpkg.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "nuklear",
|
||||
"version-string": "0.0.1",
|
||||
"port-version": 1,
|
||||
"homepage": "https://github.com/Immediate-Mode-UI/Nuklear",
|
||||
"description": "Minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain.",
|
||||
"dependencies": [
|
||||
"allegro5",
|
||||
"glfw3",
|
||||
"glew"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user