Commit 8967531d authored by Jostein Bratlie's avatar Jostein Bratlie

Saperation of the interface part of the engine library. Plus minor fixes.

Fixes:
  - minor comment fix
  - removal of unused cmake config file
  - syntactic exception catch bug: gcc, catch polymorphic type by value
parent 9a41cf38
......@@ -51,7 +51,8 @@ SET(MSVC_COMPILE_OPTIONS
)
# Include engine to build
# Include internal libraries to build
add_subdirectory(libs/interface)
add_subdirectory(libs/engine)
# Include qtclient to build
......
......@@ -3,10 +3,6 @@ cmake_minimum_required(VERSION 3.8)
### Setup qtclient project
project(engine VERSION 0.1 LANGUAGES CXX)
# interface part of engine library
SET(IF_PROJECT_NAME ${PROJECT_NAME}_interface)
add_library(${IF_PROJECT_NAME} INTERFACE)
# engine library (build static on Windows MSVC)
if(MSVC)
add_library(${PROJECT_NAME} STATIC)
......@@ -19,32 +15,7 @@ endif()
###########################
# Compiler spesific options
message("Clang compile options: ${CLANG_COMPILE_OPTIONS}")
message("GCC compile options: ${GCC_COMPILE_OPTIONS}")
message("MSVC compile options: ${MSVC_COMPILE_OPTIONS}")
## INTERFACE
# Turn on c++17 compile features -- minimum CMake Version 3.8 required
target_compile_features(${IF_PROJECT_NAME}
INTERFACE $<$<CXX_COMPILER_ID:Clang>:cxx_std_17>
INTERFACE $<$<CXX_COMPILER_ID:GNU>:cxx_std_17>
INTERFACE $<$<CXX_COMPILER_ID:MSVC>:cxx_std_17>
)
# Compile definitions
target_compile_definitions( ${IF_PROJECT_NAME}
INTERFACE $<$<CXX_COMPILER_ID:MSVC>: _USE_MATH_DEFINES>
)
# Comple options
target_compile_options(${IF_PROJECT_NAME}
INTERFACE $<$<CXX_COMPILER_ID:Clang>: ${CLANG_COMPILE_OPTIONS}>
INTERFACE $<$<CXX_COMPILER_ID:GNU>: ${GCC_COMPILE_OPTIONS}>
INTERFACE $<$<CXX_COMPILER_ID:MSVC>: ${MSVC_COMPILE_OPTIONS}>
)
## ENGINE
# Turn on c++17 compile features -- minimum CMake Version 3.8 required
target_compile_features(${PROJECT_NAME}
PUBLIC $<$<CXX_COMPILER_ID:Clang>:cxx_std_17>
......@@ -69,6 +40,9 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF)
### Include the engine interface library
target_link_libraries( ${PROJECT_NAME} PUBLIC engine_interface::engine_interface)
############################
# Target sources and friends
......@@ -88,8 +62,6 @@ target_sources( ${PROJECT_NAME} PRIVATE
##################################
# Export targets and configuration
export( TARGETS ${PROJECT_NAME}
......
include(CMakeFindDependencyMacro)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
message(STATUS "Found @PROJECT_NAME@")
......@@ -4,8 +4,8 @@
#include "utility.h"
// engine interface
#include "interface/basic_types.h"
#include "interface/gameengine_interface.h"
#include <engine/interface/basic_types.h>
#include <engine/interface/gameengine_interface.h>
namespace gameengine
{
......
......@@ -2,7 +2,7 @@
#define ORANGEMONKEY_H
// engine interface
#include "interface/player_interface.h"
#include <engine/interface/player_interface.h>
// stl
#include <random>
......
......@@ -2,7 +2,7 @@
#define UTILITY_H
// engine interface
#include "interface/utility_interface.h"
#include <engine/interface/utility_interface.h>
namespace gameengine::utility
{
......
cmake_minimum_required(VERSION 3.8)
### Setup qtclient project
project(engine_interface VERSION 0.1 LANGUAGES CXX)
# interface part of engine library
add_library(${PROJECT_NAME} INTERFACE)
###########################
# Compiler spesific options
message("Clang compile options: ${CLANG_COMPILE_OPTIONS}")
message("GCC compile options: ${GCC_COMPILE_OPTIONS}")
message("MSVC compile options: ${MSVC_COMPILE_OPTIONS}")
# Turn on c++17 compile features -- minimum CMake Version 3.8 required
target_compile_features(${PROJECT_NAME}
INTERFACE $<$<CXX_COMPILER_ID:Clang>:cxx_std_17>
INTERFACE $<$<CXX_COMPILER_ID:GNU>:cxx_std_17>
INTERFACE $<$<CXX_COMPILER_ID:MSVC>:cxx_std_17>
)
# Compile definitions
target_compile_definitions( ${PROJECT_NAME}
INTERFACE $<$<CXX_COMPILER_ID:MSVC>: _USE_MATH_DEFINES>
)
# Comple options
target_compile_options(${PROJECT_NAME}
INTERFACE $<$<CXX_COMPILER_ID:Clang>: ${CLANG_COMPILE_OPTIONS}>
INTERFACE $<$<CXX_COMPILER_ID:GNU>: ${GCC_COMPILE_OPTIONS}>
INTERFACE $<$<CXX_COMPILER_ID:MSVC>: ${MSVC_COMPILE_OPTIONS}>
)
############################
# Target sources and friends
# Headers
target_include_directories( ${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
)
##################################
# Export targets and configuration
export( TARGETS ${PROJECT_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}-targets.cmake"
)
# Add alias gmlib2::${PROJECT_NAME} to ${PROJECT_NAME} such that we can reference this
# in the same way as for other consumer usages (external library)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
......@@ -38,7 +38,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF)
### Include the engine library
#find_package(engine REQUIRED)
target_link_libraries( ${PROJECT_NAME} PUBLIC engine::engine)
......
......@@ -28,6 +28,6 @@ int main(int argc, char** argv) try {
catch (std::string exception) {
std::cout << "Runtime exception: " << exception << std::endl;
}
catch (std::runtime_error exception) {
catch (const std::runtime_error& exception) {
std::cout << "Runtime exception: " << exception.what() << std::endl;
}
// gtest
#include <benchmark/benchmark.h> // googletest header file
// cc library
// engine
#include <engine/mygameengine.h>
namespace detail
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment