Skip to content

Commit

Permalink
[vcpkg.json] Add allegro5 dep; [CMakeLists.txt] Add BUILD_DEMOS o…
Browse files Browse the repository at this point in the history
…ption; [demo/CMakeLists.txt] `add_subdirectory` for each demo (comment out all but `allegro5` for now); [demo/allegro5/CMakeLists.txt] Begin implementing allegro5 demo
  • Loading branch information
SamuelMarks committed May 25, 2022
1 parent ac7e89a commit 2396b67
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ configure_file(
#=============#

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)
Expand Down
29 changes: 29 additions & 0 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 66 additions & 0 deletions demo/allegro5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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"
)
1 change: 1 addition & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"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"
]
Expand Down

0 comments on commit 2396b67

Please sign in to comment.