mirror of
https://github.com/BodbDearg/PsyDoom.git
synced 2024-11-23 05:19:52 +00:00
MSVC: enable multi core compilation
This commit is contained in:
parent
d01e8e0bc1
commit
87dd0bf7a9
@ -31,10 +31,8 @@ set(INCLUDE_PATHS
|
||||
add_library(${BASELIB_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
target_link_libraries(${BASELIB_TGT_NAME}
|
||||
${RAPID_JSON_TGT_NAME}
|
||||
)
|
||||
|
||||
add_psydoom_common_target_compile_options(${BASELIB_TGT_NAME})
|
||||
target_link_libraries(${BASELIB_TGT_NAME} ${RAPID_JSON_TGT_NAME})
|
||||
target_include_directories(${BASELIB_TGT_NAME} PUBLIC ${INCLUDE_PATHS})
|
||||
|
||||
if (COMPILER_MSVC)
|
||||
|
@ -19,9 +19,24 @@ function(setup_source_groups SOURCE_FILES OTHER_FILES)
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
# Add common target compile options for all projects
|
||||
# Add common compile options shared by all targets (both PsyDoom specific and third party).
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
function(add_common_target_compile_options TARGET_NAME)
|
||||
# MSVC: Enable multi-core compilation
|
||||
if (COMPILER_MSVC)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE /MP)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
# Add compile options used by all targets specific to the PsyDoom project.
|
||||
#
|
||||
# Note: this function is NOT called for third party libraries.
|
||||
# For third party code only 'add_common_target_compile_options()' is used.
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
function(add_psydoom_common_target_compile_options TARGET_NAME)
|
||||
add_common_target_compile_options(${TARGET_NAME})
|
||||
|
||||
# Enable a very strict level of warnings
|
||||
if (COMPILER_MSVC)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE /W4) # Enable all warnings
|
||||
|
@ -502,7 +502,7 @@ if (PLATFORM_WINDOWS)
|
||||
set(GENERATED_SOURCE_FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/version.generated.rc"
|
||||
)
|
||||
elseif(PLATFORM_MAC)
|
||||
elseif (PLATFORM_MAC)
|
||||
# macOS
|
||||
list(APPEND SOURCE_FILES
|
||||
"Main_Mac.mm"
|
||||
@ -569,14 +569,11 @@ if (COMPILER_MSVC)
|
||||
target_compile_options(${GAME_TGT_NAME} PUBLIC /wd4102) # Disable: no unreferenced label warnings
|
||||
target_compile_options(${GAME_TGT_NAME} PUBLIC /wd4146) # Disable: negating unsigned integer
|
||||
target_compile_options(${GAME_TGT_NAME} PUBLIC /wd4702) # Disable: unreachable code
|
||||
target_compile_options(${GAME_TGT_NAME} PUBLIC /W4) # Enable all warnings (except the ones disabled above)
|
||||
|
||||
# MSVC: Don't complain about using regular 'std::fopen()' etc.
|
||||
target_compile_definitions(${GAME_TGT_NAME} PRIVATE -D_CRT_SECURE_NO_WARNINGS)
|
||||
else()
|
||||
add_common_target_compile_options(${GAME_TGT_NAME})
|
||||
endif()
|
||||
|
||||
# Compile options used across all PsyDoom projects
|
||||
add_psydoom_common_target_compile_options(${GAME_TGT_NAME})
|
||||
|
||||
# Clang or GCC specific
|
||||
if (COMPILER_CLANG OR COMPILER_GCC)
|
||||
# Warnings
|
||||
|
@ -13,8 +13,6 @@ set(INCLUDE_PATHS
|
||||
add_library(${SIMPLE_GPU_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
target_link_libraries(${SIMPLE_GPU_TGT_NAME}
|
||||
${BASELIB_TGT_NAME}
|
||||
)
|
||||
|
||||
add_psydoom_common_target_compile_options(${SIMPLE_GPU_TGT_NAME})
|
||||
target_link_libraries(${SIMPLE_GPU_TGT_NAME} ${BASELIB_TGT_NAME})
|
||||
target_include_directories(${SIMPLE_GPU_TGT_NAME} PUBLIC INTERFACE ${INCLUDE_PATHS})
|
||||
|
@ -19,10 +19,8 @@ set(INCLUDE_PATHS
|
||||
add_library(${SIMPLE_SPU_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
target_link_libraries(${SIMPLE_SPU_TGT_NAME}
|
||||
${BASELIB_TGT_NAME}
|
||||
)
|
||||
|
||||
add_psydoom_common_target_compile_options(${SIMPLE_SPU_TGT_NAME})
|
||||
target_link_libraries(${SIMPLE_SPU_TGT_NAME} ${BASELIB_TGT_NAME})
|
||||
target_include_directories(${SIMPLE_SPU_TGT_NAME} PUBLIC INTERFACE ${INCLUDE_PATHS})
|
||||
|
||||
if (PSYDOOM_FLOAT_SPU)
|
||||
|
@ -16,6 +16,7 @@ set(OTHER_FILES
|
||||
add_library(${ASIO_TGT_NAME} ${SOURCE_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${ASIO_TGT_NAME})
|
||||
target_compile_definitions(${ASIO_TGT_NAME} PUBLIC -DASIO_SEPARATE_COMPILATION)
|
||||
target_include_directories(${ASIO_TGT_NAME} PUBLIC ${INCLUDE_PATHS})
|
||||
|
||||
|
@ -489,6 +489,7 @@ endif()
|
||||
add_library(${FLTK_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${FLTK_TGT_NAME})
|
||||
include_directories(${INCLUDE_PATHS})
|
||||
target_include_directories(${FLTK_TGT_NAME} INTERFACE ${EXPORTED_INCLUDE_PATHS})
|
||||
target_compile_definitions(${FLTK_TGT_NAME} PUBLIC -DFL_LIBRARY=1)
|
||||
|
@ -11,4 +11,5 @@ set(OTHER_FILES
|
||||
add_library(${HASH_LIBRARY_TGT_NAME} ${SOURCE_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${HASH_LIBRARY_TGT_NAME})
|
||||
target_include_directories(${HASH_LIBRARY_TGT_NAME} INTERFACE ${SRC_DIR})
|
||||
|
@ -437,6 +437,7 @@ endif()
|
||||
add_library(${LIBSDL_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${LIBSDL_TGT_NAME})
|
||||
include_directories(${INCLUDE_PATHS})
|
||||
target_include_directories(${LIBSDL_TGT_NAME} INTERFACE ${EXPORTED_INCLUDE_PATHS})
|
||||
target_compile_definitions(${LIBSDL_TGT_NAME} PUBLIC -DSDL_LEAN_AND_MEAN=1)
|
||||
|
@ -69,6 +69,7 @@ set(OTHER_FILES
|
||||
add_library(${LUA_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${LUA_TGT_NAME})
|
||||
include_directories(${SRC_DIR})
|
||||
target_include_directories(${LUA_TGT_NAME} INTERFACE ${SRC_DIR})
|
||||
|
||||
|
@ -46,7 +46,7 @@ set(INCLUDE_PATHS
|
||||
add_library(${AUDIO_TOOLS_COMMON_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${AUDIO_TOOLS_COMMON_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${AUDIO_TOOLS_COMMON_TGT_NAME})
|
||||
|
||||
target_link_libraries(${AUDIO_TOOLS_COMMON_TGT_NAME}
|
||||
${BASELIB_TGT_NAME}
|
||||
|
@ -8,5 +8,5 @@ set(OTHER_FILES
|
||||
add_executable(${LCD_TOOL_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${LCD_TOOL_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${LCD_TOOL_TGT_NAME})
|
||||
target_link_libraries(${LCD_TOOL_TGT_NAME} ${AUDIO_TOOLS_COMMON_TGT_NAME})
|
||||
|
@ -8,6 +8,6 @@ set(OTHER_FILES
|
||||
add_executable(${VAG_TOOL_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${VAG_TOOL_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${VAG_TOOL_TGT_NAME})
|
||||
target_link_libraries(${VAG_TOOL_TGT_NAME} ${AUDIO_TOOLS_COMMON_TGT_NAME})
|
||||
|
||||
|
@ -8,5 +8,5 @@ set(OTHER_FILES
|
||||
add_executable(${WMD_TOOL_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${WMD_TOOL_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${WMD_TOOL_TGT_NAME})
|
||||
target_link_libraries(${WMD_TOOL_TGT_NAME} ${AUDIO_TOOLS_COMMON_TGT_NAME})
|
||||
|
@ -8,5 +8,5 @@ set(OTHER_FILES
|
||||
add_executable(${PAL_TOOL_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${PAL_TOOL_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${PAL_TOOL_TGT_NAME})
|
||||
target_link_libraries(${PAL_TOOL_TGT_NAME} ${BASELIB_TGT_NAME})
|
||||
|
@ -11,5 +11,5 @@ set(OTHER_FILES
|
||||
add_executable(${DOOM_DISASM_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${DOOM_DISASM_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${DOOM_DISASM_TGT_NAME})
|
||||
target_link_libraries(${DOOM_DISASM_TGT_NAME} ${REVERSING_COMMON_TGT_NAME})
|
||||
|
@ -10,5 +10,5 @@ set(OTHER_FILES
|
||||
add_executable(${PSXEXE_SIGMATCH_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${PSXEXE_SIGMATCH_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${PSXEXE_SIGMATCH_TGT_NAME})
|
||||
target_link_libraries(${PSXEXE_SIGMATCH_TGT_NAME} ${REVERSING_COMMON_TGT_NAME})
|
||||
|
@ -13,5 +13,5 @@ set(OTHER_FILES
|
||||
add_executable(${PSXOBJ_SIGGEN_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${PSXOBJ_SIGGEN_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${PSXOBJ_SIGGEN_TGT_NAME})
|
||||
target_link_libraries(${PSXOBJ_SIGGEN_TGT_NAME} ${REVERSING_COMMON_TGT_NAME})
|
||||
|
@ -40,5 +40,5 @@ set(INCLUDE_PATHS
|
||||
add_library(${REVERSING_COMMON_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${REVERSING_COMMON_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${REVERSING_COMMON_TGT_NAME})
|
||||
target_include_directories(${REVERSING_COMMON_TGT_NAME} PUBLIC INTERFACE ${INCLUDE_PATHS})
|
||||
|
@ -8,5 +8,5 @@ set(OTHER_FILES
|
||||
add_executable(${VRAM_DUMP_GETRECT_TGT_NAME} ${SOURCE_FILES} ${OTHER_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_common_target_compile_options(${VRAM_DUMP_GETRECT_TGT_NAME})
|
||||
add_psydoom_common_target_compile_options(${VRAM_DUMP_GETRECT_TGT_NAME})
|
||||
target_link_libraries(${VRAM_DUMP_GETRECT_TGT_NAME} ${REVERSING_COMMON_TGT_NAME})
|
||||
|
@ -98,6 +98,8 @@ set(INCLUDE_PATHS
|
||||
|
||||
add_library(${VULKAN_GL_TGT_NAME} ${SOURCE_FILES})
|
||||
setup_source_groups("${SOURCE_FILES}" "${OTHER_FILES}")
|
||||
|
||||
add_psydoom_common_target_compile_options(${VULKAN_GL_TGT_NAME})
|
||||
target_compile_definitions(${VULKAN_GL_TGT_NAME} PUBLIC -DVGL_VULKAN_1_0=1) # Target Vulkan 1.0
|
||||
|
||||
target_link_libraries(${VULKAN_GL_TGT_NAME}
|
||||
|
Loading…
Reference in New Issue
Block a user