Skip to content

Commit 14bea8a

Browse files
committed
integrate pini
1 parent 6407666 commit 14bea8a

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "ext/sfml"]
22
path = ext/sfml
33
url = https://github.com/SFML/SFML
4+
[submodule "ext/pini"]
5+
path = ext/pini
6+
url = https://github.com/cpp-gamedev/pini

CMakeLists.txt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,43 @@ set(BUILD_SHARED_LIBS OFF)
55

66
project(world-clock)
77

8+
add_subdirectory(ext/pini)
89
add_subdirectory(ext/sfml)
910

1011
set(CMAKE_BUILD_TYPE Debug CACHE STRING "")
1112
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
12-
message(STATUS "Exporting compile_commands.json")
13-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
13+
message(STATUS "Exporting compile_commands.json")
14+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1415
endif()
1516

1617
# git
1718
find_package(Git QUIET)
1819
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
19-
message(STATUS "Updating git submodules...")
20-
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
21-
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
22-
RESULT_VARIABLE UPDATE_SUBMODULES_RESULT
23-
)
24-
if(NOT UPDATE_SUBMODULES_RESULT EQUAL "0")
25-
message(FATAL_ERROR "git submodule update failed!")
26-
endif()
20+
message(STATUS "Updating git submodules...")
21+
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
22+
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
23+
RESULT_VARIABLE UPDATE_SUBMODULES_RESULT
24+
)
25+
if(NOT UPDATE_SUBMODULES_RESULT EQUAL "0")
26+
message(FATAL_ERROR "git submodule update failed!")
27+
endif()
2728
endif()
2829

2930
# exe
3031
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "src/*.?pp")
3132
add_executable(${PROJECT_NAME} ${SOURCES})
32-
target_include_directories(${PROJECT_NAME} PRIVATE src)
33-
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-graphics)
33+
target_include_directories(${PROJECT_NAME} PRIVATE src ext/pini)
34+
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-graphics pini::pini)
3435
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
3536

3637
if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
3738
target_compile_options(${PROJECT_NAME} PRIVATE /MP $<$<NOT:$<CONFIG:Debug>>:/WX>)
3839
elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
3940
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra $<$<NOT:$<CONFIG:Debug>>:-Werror>)
4041
endif()
42+
43+
set(CCJSON "${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json")
44+
if(EXISTS "${CCJSON}")
45+
message(STATUS "Copying ${CCJSON} to project root")
46+
file(COPY "${CCJSON}" DESTINATION "${PROJECT_SOURCE_DIR}")
47+
endif()

ext/pini

Submodule pini added at 10e1b34

src/gfx/follow_eye.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <gfx/shape.hpp>
44
#include <maths/maths.hpp>
55

6+
67
namespace misc {
78
sf::Vector2f follow_eye_t::update(sf::Vector2f target) noexcept { return (dir = maths::normalize(target - pos)); }
89
void follow_eye_t::draw(drawer_t& drawer, bool blink) {

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <delta_time.hpp>
66
#include <gfx/follow_eye.hpp>
77
#include <maths/maths.hpp>
8+
#include <pini/pini.hpp>
89
#include <world_clock/gui.hpp>
910
#include <world_clock/io.hpp>
1011

0 commit comments

Comments
 (0)