refactor: split into static libraries and restructure scenes
- Create cbt_opengl static library for OpenGL abstraction - Create cbt_scene static library for base scene class - Create scenes_cube static library for cube scene - Move scene base to cbt/ (utility), scenes to root scenes/ - Link libraries in dependency chain: cuber -> scenes -> cbt_scene -> cbt_opengl
This commit is contained in:
+31
-3
@@ -18,8 +18,8 @@ find_package(glad REQUIRED)
|
||||
find_package(asio REQUIRED)
|
||||
find_package(glm REQUIRED)
|
||||
|
||||
# Target setup
|
||||
add_executable(cuber "cuber.cpp"
|
||||
# OpenGL abstraction library
|
||||
add_library(cbt_opengl STATIC
|
||||
"cbt/opengl/context.cpp"
|
||||
"cbt/opengl/buffer.cpp"
|
||||
"cbt/opengl/texture.cpp"
|
||||
@@ -27,8 +27,36 @@ add_executable(cuber "cuber.cpp"
|
||||
"cbt/opengl/shader.cpp"
|
||||
"cbt/opengl/vao.cpp"
|
||||
)
|
||||
target_include_directories(cbt_opengl PRIVATE ".")
|
||||
target_compile_features(cbt_opengl PRIVATE cxx_std_23)
|
||||
target_compile_options(cbt_opengl PRIVATE ${BASE_OPTIONS})
|
||||
target_compile_definitions(cbt_opengl PRIVATE ${BASE_DEFINITIONS})
|
||||
target_link_libraries(cbt_opengl PUBLIC fmt::fmt glfw::glfw glad::glad)
|
||||
|
||||
# Scene base library
|
||||
add_library(cbt_scene STATIC
|
||||
"cbt/scene.cpp"
|
||||
)
|
||||
target_include_directories(cbt_scene PRIVATE ".")
|
||||
target_compile_features(cbt_scene PRIVATE cxx_std_23)
|
||||
target_compile_options(cbt_scene PRIVATE ${BASE_OPTIONS})
|
||||
target_compile_definitions(cbt_scene PRIVATE ${BASE_DEFINITIONS})
|
||||
target_link_libraries(cbt_scene PUBLIC cbt_opengl)
|
||||
|
||||
# Application scenes
|
||||
add_library(scenes_cube STATIC
|
||||
"scenes/cube.cpp"
|
||||
)
|
||||
target_include_directories(scenes_cube PRIVATE ".")
|
||||
target_compile_features(scenes_cube PRIVATE cxx_std_23)
|
||||
target_compile_options(scenes_cube PRIVATE ${BASE_OPTIONS})
|
||||
target_compile_definitions(scenes_cube PRIVATE ${BASE_DEFINITIONS})
|
||||
target_link_libraries(scenes_cube PUBLIC cbt_scene glm::glm)
|
||||
|
||||
# Main executable
|
||||
add_executable(cuber "cuber.cpp")
|
||||
target_include_directories(cuber PRIVATE ".")
|
||||
target_compile_features(cuber PRIVATE cxx_std_23)
|
||||
target_compile_options(cuber PRIVATE ${BASE_OPTIONS})
|
||||
target_compile_definitions(cuber PRIVATE ${BASE_DEFINITIONS})
|
||||
target_link_libraries(cuber PRIVATE fmt::fmt glfw::glfw glad::glad asio::asio glm::glm ${BASE_LIBRARIES})
|
||||
target_link_libraries(cuber PRIVATE cbt_scene scenes_cube asio::asio ${BASE_LIBRARIES})
|
||||
|
||||
Reference in New Issue
Block a user