Compare commits
2 commits
35f2bfe9e1
...
d8d67d515e
| Author | SHA1 | Date | |
|---|---|---|---|
|
d8d67d515e |
|||
|
1c6e844401 |
3 changed files with 27 additions and 34 deletions
|
|
@ -54,18 +54,27 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
|||
set(LINKER_OPTIMIZED_OPTIONS ${LINKER_OPTIMIZED_OPTIONS} -fdevirtualize-at-ltrans)
|
||||
endif ()
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC
|
||||
add_library(${PROJECT_NAME} STATIC)
|
||||
target_sources(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
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_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_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)
|
||||
|
|
@ -82,8 +91,8 @@ install(TARGETS ${PROJECT_NAME}
|
|||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
INCLUDES DESTINATION include/windowGlfwGlLib
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/windowGlfwGlLibTargets"
|
||||
INCLUDES DESTINATION include
|
||||
FILE_SET public_headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/windowGlfwGlLib"
|
||||
)
|
||||
|
||||
install(EXPORT windowGlfwGlLibTargets
|
||||
|
|
@ -97,14 +106,6 @@ 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,9 +11,17 @@ namespace window {
|
|||
public:
|
||||
ContextWindow() noexcept = delete;
|
||||
|
||||
explicit ContextWindow(const GLFWerrorfun error_clbk) noexcept;
|
||||
explicit ContextWindow(const GLFWerrorfun error_clbk) noexcept {
|
||||
glfwSetErrorCallback(error_clbk);
|
||||
if (glfwInit() == GLFW_FALSE) {
|
||||
init = false;
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
~ContextWindow() noexcept;
|
||||
~ContextWindow() noexcept {
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool is_init() const { return init; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
#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