opengl added to engine

This commit is contained in:
herbglitch 2023-03-10 17:34:22 -07:00
parent d8378484a7
commit 706a519452
31 changed files with 490 additions and 68 deletions

View file

@ -11,7 +11,10 @@ endfunction()
option(ARCHEUS_STD_DEBUG "Build in debug mode" ON)
option(ARCHEUS_STD_DEFAULT_CONFIG "Build with default config keys" ON)
option(ARCHEUS_STD_SDL "Build with SDL" ON)
option(ARCHEUS_STD_SDL "Build with SDL" OFF)
option(ARCHEUS_STD_GLFW "Build with GLFW window" OFF)
option(ARCHEUS_STD_GLEW "Build with GLEW" OFF)
option(ARCHEUS_STD_OPENGL "Build with OpenGL" OFF)
set(ARCHEUS_STD_FLAGS "")
@ -30,6 +33,18 @@ if(ARCHEUS_STD_SDL)
string(APPEND ARCHEUS_STD_FLAGS "-DARC_SDL ")
endif()
if(ARCHEUS_STD_GLFW)
string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLFW ")
endif()
if(ARCHEUS_STD_GLEW)
string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLEW ")
endif()
if(ARCHEUS_STD_OPENGL)
string(APPEND ARCHEUS_STD_FLAGS "-DARC_OPENGL")
endif()
set(CMAKE_C_FLAGS ${ARCHEUS_STD_FLAGS})
set(ARCHEUS_STD_SOURCES
@ -63,21 +78,53 @@ set(ARCHEUS_STD_SDL_SOURCES
src/graphics/sdl/window.c
)
set(ARCHEUS_STD_OPENGL_SOURCES
src/graphics/opengl/config.c
src/graphics/opengl/line.c
src/graphics/opengl/rectangle.c
src/graphics/opengl/renderer.c
src/graphics/opengl/sprite.c
src/graphics/opengl/spritesheet.c
src/graphics/opengl/window.c
)
set(ARCHEUS_STD_GLFW_SOURCES
src/input/glfw/keyboard.c
src/input/glfw/mouse.c
)
if(ARCHEUS_STD_SDL)
list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_SDL_SOURCES})
endif()
if(ARCHEUS_STD_OPENGL)
list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_OPENGL_SOURCES})
endif()
if(ARCHEUS_STD_GLFW)
list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_GLFW_SOURCES})
endif()
add_library(archeus_std SHARED
${ARCHEUS_STD_SOURCES}
${ARCHEUS_STD_SDL_SOURCES}
)
# target_sources(archeus_std PRIVATE
# ${ARCHEUS_STD_SOURCES}
# ${ARCHEUS_STD_SDL_SOURCES}
# )
if(ARCHEUS_STD_SDL)
target_include_directories(archeus_std PRIVATE
include
PUBLIC ${SDL2_INCLUDE_DIRS}
PUBLIC ${SDL2IMAGE_INCLUDE_DIRS}
)
endif()
target_include_directories(archeus_std PRIVATE
include
PUBLIC ${SDL2_INCLUDE_DIRS}
PUBLIC ${SDL2IMAGE_INCLUDE_DIRS}
)
if(ARCHEUS_STD_OPENGL)
target_include_directories(archeus_std PRIVATE
include
GL
glfw
GLEW
)
endif()
install(TARGETS archeus_std EXPORT archeus_std_Exports
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}