72 lines
2.3 KiB
CMake
72 lines
2.3 KiB
CMake
set(DP_WARN_FLAGS -Wall -Wextra -Wpedantic)
|
|
|
|
# Source: log.c by rxi (https://github.com/rxi/log.c)
|
|
add_library(logc OBJECT log.c)
|
|
target_compile_features(logc PRIVATE c_std_11)
|
|
if (NOT WIN32)
|
|
target_compile_definitions(logc PRIVATE -DLOG_USE_COLOR)
|
|
endif()
|
|
target_compile_options(logc PUBLIC -fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=. PRIVATE ${DP_WARN_FLAGS})
|
|
|
|
find_package(Threads)
|
|
|
|
# Bit of a hack to set the variables here. If set earlier clang-tidy will for
|
|
# some reason pickup log.c and warn about some va_list stuff. Might be because
|
|
# log.c is in the source directory as the same does not happen with the imgui
|
|
# object library. TODO: move logc to externals.
|
|
find_program(CLANG_TIDY_EXECUTABLE clang-tidy)
|
|
if (CLANG_TIDY_EXECUTABLE)
|
|
set(CMAKE_C_CLANG_TIDY clang-tidy -p ${CMAKE_BINARY_DIR} --extra-arg=-std=c11)
|
|
set(CMAKE_CXX_CLANG_TIDY clang-tidy -p ${CMAKE_BINARY_DIR} --extra-arg=-std=c++17)
|
|
endif()
|
|
|
|
add_library(dp_common dp_common.c)
|
|
target_compile_features(dp_common PRIVATE c_std_11)
|
|
target_compile_options(dp_common PUBLIC ${DP_WARN_FLAGS}) # spread warning flags
|
|
target_link_libraries(dp_common
|
|
PUBLIC logc
|
|
PUBLIC nng
|
|
PUBLIC Threads::Threads
|
|
)
|
|
target_include_directories(dp_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
add_executable(doompanning doompanning.cc doomlib.cc)
|
|
target_compile_features(doompanning PRIVATE cxx_std_17)
|
|
target_link_libraries(doompanning
|
|
PRIVATE dp_common
|
|
PRIVATE imgui
|
|
PRIVATE sdl_nyan
|
|
)
|
|
|
|
add_executable(dp_imgui_demo dp_imgui_demo.cc)
|
|
target_compile_features(dp_imgui_demo PRIVATE cxx_std_17)
|
|
target_link_libraries(dp_imgui_demo
|
|
PRIVATE dp_common
|
|
PRIVATE imgui
|
|
)
|
|
|
|
if (WIN32)
|
|
target_link_libraries(doompanning PRIVATE SDL2::SDL2main)
|
|
target_link_libraries(dp_imgui_demo PRIVATE SDL2::SDL2main)
|
|
endif()
|
|
|
|
add_executable(dp_common_c_test dp_common_c_test.c)
|
|
target_compile_features(dp_common_c_test PRIVATE c_std_11)
|
|
target_link_libraries(dp_common_c_test
|
|
PRIVATE dp_common
|
|
)
|
|
|
|
add_executable(doomsim doomsim.cc)
|
|
target_compile_features(doomsim PRIVATE cxx_std_17)
|
|
target_link_libraries(doomsim
|
|
PRIVATE dp_common
|
|
)
|
|
|
|
unset(CMAKE_C_CLANG_TIDY)
|
|
unset(CMAKE_CXX_CLANG_TIDY)
|
|
|
|
add_subdirectory(dp_doom)
|
|
|
|
FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/dp_doom/external/wildmidi-0.4.5/cfg/wildmidi.cfg
|
|
DESTINATION ${CMAKE_BINARY_DIR}/
|
|
)
|