-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [source/common] Now using complete header path. * [source/common] Now using "common/" prefix for includes. * [source/server] Now using complete header path. * [source/client] Now using complete header path. * [CMake] No longer using globbing to get source file list. * [cmake/om_target] Removed message. * [CMake] Moved compiler flags to a dedicated file. * [cmake/compiler_flags] Removed define GK_DEBUG. * [external] No longer using my forks for some libraries. * [tests/CMakeLists.txt] Removed warning. * [external/SDL2] No longer print lots of messages. * [external/CMakeLists.txt] Refactored. * [docs/Doxyfile] Removed. * [Notes] Removed.
- Loading branch information
Showing
373 changed files
with
1,829 additions
and
4,044 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
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 @@ | ||
#------------------------------------------------------------------------------ | ||
# Compiler flags | ||
#------------------------------------------------------------------------------ | ||
set(DEBUG_GCC_FLAGS | ||
-g -Og | ||
-Wall -Wextra -Wconversion -Wno-unused-parameter | ||
-Wfatal-errors | ||
-DOM_DEBUG | ||
-DOM_PROFILER_ENABLED | ||
) | ||
|
||
set(RELEASE_GCC_FLAGS | ||
-O3 | ||
-Wall -Wextra -Wconversion -Wno-unused-parameter | ||
-Wfatal-errors | ||
) | ||
|
||
set(RELWITHDEB_GCC_FLAGS | ||
-g -O3 | ||
-Wall -Wextra -Wconversion -Wno-unused-parameter | ||
-Wfatal-errors | ||
) | ||
|
||
#------------------------------------------------------------------------------ | ||
# Platform-specific flags | ||
#------------------------------------------------------------------------------ | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
set(CLANG_FLAGS | ||
-Wno-sign-conversion | ||
-Wno-implicit-int-float-conversion | ||
-Wno-nested-anon-types | ||
) | ||
elseif (MSVC) | ||
# Disable iterator debug, improves performance of debug builds | ||
add_compile_definitions($<$<CONFIG:Debug>:_ITERATOR_DEBUG_LEVEL=0>) | ||
endif() | ||
|
||
#------------------------------------------------------------------------------ | ||
# Additional setup | ||
#------------------------------------------------------------------------------ | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
include_directories(external) |
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,21 @@ | ||
# From https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html | ||
function(update_git_submodules) | ||
find_package(Git QUIET) | ||
|
||
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") | ||
if(GIT_SUBMODULE) | ||
message(STATUS "Git submodule update") | ||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule sync -q --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
RESULT_VARIABLE GIT_SUBMOD_RESULT) | ||
if(NOT GIT_SUBMOD_RESULT EQUAL "0") | ||
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/zlib/CMakeLists.txt") | ||
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") | ||
endif() | ||
endfunction() |
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 @@ | ||
function(om_setup_target PROJECT_NAME) | ||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) | ||
|
||
# FIXME: Use target_include_directories(PUBLIC ...) in zlib/lua | ||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/external/entt/src) | ||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/external/zlib ${CMAKE_CURRENT_BINARY_DIR}/external/zlib) | ||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/external/lua/src) | ||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/external/FastNoiseLite) | ||
|
||
if (NOT MSVC) | ||
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:DEBUG>:${DEBUG_GCC_FLAGS}>") | ||
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${RELEASE_GCC_FLAGS}>") | ||
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${RELWITHDEB_GCC_FLAGS}>") | ||
target_compile_options(${PROJECT_NAME} PUBLIC ${CLANG_FLAGS}) | ||
endif () | ||
|
||
target_compile_options(${PROJECT_NAME} PUBLIC -D_USE_MATH_DEFINES) | ||
target_compile_options(${PROJECT_NAME} PUBLIC -DSOL_CHECK_ARGUMENTS -DSOL_PRINT_ERRORS=0) | ||
|
||
# target_compile_options(${PROJECT_NAME} PRIVATE -pg) | ||
endfunction() | ||
|
||
function(om_add_library PROJECT_NAME HEADER_FILES SOURCE_FILES) | ||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${HEADER_FILES}) | ||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCE_FILES}) | ||
|
||
add_library(${PROJECT_NAME} STATIC ${HEADER_FILES} ${SOURCE_FILES}) | ||
|
||
om_setup_target(${PROJECT_NAME}) | ||
endfunction() | ||
|
||
function(om_add_executable PROJECT_NAME HEADER_FILES SOURCE_FILES) | ||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${HEADER_FILES}) | ||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCE_FILES}) | ||
|
||
add_executable(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES}) | ||
|
||
om_setup_target(${PROJECT_NAME}) | ||
|
||
if(MINGW) | ||
target_link_options(${PROJECT_NAME} PRIVATE -static-libstdc++ -static-libgcc -mconsole) | ||
endif() | ||
endfunction() |
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,5 @@ | ||
function(message) | ||
if (NOT MESSAGE_QUIET) | ||
_message(${ARGN}) | ||
endif() | ||
endfunction() |
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
Oops, something went wrong.