This commit is contained in:
Pcornat 2024-01-28 21:10:36 +01:00
parent 3e65ac5fe9
commit 88f893555b
Signed by: Pcornat
GPG Key ID: E0326CC678A00BDD

View File

@ -11,73 +11,73 @@ find_package(Boost REQUIRED COMPONENTS stacktrace_addr2line)
include_directories(${Boost_INCLUDE_DIR}) include_directories(${Boost_INCLUDE_DIR})
set(PRECOMPILE_HEADERS set(PRECOMPILE_HEADERS
include/gui/gui.hpp include/gui/gui.hpp
include/gui/gui_data.hpp include/gui/gui_data.hpp
include/gui/window.hpp include/gui/window.hpp
) )
set(SOURCE_HEADERS set(SOURCE_HEADERS
include/imgui/imconfig.h include/imgui/imconfig.h
include/imgui/imgui.h include/imgui/imgui.h
include/imgui/imgui_stdlib.h include/imgui/imgui_stdlib.h
include/imgui/imgui_impl_glfw.h include/imgui/imgui_impl_glfw.h
include/imgui/imgui_impl_opengl3.h include/imgui/imgui_impl_opengl3.h
include/imgui/imgui_impl_opengl3_loader.h include/imgui/imgui_impl_opengl3_loader.h
include/imgui/imgui_internal.h include/imgui/imgui_internal.h
include/imgui/imstb_rectpack.h include/imgui/imstb_rectpack.h
include/imgui/imstb_textedit.h include/imgui/imstb_textedit.h
include/imgui/imstb_truetype.h include/imgui/imstb_truetype.h
include/stb_image.h include/stb_image.h
external/ImFileDialog/ImFileDialog.h external/ImFileDialog/ImFileDialog.h
include/gui/gui.hpp include/gui/gui.hpp
include/gui/gui_data.hpp include/gui/gui_data.hpp
include/gui/window.hpp include/gui/window.hpp
include/character_sheet.hpp include/character_sheet.hpp
include/characteristic/habilete.hpp include/characteristic/habilete.hpp
include/characteristic/adresse.hpp include/characteristic/adresse.hpp
include/characteristic/endurance.hpp include/characteristic/endurance.hpp
include/characteristic/chance.hpp include/characteristic/chance.hpp
include/gui/menu/menu.hpp include/gui/menu/menu.hpp
include/gui/menu/menu_data.hpp include/gui/menu/menu_data.hpp
include/characteristic/characteristic.hpp include/characteristic/characteristic.hpp
include/controller.hpp include/controller.hpp
include/gui_data_interface.hpp include/gui_data_interface.hpp
) )
set(SOURCE_FILES set(SOURCE_FILES
src/imgui/imgui.cpp src/imgui/imgui.cpp
src/imgui/imgui_stdlib.cpp src/imgui/imgui_stdlib.cpp
src/imgui/imgui_draw.cpp src/imgui/imgui_draw.cpp
src/imgui/imgui_impl_glfw.cpp src/imgui/imgui_impl_glfw.cpp
src/imgui/imgui_impl_opengl3.cpp src/imgui/imgui_impl_opengl3.cpp
src/imgui/imgui_tables.cpp src/imgui/imgui_tables.cpp
src/imgui/imgui_widgets.cpp src/imgui/imgui_widgets.cpp
external/ImFileDialog/ImFileDialog.cpp external/ImFileDialog/ImFileDialog.cpp
src/main.cpp src/main.cpp
src/gui/gui.cpp src/gui/gui.cpp
src/gui/gui_data.cpp src/gui/gui_data.cpp
src/gui/window.cpp src/gui/window.cpp
src/character_sheet.cpp src/character_sheet.cpp
src/characteristic/adresse.cpp src/characteristic/adresse.cpp
src/characteristic/endurance.cpp src/characteristic/endurance.cpp
src/characteristic/chance.cpp src/characteristic/chance.cpp
src/gui/menu/menu.cpp src/gui/menu/menu.cpp
src/controller.cpp src/controller.cpp
) )
set(SOURCES set(SOURCES
${SOURCE_HEADERS} ${SOURCE_HEADERS}
${SOURCE_FILES}) ${SOURCE_FILES})
find_program(CCACHE_FOUND ccache) find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND) if (CCACHE_FOUND)
message(STATUS "ccache found !") message(STATUS "ccache found !")
set_property(GLOBAL PROPERTY C_COMPILER_LAUNCHER ccache) set_property(GLOBAL PROPERTY C_COMPILER_LAUNCHER ccache)
set_property(GLOBAL PROPERTY C_LINKER_LAUNCHER ccache) set_property(GLOBAL PROPERTY C_LINKER_LAUNCHER ccache)
set_property(GLOBAL PROPERTY CXX_COMPILER_LAUNCHER ccache) set_property(GLOBAL PROPERTY CXX_COMPILER_LAUNCHER ccache)
set_property(GLOBAL PROPERTY CXX_LINKER_LAUNCHER ccache) set_property(GLOBAL PROPERTY CXX_LINKER_LAUNCHER ccache)
else () else ()
message(STATUS "ccache not found") message(STATUS "ccache not found")
endif () endif ()
option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
@ -107,40 +107,40 @@ add_subdirectory(external/catch2)
set(COMPILE_FLAGS set(COMPILE_FLAGS
-pipe -pipe
-march=znver3 # change to native or your architecture. -march=znver3 # change to native or your architecture.
-mtune=znver3 # same as above -mtune=znver3 # same as above
-mrdseed # be careful about this, this is linked to the x86 architecture. -mrdseed # be careful about this, this is linked to the x86 architecture.
-mrdrnd # same as above -mrdrnd # same as above
-Wall -Wall
-Wextra -Wextra
-Wpedantic -Wpedantic
# -Wpadded # -Wpadded
-pedantic -pedantic
-ffunction-sections -ffunction-sections
-fdata-sections -fdata-sections
-fuse-ld=gold -fuse-ld=gold
-funroll-loops -funroll-loops
-fdevirtualize-at-ltrans -fdevirtualize-at-ltrans
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
) )
set(LINKER_OPTIONS set(LINKER_OPTIONS
-Wl,--sort-common,--as-needed,--gc-sections,--strip-all -Wl,--sort-common,--as-needed,--gc-sections,--strip-all
-fuse-ld=gold -fuse-ld=gold
-fdevirtualize-at-ltrans -fdevirtualize-at-ltrans
) )
set(LINKER_FLAGS set(LINKER_FLAGS
jemalloc jemalloc
) )
option(ENABLE_COVERAGE "Enabling coverage" OFF) option(ENABLE_COVERAGE "Enabling coverage" OFF)
if (${ENABLE_COVERAGE}) if (${ENABLE_COVERAGE})
message(STATUS "Coverage enabled") message(STATUS "Coverage enabled")
list(APPEND COMPILE_FLAGS --coverage) list(APPEND COMPILE_FLAGS --coverage)
list(APPEND LINKER_OPTIONS --coverage) list(APPEND LINKER_OPTIONS --coverage)
list(APPEND LINKER_FLAGS gcov) list(APPEND LINKER_FLAGS gcov)
endif () endif ()
add_subdirectory("Unit testing") add_subdirectory("Unit testing")
@ -150,36 +150,36 @@ add_executable(BillySheet ${SOURCES})
target_include_directories(BillySheet PRIVATE include include/imgui external/ImFileDialog) target_include_directories(BillySheet PRIVATE include include/imgui external/ImFileDialog)
set_target_properties(BillySheet spdlog PROPERTIES set_target_properties(BillySheet spdlog PROPERTIES
CXX_STANDARD 17 CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
INTERPROCEDURAL_OPTIMIZATION ON INTERPROCEDURAL_OPTIMIZATION ON
# UNITY_BUILD ON # UNITY_BUILD ON
) )
set_target_properties(spdlog PROPERTIES UNITY_BUILD ON) set_target_properties(spdlog PROPERTIES UNITY_BUILD ON)
set_target_properties(glfw PROPERTIES set_target_properties(glfw PROPERTIES
C_STANDARD 11 C_STANDARD 11
C_STANDARD_REQUIRED ON C_STANDARD_REQUIRED ON
C_EXTENSIONS OFF C_EXTENSIONS OFF
INTERPROCEDURAL_OPTIMIZATION ON INTERPROCEDURAL_OPTIMIZATION ON
UNITY_BUILD ON UNITY_BUILD ON
) )
set_target_properties(spdlog PROPERTIES UNITY_BUILD ON) set_target_properties(spdlog PROPERTIES UNITY_BUILD ON)
#target_precompile_headers(BillySheet PRIVATE ${PRECOMPILE_HEADERS}) target_precompile_headers(BillySheet PRIVATE ${PRECOMPILE_HEADERS})
target_compile_definitions(BillySheet PRIVATE target_compile_definitions(BillySheet PRIVATE
$<$<CONFIG:Debug>:_GLIBCXX_DEBUG> $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>
$<$<CONFIG:Debug>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG> $<$<CONFIG:Debug>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG>
$<$<CONFIG:Release>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_ERROR>) $<$<CONFIG:Release>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_ERROR>)
target_compile_definitions(spdlog PRIVATE target_compile_definitions(spdlog PRIVATE
$<$<CONFIG:Debug>:_GLIBCXX_DEBUG>) $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
target_compile_definitions(glfw PRIVATE target_compile_definitions(glfw PRIVATE
$<$<CONFIG:Debug>:_GLIBCXX_DEBUG>) $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
target_compile_options(spdlog PRIVATE ${COMPILE_FLAGS}) target_compile_options(spdlog PRIVATE ${COMPILE_FLAGS})
target_compile_options(glfw PRIVATE ${COMPILE_FLAGS}) target_compile_options(glfw PRIVATE ${COMPILE_FLAGS})
@ -191,4 +191,4 @@ target_link_options(BillySheet PRIVATE ${LINKER_OPTIONS})
target_link_libraries(spdlog PRIVATE ${LINKER_FLAGS}) target_link_libraries(spdlog PRIVATE ${LINKER_FLAGS})
target_link_libraries(glfw PRIVATE ${LINKER_FLAGS}) target_link_libraries(glfw PRIVATE ${LINKER_FLAGS})
target_link_libraries(BillySheet glfw spdlog OpenGL::OpenGL GLEW::GLEW nlohmann_json::nlohmann_json ${Boost_LIBRARIES} ${LINKER_FLAGS}) target_link_libraries(BillySheet glfw spdlog::spdlog_header_only OpenGL::OpenGL GLEW::GLEW nlohmann_json::nlohmann_json ${Boost_LIBRARIES} ${LINKER_FLAGS})