CMake: Fix up some defines

This commit is contained in:
TellowKrinkle 2021-09-03 21:33:11 -05:00 committed by tellowkrinkle
parent 5435718167
commit 74b08589c4
4 changed files with 28 additions and 32 deletions

View File

@ -44,7 +44,13 @@ add_library(freetype
include/freetype/config/ftoption.h
include/freetype/config/ftstdlib.h
)
target_compile_definitions(freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE FT2_BUILD_LIBRARY)
target_compile_definitions(freetype PRIVATE
_CRT_SECURE_NO_WARNINGS
_CRT_SECURE_NO_DEPRECATE
FT2_BUILD_LIBRARY
$<$<CONFIG:Debug>:FT_DEBUG_LEVEL_ERROR>
$<$<CONFIG:Debug>:FT_DEBUG_LEVEL_TRACE>
)
target_include_directories(freetype PUBLIC include)
target_link_libraries(freetype PRIVATE ZLIB::ZLIB)
add_library(Freetype::Freetype ALIAS freetype)

View File

@ -32,5 +32,17 @@ add_library(portaudio
include/portaudio.h
src/os/win/pa_win_coinitialize.h
)
target_compile_definitions(portaudio PRIVATE
_CRT_SECURE_NO_WARNINGS
_CRT_SECURE_NO_DEPRECATE
PAWIN_USE_WDMKS_DEVICE_INFO
PA_USE_DS=0
PA_USE_WASAPI=1
PA_USE_WDMKS=1
PA_USE_WMME=0
PA_USE_ASIO=0
$<$<CONFIG:Debug>:PA_ENABLE_DEBUG_OUTPUT>
)
target_link_libraries(portaudio PRIVATE ksuser.lib)
target_include_directories(portaudio PUBLIC include PRIVATE src/common src/os/win)
add_library(PkgConfig::PORTAUDIO ALIAS portaudio)

View File

@ -53,7 +53,6 @@ option(GTK2_API "Use GTK2 api (legacy)")
if(PACKAGE_MODE)
# Compile all source codes with those defines
list(APPEND PCSX2_DEFS
PLUGIN_DIR_COMPILATION=${CMAKE_INSTALL_FULL_LIBDIR}/PCSX2
GAMEINDEX_DIR_COMPILATION=${CMAKE_INSTALL_FULL_DATADIR}/PCSX2
DOC_DIR_COMPILATION=${CMAKE_INSTALL_FULL_DOCDIR})
endif()
@ -106,7 +105,7 @@ set(CMAKE_EXE_LINKER_FLAGS_DEVEL "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}"
if(CMAKE_CONFIGURATION_TYPES)
list(INSERT CMAKE_CONFIGURATION_TYPES 0 Devel)
endif()
mark_as_advanced(CMAKE_C_FLAGS_PROF CMAKE_CXX_FLAGS_PROF CMAKE_LINKER_FLAGS_PROF CMAKE_SHARED_LINKER_FLAGS_PROF)
mark_as_advanced(CMAKE_C_FLAGS_DEVEL CMAKE_CXX_FLAGS_DEVEL CMAKE_LINKER_FLAGS_DEVEL CMAKE_SHARED_LINKER_FLAGS_DEVEL CMAKE_EXE_LINKER_FLAGS_DEVEL)
# AVX2 doesn't play well with gdb
if(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(DISABLE_ADVANCE_SIMD ON)
@ -207,34 +206,6 @@ endif()
string(REPLACE " " ";" ARCH_FLAG_LIST "${ARCH_FLAG}")
add_compile_options("${ARCH_FLAG_LIST}")
#-------------------------------------------------------------------------------
# Control GCC flags
#-------------------------------------------------------------------------------
### Cmake set default value for various compilation variable
### Here the list of default value for documentation purpose
# ${CMAKE_SHARED_LIBRARY_CXX_FLAGS} = "-fPIC"
# ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} = "-rdynamic"
#
# ${CMAKE_C_FLAGS} = "-g -O2"
# ${CMAKE_CXX_FLAGS} = "-g -O2"
# Use in debug mode
# ${CMAKE_CXX_FLAGS_DEBUG} = "-g"
# Use in release mode
# ${CMAKE_CXX_FLAGS_RELEASE} = "-O3 -DNDEBUG"
#-------------------------------------------------------------------------------
# Remove bad default option
#-------------------------------------------------------------------------------
# Remove -rdynamic option that can some segmentation fault when openining pcsx2 plugins
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
# Remove -fPIC option on 32bit architectures.
# No good reason to use it for plugins, also it impacts performance.
set(CMAKE_SHARED_LIBRARY_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
endif()
#-------------------------------------------------------------------------------
# Set some default compiler flags
#-------------------------------------------------------------------------------
@ -248,6 +219,13 @@ if(NOT MSVC)
endif()
if(WIN32)
add_compile_definitions(
$<$<CONFIG:Debug>:_ITERATOR_DEBUG_LEVEL=2>
$<$<CONFIG:Devel>:_ITERATOR_DEBUG_LEVEL=1>
$<$<CONFIG:RelWithDebInfo>:_ITERATOR_DEBUG_LEVEL=0>
$<$<CONFIG:MinSizeRel>:_ITERATOR_DEBUG_LEVEL=0>
$<$<CONFIG:Release>:_ITERATOR_DEBUG_LEVEL=0>
)
list(APPEND PCSX2_DEFS TIXML_USE_STL _SCL_SECURE_NO_WARNINGS _UNICODE UNICODE)
endif()

View File

@ -85,11 +85,11 @@ if(WIN32)
)
target_compile_definitions(PCSX2 PRIVATE
_M_SSE=0x401 # TODO: Multiple ISA
DIRECTINPUT_VERSION=0x0800
WINVER=0x0603
_WIN32_WINNT=0x0603
WIN32_LEAN_AND_MEAN
LZMA_API_STATIC
BUILD_DX=1
WIL_SUPPRESS_EXCEPTIONS
)
target_include_directories(PCSX2 PRIVATE