-
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.
- Loading branch information
Showing
5 changed files
with
51 additions
and
61 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
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 |
---|---|---|
@@ -1,26 +1,27 @@ | ||
cmake_minimum_required(VERSION 3.15...3.27) | ||
project(Everland LANGUAGES CXX) | ||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | ||
|
||
enable_testing() | ||
|
||
include(AddGoogleTest) | ||
|
||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(SOURCES | ||
${CMAKE_SOURCE_DIR}/src/Application.cpp | ||
${CMAKE_SOURCE_DIR}/src/logic/Game.cpp | ||
${CMAKE_SOURCE_DIR}/src/logic/Player.cpp | ||
${CMAKE_SOURCE_DIR}/src/world/World.cpp | ||
${CMAKE_SOURCE_DIR}/src/world/Generator.cpp | ||
${CMAKE_SOURCE_DIR}/src/world/MeshBuilder.cpp | ||
) | ||
configure_file(${CMAKE_SOURCE_DIR}/resources/shaders/fragment.glsl ${CMAKE_BINARY_DIR}/resources/shaders/fragment.glsl COPYONLY) | ||
configure_file(${CMAKE_SOURCE_DIR}/resources/shaders/vertex.glsl ${CMAKE_BINARY_DIR}/resources/shaders/vertex.glsl COPYONLY) | ||
|
||
add_subdirectory(lib) | ||
add_subdirectory(src) | ||
add_subdirectory(test) | ||
|
||
add_custom_target(run | ||
COMMAND ${CMAKE_BINARY_DIR}/src/Everland.exe | ||
COMMAND Everland | ||
DEPENDS Everland | ||
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR} | ||
) | ||
|
||
enable_testing() | ||
add_custom_target(run_tests | ||
COMMAND EverlandTest | ||
DEPENDS EverlandTest | ||
) |
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,9 @@ | ||
include(FetchContent) | ||
|
||
FetchContent_Declare( | ||
googletest | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG v1.14.0 | ||
) | ||
|
||
FetchContent_MakeAvailable(googletest) |
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 |
---|---|---|
@@ -1,22 +1,27 @@ | ||
add_executable(Everland | ||
main.cpp | ||
${SOURCES} | ||
set(SOURCES | ||
${CMAKE_SOURCE_DIR}/src/Application.cpp | ||
${CMAKE_SOURCE_DIR}/src/logic/Game.cpp | ||
${CMAKE_SOURCE_DIR}/src/logic/Player.cpp | ||
${CMAKE_SOURCE_DIR}/src/world/World.cpp | ||
${CMAKE_SOURCE_DIR}/src/world/Generator.cpp | ||
${CMAKE_SOURCE_DIR}/src/world/MeshBuilder.cpp | ||
) | ||
|
||
target_include_directories(Everland PRIVATE ${CMAKE_SOURCE_DIR}/src) | ||
target_include_directories(Everland SYSTEM PRIVATE | ||
add_library(EverlandLib STATIC ${SOURCES}) | ||
target_link_libraries(EverlandLib PUBLIC fmt raylib raylib_cpp) | ||
|
||
target_include_directories(EverlandLib PUBLIC ${CMAKE_SOURCE_DIR}/src) | ||
target_include_directories(EverlandLib SYSTEM PUBLIC | ||
${CMAKE_SOURCE_DIR}/lib/magic_enum/include | ||
${CMAKE_SOURCE_DIR}/lib/raylib-cpp/include | ||
${CMAKE_SOURCE_DIR}/lib/PerlinNoise | ||
) | ||
|
||
target_link_libraries(Everland PRIVATE fmt raylib raylib_cpp) | ||
|
||
if (MSVC) | ||
target_compile_options(Everland PRIVATE /W4) | ||
target_compile_options(EverlandLib PUBLIC /W4) | ||
else() | ||
target_compile_options(Everland PRIVATE -Wall -Wextra -pedantic) | ||
target_compile_options(EverlandLib PUBLIC -Wall -Wextra -pedantic) | ||
endif() | ||
|
||
configure_file(${CMAKE_SOURCE_DIR}/resources/shaders/fragment.glsl ${CMAKE_BINARY_DIR}/resources/shaders/fragment.glsl COPYONLY) | ||
configure_file(${CMAKE_SOURCE_DIR}/resources/shaders/vertex.glsl ${CMAKE_BINARY_DIR}/resources/shaders/vertex.glsl COPYONLY) | ||
add_executable(Everland main.cpp ${SOURCES}) | ||
target_link_libraries(Everland PUBLIC EverlandLib) |
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 |
---|---|---|
@@ -1,34 +1,12 @@ | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
googletest | ||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip | ||
) | ||
include(GoogleTest) | ||
|
||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable(googletest) | ||
|
||
set(TEST_SOURCES | ||
world/WorldTest.cpp | ||
) | ||
add_executable(EverlandTest | ||
${SOURCES} | ||
${TEST_SOURCES} | ||
) | ||
|
||
target_include_directories(EverlandTest PRIVATE ${CMAKE_SOURCE_DIR}/src) | ||
target_include_directories(EverlandTest SYSTEM PRIVATE | ||
${CMAKE_SOURCE_DIR}/lib/magic_enum/include | ||
${CMAKE_SOURCE_DIR}/lib/raylib-cpp/include | ||
${CMAKE_SOURCE_DIR}/lib/PerlinNoise | ||
) | ||
|
||
target_link_libraries(EverlandTest gtest_main fmt raylib raylib_cpp) | ||
add_executable(EverlandTest ${TEST_SOURCES}) | ||
target_link_libraries(EverlandTest gtest gtest_main EverlandLib) | ||
|
||
gtest_discover_tests(EverlandTest) | ||
|
||
add_custom_target(run_tests | ||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure | ||
DEPENDS EverlandTest Everland | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
include(GoogleTest) | ||
gtest_discover_tests(EverlandTest | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) |