-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cmake building system for a new structure
- Loading branch information
Showing
13 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ imgui* | |
target/* | ||
resources/* | ||
.vscode | ||
|
||
*/build/* | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
|
||
project(radian VERSION 1.0 LANGUAGES CXX) | ||
|
||
file( | ||
GLOB_RECURSE SOURCES CONFIGURE_DEPENDS | ||
"${PROJECT_SOURCE_DIR}/include/*.hpp" | ||
"${PROJECT_SOURCE_DIR}/src/*.cpp" | ||
) | ||
file( | ||
GLOB_RECURSE PUBLIC_HEADERS CONFIGURE_DEPENDS | ||
"${PROJECT_SOURCE_DIR}/include/*.hpp" | ||
) | ||
|
||
configure_file( | ||
"${PROJECT_SOURCE_DIR}/include/radian.hpp.in" | ||
"${PROJECT_SOURCE_DIR}/include/radian.hpp" | ||
) | ||
|
||
add_library(radian SHARED ${SOURCES}) | ||
target_compile_options(radian PUBLIC -Wall -Wextra -pedantic) | ||
target_include_directories(radian PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
set_target_properties(radian PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED TRUE CXX_EXTENSIONS FALSE) | ||
set_target_properties(radian PROPERTIES PUBLIC_HEADER ${PUBLIC_HEADERS}) | ||
|
||
install( | ||
TARGETS radian | ||
LIBRARY DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/lib" | ||
PUBLIC_HEADER DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/include" | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Radian | ||
|
||
```bash | ||
$ sudo apt install libspdlog-dev | ||
``` | ||
|
||
```bash | ||
$ cmake -B build . | ||
$ make -C build | ||
$ ./build/app | ||
``` |
3 changes: 3 additions & 0 deletions
3
new_structure/engine/include/radian.hpp → new_structure/radian/include/radian.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef __RADIAN__ | ||
#define __RADIAN__ | ||
|
||
#define VERSION_MAJOR @radian_VERSION_MAJOR@ | ||
#define VERSION_MINOR @radian_VERSION_MINOR@ | ||
|
||
#include <memory> | ||
#include <exception> | ||
|
||
#include "tools/logger.hpp" | ||
|
||
namespace Radian { | ||
class Exception : public std::exception { | ||
public: | ||
virtual ~Exception() {} | ||
virtual const char* what() const noexcept = 0; | ||
}; | ||
|
||
|
||
class Application { | ||
public: | ||
std::unique_ptr<Tool::Logger> logger; | ||
|
||
Application(); | ||
virtual ~Application(); | ||
virtual void startup() = 0; | ||
virtual void run() = 0; | ||
virtual void shutdown() = 0 ; | ||
}; | ||
|
||
|
||
class Engine { | ||
private: | ||
std::unique_ptr<Application> _app; | ||
|
||
public: | ||
void run(std::unique_ptr<Application>); | ||
}; | ||
|
||
static std::unique_ptr<Radian::Engine> engine = std::make_unique<Radian::Engine>(); | ||
} | ||
|
||
#endif |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
|
||
project(app LANGUAGES CXX) | ||
|
||
file( | ||
GLOB_RECURSE SOURCES CONFIGURE_DEPENDS | ||
"${PROJECT_SOURCE_DIR}/src/*.cpp" | ||
"${PROJECT_SOURCE_DIR}/include/*.hpp" | ||
) | ||
|
||
# TODO: Find a better way to add a main project | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../radian/include) | ||
|
||
add_executable(${CMAKE_PROJECT_NAME} ${SOURCES}) | ||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../radian ${CMAKE_CURRENT_BINARY_DIR}/radian) | ||
target_link_libraries(${CMAKE_PROJECT_NAME} radian) | ||
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC -Wall -Wextra -pedantic) | ||
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED TRUE CXX_EXTENSIONS FALSE) |
File renamed without changes.