Compare commits
No commits in common. "d8d67d515e62e10bc3f5ccc786b1f7c89600f3a4" and "35f2bfe9e11519745190ee6d2f1bc7883d2d8d11" have entirely different histories.
d8d67d515e
...
35f2bfe9e1
3 changed files with 34 additions and 27 deletions
|
|
@ -54,27 +54,18 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
|||
set(LINKER_OPTIMIZED_OPTIONS ${LINKER_OPTIMIZED_OPTIONS} -fdevirtualize-at-ltrans)
|
||||
endif ()
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC)
|
||||
target_sources(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
add_library(${PROJECT_NAME} STATIC
|
||||
src/window.cpp
|
||||
src/context_window.cpp
|
||||
src/opengl_context.cpp
|
||||
|
||||
PUBLIC
|
||||
FILE_SET public_headers
|
||||
TYPE HEADERS
|
||||
BASE_DIRS include/
|
||||
FILES
|
||||
include/opengl_context.hpp
|
||||
include/window.hpp
|
||||
include/context_window.hpp
|
||||
include/basic_data.hpp
|
||||
)
|
||||
target_precompile_headers(${PROJECT_NAME} PUBLIC include/window.hpp include/basic_data.hpp include/context_window.hpp)
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PUBLIC GLFW_INCLUDE_NONE
|
||||
PRIVATE $<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:GNU>>:_GLIBCXX_DEBUG>
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
INTERFACE $<INSTALL_INTERFACE:include/windowGlfwGlLib>
|
||||
)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC GLFW_INCLUDE_NONE PRIVATE $<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:GNU>>:_GLIBCXX_DEBUG>)
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC ${COMPILE_FLAGS} $<$<CONFIG:Release>:${COMPILE_OPTIMIZED_FLAGS}>)
|
||||
target_link_options(${PROJECT_NAME} PUBLIC ${LINKER_OPTIONS} $<$<CONFIG:Release>:${LINKER_OPTIMIZED_OPTIONS}>)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC $<$<CONFIG:Release>:PkgConfig::Jemalloc> OpenGL::GL GLEW::GLEW glfw)
|
||||
|
|
@ -91,8 +82,8 @@ install(TARGETS ${PROJECT_NAME}
|
|||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
INCLUDES DESTINATION include
|
||||
FILE_SET public_headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/windowGlfwGlLib"
|
||||
INCLUDES DESTINATION include/windowGlfwGlLib
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/windowGlfwGlLibTargets"
|
||||
)
|
||||
|
||||
install(EXPORT windowGlfwGlLibTargets
|
||||
|
|
@ -106,6 +97,14 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
|
|||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/windowGlfwGlLibTargets
|
||||
)
|
||||
|
||||
install(FILES
|
||||
include/window.hpp
|
||||
include/basic_data.hpp
|
||||
include/context_window.hpp
|
||||
include/opengl_context.hpp
|
||||
DESTINATION include/windowGlfwGlLib
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/windowGlfwGlLibTargetsConfig.cmake"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/windowGlfwGlLibTargets
|
||||
|
|
|
|||
|
|
@ -11,17 +11,9 @@ namespace window {
|
|||
public:
|
||||
ContextWindow() noexcept = delete;
|
||||
|
||||
explicit ContextWindow(const GLFWerrorfun error_clbk) noexcept {
|
||||
glfwSetErrorCallback(error_clbk);
|
||||
if (glfwInit() == GLFW_FALSE) {
|
||||
init = false;
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
explicit ContextWindow(const GLFWerrorfun error_clbk) noexcept;
|
||||
|
||||
~ContextWindow() noexcept {
|
||||
glfwTerminate();
|
||||
}
|
||||
~ContextWindow() noexcept;
|
||||
|
||||
[[nodiscard]] inline bool is_init() const { return init; }
|
||||
};
|
||||
|
|
|
|||
16
src/context_window.cpp
Normal file
16
src/context_window.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include "context_window.hpp"
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace window {
|
||||
ContextWindow::~ContextWindow() noexcept {
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
ContextWindow::ContextWindow(const GLFWerrorfun error_clbk) noexcept {
|
||||
glfwSetErrorCallback(error_clbk);
|
||||
if (glfwInit() == GLFW_FALSE) {
|
||||
init = false;
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
} // window
|
||||
Loading…
Add table
Add a link
Reference in a new issue