cmake: merge librw_skeleton_imgui in librw_skeleton

This commit is contained in:
Anonymous Maarten 2021-06-22 22:51:20 +02:00
parent 4a88067d68
commit 60588b7192
15 changed files with 124 additions and 120 deletions

View File

@ -51,8 +51,11 @@ if(NOT COMMAND librw_platform_target)
endfunction()
endif()
include(CMakeDependentOption)
option(LIBRW_TOOLS "Build librw tools" ON)
option(LIBRW_INSTALL "Install librw files" OFF)
cmake_dependent_option(LIBRW_EXAMPLES "Build librw examples" ON "NOT LIBRW_PLATFORM_PS2;NOT LIBRW_PLATFORM_NULL" OFF)
if(LIBRW_INSTALL)
include(GNUInstallDirs)
@ -61,11 +64,11 @@ endif()
add_subdirectory(src)
if(LIBRW_TOOLS)
if(NOT LIBRW_PLATFORM_PS2 AND NOT LIBRW_PLATFORM_NULL)
add_subdirectory(skeleton)
endif()
add_subdirectory(tools)
endif()
if(LIBRW_INSTALL)
include(CMakePackageConfigHelpers)

View File

@ -4,39 +4,65 @@ add_library(librw_skeleton
skeleton.cpp
skeleton.h
win.cpp
imgui/imconfig.h
imgui/imgui.cpp
imgui/imgui_demo.cpp
imgui/imgui_draw.cpp
imgui/imgui.h
imgui/imgui_impl_rw.cpp
imgui/imgui_impl_rw.h
imgui/imgui_internal.h
imgui/ImGuizmo.cpp
imgui/ImGuizmo.h
imgui/stb_rect_pack.h
imgui/stb_textedit.h
imgui/stb_truetype.h
)
add_library(librw::skeleton ALIAS librw_skeleton)
set_target_properties(librw_skeleton
PROPERTIES
PREFIX ""
EXPORT_NAME skeleton
)
target_link_libraries(librw_skeleton
PUBLIC
PRIVATE
librw
)
target_include_directories(librw_skeleton
INTERFACE
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
if(NOT LIBRW_PLATFORM_PS2 AND NOT LIBRW_PLATFORM_NULL)
add_subdirectory(imgui)
endif()
if(LIBRW_INSTALL)
target_include_directories(librw_skeleton
INTERFACE
$<INSTALL_INTERFACE:${LIBRW_INSTALL_INCLUDEDIR}/skeleton>
)
if(LIBRW_INSTALL)
install(
FILES
skeleton.h
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/skeleton"
)
install(
FILES
imgui/imconfig.h
imgui/imgui.h
imgui/imgui_impl_rw.h
imgui/imgui_internal.h
imgui/ImGuizmo.h
imgui/stb_textedit.h
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/skeleton/imgui"
)
install(
FILES
imgui/LICENSE_imgui.txt
imgui/LICENSE_imguizmo.txt
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
install(
TARGETS librw_skeleton
EXPORT librw-targets

View File

@ -1,46 +0,0 @@
add_library(librw_skeleton_imgui
imconfig.h
imgui.cpp
imgui_demo.cpp
imgui_draw.cpp
imgui.h
imgui_impl_rw.cpp
imgui_impl_rw.h
imgui_internal.h
ImGuizmo.cpp
ImGuizmo.h
stb_rect_pack.h
stb_textedit.h
stb_truetype.h
)
set_target_properties(librw_skeleton_imgui
PROPERTIES
PREFIX ""
)
target_link_libraries(librw_skeleton_imgui
PUBLIC
librw_skeleton
)
if(LIBRW_INSTALL)
install(
FILES
imconfig.h
imgui.h
imgui_impl_rw.h
imgui_internal.h
ImGuizmo.h
stb_textedit.h
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/skeleton/imgui"
)
install(
TARGETS librw_skeleton_imgui
EXPORT librw-targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()

View File

@ -100,6 +100,7 @@ add_library(librw::librw ALIAS librw)
target_include_directories(librw
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${LIBRW_INSTALL_INCLUDEDIR}>
)
target_compile_definitions(librw
@ -153,7 +154,7 @@ if(LIBRW_PLATFORM_GL3)
find_package(OpenGL REQUIRED)
target_link_libraries(librw
PUBLIC
PRIVATE
OpenGL::GL
)
endif()
@ -171,35 +172,24 @@ if(LIBRW_PLATFORM_GL3)
PUBLIC
SDL2::SDL2
)
if(TARGET SDL2::SDL2main)
target_link_libraries(librw
PUBLIC
SDL2::SDL2main
)
endif()
endif()
if(NINTENDO_SWITCH)
find_package(NXGL REQUIRED)
target_link_libraries(librw
PUBLIC
PRIVATE
NXGL::OpenGL
)
endif()
elseif(LIBRW_PLATFORM_D3D9)
target_link_libraries(librw
PUBLIC
PRIVATE
d3d9
xinput
)
endif()
if(LIBRW_INSTALL)
target_include_directories(librw
INTERFACE
$<INSTALL_INTERFACE:${LIBRW_INSTALL_INCLUDEDIR}>
)
install(
FILES
"${PROJECT_SOURCE_DIR}/args.h"

View File

@ -1,9 +1,10 @@
if(NOT LIBRW_PLATFORM_PS2)
if(LIBRW_TOOLS AND NOT LIBRW_PLATFORM_PS2)
add_subdirectory(dumprwtree)
add_subdirectory(ska2anm)
endif()
if(TARGET librw_skeleton_imgui)
if(LIBRW_EXAMPLES)
if(TARGET librw::skeleton)
add_subdirectory(imguitest)
add_subdirectory(playground)
add_subdirectory(lights)
@ -16,3 +17,4 @@ endif()
if(LIBRW_PLATFORM_PS2)
add_subdirectory(ps2test)
endif()
endif()

View File

@ -1,10 +1,13 @@
add_executable(camera WIN32
main.cpp camexamp.cpp viewer.cpp
main.cpp
camexamp.cpp
viewer.cpp
)
target_link_libraries(camera
PUBLIC
librw librw_skeleton librw_skeleton_imgui
PRIVATE
librw::skeleton
librw::librw
)
add_custom_command(

View File

@ -3,8 +3,8 @@ add_executable(dumprwtree
)
target_link_libraries(dumprwtree
PUBLIC
librw
PRIVATE
librw::librw
)
if(LIBRW_INSTALL)

View File

@ -1,10 +1,17 @@
add_executable(im2d WIN32
im2d.cpp linelist.cpp main.cpp polyline.cpp trifan.cpp trilist.cpp tristrip.cpp
im2d.cpp
linelist.cpp
main.cpp
polyline.cpp
trifan.cpp
trilist.cpp
tristrip.cpp
)
target_link_libraries(im2d
PUBLIC
librw librw_skeleton librw_skeleton_imgui
PRIVATE
librw::skeleton
librw::librw
)
add_custom_command(

View File

@ -1,10 +1,17 @@
add_executable(im3d WIN32
im3d.cpp linelist.cpp main.cpp polyline.cpp trifan.cpp trilist.cpp tristrip.cpp
im3d.cpp
linelist.cpp
main.cpp
polyline.cpp
trifan.cpp
trilist.cpp
tristrip.cpp
)
target_link_libraries(im3d
PUBLIC
librw librw_skeleton librw_skeleton_imgui
PRIVATE
librw::skeleton
librw::librw
)
add_custom_command(

View File

@ -4,8 +4,8 @@ add_executable(imguitest WIN32
target_link_libraries(imguitest
PUBLIC
librw
librw_skeleton_imgui
librw::skeleton
librw::librw
)
if(LIBRW_INSTALL)

View File

@ -1,10 +1,12 @@
add_executable(lights WIN32
main.cpp lights.cpp
main.cpp
lights.cpp
)
target_link_libraries(lights
PUBLIC
librw librw_skeleton librw_skeleton_imgui
PRIVATE
librw::skeleton
librw::librw
)
add_custom_command(

View File

@ -1,10 +1,16 @@
add_executable(playground WIN32
camera.cpp font.cpp main.cpp ras_test.cpp splines.cpp tl_tests.cpp
camera.cpp
font.cpp
main.cpp
ras_test.cpp
splines.cpp
tl_tests.cpp
)
target_link_libraries(playground
PUBLIC
librw librw_skeleton_imgui
PRIVATE
librw::skeleton
librw::librw
)
add_custom_command(

View File

@ -8,18 +8,15 @@ add_executable(ps2test
)
target_link_libraries(ps2test
PUBLIC
librw
PRIVATE
librw::librw
kernel
)
add_erl_executable(PS2TEST_ERL ps2test)
librw_platform_target(ps2test)
if(LIBRW_INSTALL)
install(TARGETS ps2test
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
install(FILES "${PS2TEST_ERL}"
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()

View File

@ -4,7 +4,13 @@ add_executable(ska2anm
target_link_libraries(ska2anm
PUBLIC
librw
librw::librw
)
librw_platform_target(ska2anm)
librw_platform_target(ska2anm INSTALL)
if(LIBRW_INSTALL)
install(TARGETS ska2anm
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()

View File

@ -4,7 +4,8 @@ add_executable(subrast WIN32
target_link_libraries(subrast
PUBLIC
librw librw_skeleton librw_skeleton_imgui
librw::skeleton
librw::librw
)
librw_platform_target(subrast)