WIP context API
This commit is contained in:
@@ -3,6 +3,16 @@ set(CMAKE_CXX_STANDARD 11)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||||
|
MESSAGE( "64 bits compiler detected" )
|
||||||
|
SET( EX_PLATFORM 64 )
|
||||||
|
SET( EX_PLATFORM_NAME "x64" )
|
||||||
|
else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||||
|
MESSAGE( "32 bits compiler detected" )
|
||||||
|
SET( EX_PLATFORM 32 )
|
||||||
|
SET( EX_PLATFORM_NAME "x86" )
|
||||||
|
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
set(CMAKE_CXX_COMPILER "clang++")
|
set(CMAKE_CXX_COMPILER "clang++")
|
||||||
endif()
|
endif()
|
||||||
@@ -73,36 +83,35 @@ add_public_header(hydra/include/vector3.h)
|
|||||||
add_public_header(hydra/include/vector4.h)
|
add_public_header(hydra/include/vector4.h)
|
||||||
add_public_header(hydra/include/vector2i.h)
|
add_public_header(hydra/include/vector2i.h)
|
||||||
|
|
||||||
add_library(kraken SHARED ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
|
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS ON) # only find static libs
|
set(Boost_USE_STATIC_LIBS ON) # only find static libs
|
||||||
set(Boost_USE_MULTITHREADED ON)
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
find_package(Boost 1.54.0)
|
find_package(Boost 1.54.0)
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
target_link_libraries(kraken ${Boost_LIBRARIES})
|
list (APPEND EXTRA_LIBS "${Boost_LIBRARIES}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ---- Hydra ----
|
# ---- Hydra ----
|
||||||
add_subdirectory(hydra)
|
add_subdirectory(hydra)
|
||||||
include_directories(hydra/include)
|
include_directories(hydra/include)
|
||||||
target_link_libraries(kraken hydra)
|
list (APPEND EXTRA_LIBS hydra)
|
||||||
|
|
||||||
# ---- Vulkan ----
|
# ---- Vulkan ----
|
||||||
find_package(Vulkan REQUIRED)
|
find_package(Vulkan REQUIRED)
|
||||||
target_link_libraries(kraken Vulkan::Vulkan)
|
target_link_libraries(krakenstatic )
|
||||||
|
list (APPEND EXTRA_LIBS Vulkan::Vulkan)
|
||||||
|
|
||||||
# ---- OpenGL ----
|
# ---- OpenGL ----
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
include_directories( ${OPENGL_INCLUDE_DIRS} )
|
include_directories( ${OPENGL_INCLUDE_DIRS} )
|
||||||
target_link_libraries(kraken ${OPENGL_LIBRARIES})
|
list (APPEND EXTRA_LIBS "${OPENGL_LIBRARIES}")
|
||||||
|
|
||||||
# ---- GLAD ----
|
# ---- GLAD ----
|
||||||
set(GLAD_EXTENSIONS "GL_EXT_texture_filter_anisotropic,GL_EXT_texture_compression_s3tc, GL_S3_s3tc" CACHE STRING "Gl exts" FORCE)
|
set(GLAD_EXTENSIONS "GL_EXT_texture_filter_anisotropic,GL_EXT_texture_compression_s3tc, GL_S3_s3tc" CACHE STRING "Gl exts" FORCE)
|
||||||
add_subdirectory(3rdparty/glad)
|
add_subdirectory(3rdparty/glad)
|
||||||
include_directories(${GLAD_INCLUDE_DIRS})
|
include_directories(${GLAD_INCLUDE_DIRS})
|
||||||
target_link_libraries(kraken glad)
|
list (APPEND EXTRA_LIBS "glad")
|
||||||
|
|
||||||
# ---- GLFW ----
|
# ---- GLFW ----
|
||||||
set(GLFW_BUILD_EXAMPLES OFF CACHE INTERNAL "Build the GLFW example programs")
|
set(GLFW_BUILD_EXAMPLES OFF CACHE INTERNAL "Build the GLFW example programs")
|
||||||
@@ -111,11 +120,13 @@ set(GLFW_BUILD_DOCS OFF CACHE INTERNAL "Build the GLFW documentation")
|
|||||||
set(GLFW_INSTALL OFF CACHE INTERNAL "Generate installation target")
|
set(GLFW_INSTALL OFF CACHE INTERNAL "Generate installation target")
|
||||||
add_subdirectory(3rdparty/glfw)
|
add_subdirectory(3rdparty/glfw)
|
||||||
include_directories(3rdparty/glfw/include)
|
include_directories(3rdparty/glfw/include)
|
||||||
target_link_libraries(kraken glfw ${GLFW_LIBRARIES})
|
list (APPEND EXTRA_LIBS "${GLFW_LIBRARIES}")
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES( kraken ${EXTRA_LIBS} )
|
|
||||||
|
add_library(krakendynamic MODULE ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
|
||||||
|
TARGET_LINK_LIBRARIES( krakendynamic ${EXTRA_LIBS} )
|
||||||
SET_TARGET_PROPERTIES(
|
SET_TARGET_PROPERTIES(
|
||||||
kraken
|
krakendynamic
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
FRAMEWORK ON
|
FRAMEWORK ON
|
||||||
SOVERSION 0
|
SOVERSION 0
|
||||||
@@ -127,19 +138,29 @@ PROPERTIES
|
|||||||
OUTPUT_NAME kraken
|
OUTPUT_NAME kraken
|
||||||
)
|
)
|
||||||
|
|
||||||
# install(TARGETS kraken DESTINATION ${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX})
|
add_library(krakenstatic STATIC ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
|
||||||
# install(FILES ${KRAKEN_PUBLIC_HEADERS} DESTINATION ${PROJECT_BINARY_DIR}/include)
|
TARGET_LINK_LIBRARIES( krakenstatic ${EXTRA_LIBS} )
|
||||||
|
SET_TARGET_PROPERTIES(
|
||||||
# INSTALL(TARGETS kraken
|
krakenstatic
|
||||||
# LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
PROPERTIES
|
||||||
# ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
LIBRARY_OUTPUT_DIRECTORY "lib${LIB_SUFFIX}"
|
||||||
# PUBLIC_HEADER DESTINATION "include"
|
OUTPUT_NAME kraken
|
||||||
# )
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# add_custom_target(package
|
# add_custom_target(package
|
||||||
# COMMENT "Compressing..."
|
# COMMENT "Compressing..."
|
||||||
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive"
|
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/archive"
|
||||||
# COMMAND ${CMAKE_COMMAND} -E tar "cfvz" "kraken.tgz" "*"
|
# COMMAND ${CMAKE_COMMAND} -E tar "cfvz" "kraken.tgz" "*"
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
install(TARGETS krakenstatic krakendynamic
|
||||||
|
RUNTIME DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/export/${CMAKE_BUILD_TYPE}/bin${EX_PLATFORM}
|
||||||
|
PUBLIC_HEADER DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/export/include
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/export/${CMAKE_BUILD_TYPE}/lib${EX_PLATFORM}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/export/${CMAKE_BUILD_TYPE}/lib${EX_PLATFORM}
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
install (FILES $<TARGET_PDB_FILE:krakendynamic>
|
||||||
|
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/export/lib${EX_PLATFORM})
|
||||||
|
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
add_public_header(kraken.h)
|
add_public_header(kraken.h)
|
||||||
|
add_public_header(context.h)
|
||||||
set(KRAKEN_PUBLIC_HEADERS "${KRAKEN_PUBLIC_HEADERS}" PARENT_SCOPE)
|
set(KRAKEN_PUBLIC_HEADERS "${KRAKEN_PUBLIC_HEADERS}" PARENT_SCOPE)
|
||||||
|
|||||||
47
kraken/public/context.h
Normal file
47
kraken/public/context.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// Kraken
|
||||||
|
//
|
||||||
|
// Copyright 2018 Kearwood Gilbert. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef KRAKEN_CONTEXT_H
|
||||||
|
#define KRAKEN_CONTEXT_H
|
||||||
|
|
||||||
|
namespace kraken {
|
||||||
|
|
||||||
|
class Context
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Context();
|
||||||
|
~Context();
|
||||||
|
};
|
||||||
|
|
||||||
|
Context* GetContext();
|
||||||
|
|
||||||
|
} // namepsace kraken
|
||||||
|
|
||||||
|
#endif // KRAKEN_CONTEXT_H
|
||||||
@@ -31,5 +31,6 @@
|
|||||||
#ifndef KRAKEN_H
|
#ifndef KRAKEN_H
|
||||||
#define KRAKEN_H
|
#define KRAKEN_H
|
||||||
|
|
||||||
|
#include "context.h"
|
||||||
|
|
||||||
#endif // KRAKEN_H
|
#endif // KRAKEN_H
|
||||||
|
|||||||
Reference in New Issue
Block a user