simplify cmake file
This commit is contained in:
@ -15,7 +15,33 @@ message("-- CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
|||||||
message("-- CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
message("-- CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
message("-- CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
|
message("-- CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
|
||||||
|
# Libraries
|
||||||
find_package(raylib REQUIRED)
|
find_package(raylib REQUIRED)
|
||||||
|
set(LIBS raylib)
|
||||||
|
set(FLAGS "")
|
||||||
|
|
||||||
|
if(NOT DEFINED DISABLE_BACKWARD)
|
||||||
|
find_package(Backward REQUIRED)
|
||||||
|
|
||||||
|
list(APPEND LIBS Backward::Backward)
|
||||||
|
list(APPEND FLAGS BACKWARD)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED DISABLE_TRACY)
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(tracy
|
||||||
|
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
|
||||||
|
GIT_TAG v0.11.1
|
||||||
|
GIT_SHALLOW TRUE
|
||||||
|
GIT_PROGRESS TRUE
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(tracy)
|
||||||
|
option(TRACY_ENABLE "" ON)
|
||||||
|
option(TRACY_ON_DEMAND "" ON)
|
||||||
|
|
||||||
|
list(APPEND LIBS TracyClient)
|
||||||
|
list(APPEND FLAGS TRACY)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Headers + Sources
|
# Headers + Sources
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
@ -36,38 +62,9 @@ set(SOURCES
|
|||||||
|
|
||||||
# Main target
|
# Main target
|
||||||
add_executable(masssprings ${SOURCES})
|
add_executable(masssprings ${SOURCES})
|
||||||
target_include_directories(masssprings PUBLIC ${RAYLIB_CPP_INCLUDE_DIR})
|
target_include_directories(masssprings PRIVATE ${RAYLIB_CPP_INCLUDE_DIR})
|
||||||
if(NOT DEFINED DISABLE_BACKWARD)
|
target_link_libraries(masssprings PRIVATE ${LIBS})
|
||||||
find_package(Backward REQUIRED)
|
target_compile_definitions(masssprings PRIVATE ${FLAGS})
|
||||||
target_link_libraries(masssprings PUBLIC raylib Backward::Backward)
|
|
||||||
target_compile_definitions(masssprings PUBLIC BACKWARD)
|
|
||||||
else()
|
|
||||||
target_link_libraries(masssprings PUBLIC raylib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Tracy target
|
|
||||||
if(NOT DEFINED DISABLE_TRACY)
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(tracy
|
|
||||||
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
|
|
||||||
GIT_TAG v0.11.1
|
|
||||||
GIT_SHALLOW TRUE
|
|
||||||
GIT_PROGRESS TRUE
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(tracy)
|
|
||||||
option(TRACY_ENABLE "" ON)
|
|
||||||
option(TRACY_ON_DEMAND "" ON)
|
|
||||||
|
|
||||||
add_executable(masssprings_tracy ${SOURCES})
|
|
||||||
target_include_directories(masssprings_tracy PUBLIC ${RAYLIB_CPP_INCLUDE_DIR})
|
|
||||||
target_compile_definitions(masssprings_tracy PRIVATE TRACY)
|
|
||||||
if(NOT DEFINED DISABLE_BACKWARD)
|
|
||||||
target_link_libraries(masssprings_tracy PUBLIC raylib Backward::Backward TracyClient)
|
|
||||||
target_compile_definitions(masssprings_tracy PUBLIC BACKWARD)
|
|
||||||
else()
|
|
||||||
target_link_libraries(masssprings_tracy PUBLIC raylib TracyClient)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# LTO
|
# LTO
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
./cmake-build-release/compile_commands.json
|
./cmake-build-debug/compile_commands.json
|
||||||
@ -295,7 +295,7 @@ rec {
|
|||||||
abbr -a debug-clean "${cmakeDebug} && ${buildDebug} && ./cmake-build-debug/masssprings"
|
abbr -a debug-clean "${cmakeDebug} && ${buildDebug} && ./cmake-build-debug/masssprings"
|
||||||
abbr -a release-clean "${cmakeRelease} && ${buildRelease} && ./cmake-build-release/masssprings"
|
abbr -a release-clean "${cmakeRelease} && ${buildRelease} && ./cmake-build-release/masssprings"
|
||||||
abbr -a rungdb "${buildDebug} && gdb --tui ./cmake-build-debug/masssprings"
|
abbr -a rungdb "${buildDebug} && gdb --tui ./cmake-build-debug/masssprings"
|
||||||
abbr -a runtracy "tracy -a 127.0.0.1 &; ${buildRelease} && sudo -E ./cmake-build-release/masssprings_tracy"
|
abbr -a runtracy "tracy -a 127.0.0.1 &; ${buildRelease} && sudo -E ./cmake-build-release/masssprings"
|
||||||
abbr -a runvalgrind "${buildDebug} && valgrind --leak-check=full --show-reachable=no --show-leak-kinds=definite,indirect,possible --track-origins=no --suppressions=valgrind.supp --log-file=valgrind.log ./cmake-build-debug/masssprings && cat valgrind.log"
|
abbr -a runvalgrind "${buildDebug} && valgrind --leak-check=full --show-reachable=no --show-leak-kinds=definite,indirect,possible --track-origins=no --suppressions=valgrind.supp --log-file=valgrind.log ./cmake-build-debug/masssprings && cat valgrind.log"
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
|
|||||||
Reference in New Issue
Block a user