Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bee257d
DirectShowSource: Sensible defaults for CMake baseclasses lib, remove…
ignus2 Oct 30, 2016
5bbda7d
PluginManager.cpp: fix header include for non-Windows
qyot27 Sep 27, 2017
8dbf4b8
capi.h: partially protect against MSVC/GCC compatibility breakage
qyot27 Sep 30, 2017
8cd223c
CMakeLists.txt: use quotes when more than one flag is used
qyot27 Feb 18, 2018
2617d34
CMakeLists: change MSVC_IDE to MSVC
qyot27 Sep 25, 2016
690cab4
CMakeLists: simplify Windows link target requirements
qyot27 Sep 24, 2016
3ab9a89
CMakeLists: don't use toolset with Ninja
qyot27 Sep 25, 2016
03973fe
Files.cmake: enable using *.def under MinGW too
qyot27 Sep 24, 2016
2cf6074
avisynth*.def: fix syntax errors under MinGW
qyot27 Sep 24, 2016
a01e552
memcpy_amd.cpp: silence warnings in comments that use single quotes
qyot27 Feb 19, 2018
f4ef04b
CMakeLists.txt: use stdcall fixup
qyot27 Feb 19, 2018
fac8340
script.cpp: sprintf_s under MinGW-w64 requires Secure API
qyot27 Feb 26, 2018
cd92f97
CMakeLists.txt: use CPU_ARCH to allow user-selected MSVC SIMD level
qyot27 Aug 5, 2018
0cc8f6b
plugins/CMakeLists.txt: allow Ninja/NMake to build DirectShowSource
qyot27 Aug 10, 2018
d5ef8da
Files.cmake: Conditionally enable building avisynth.rc
qyot27 Aug 10, 2018
3ace499
CMakeLists.txt: Only use toolsets with MSVC_IDE
qyot27 Aug 10, 2018
39a12f1
CMakeLists.txt: Silence EHsc->EHa warning when using Ninja/NMake
qyot27 Aug 10, 2018
8ab8eb0
PluginManager.cpp: [MSVC|GCC] should only load [MSVC|GCC] plugins
qyot27 Mar 15, 2019
cf1a491
convolution.cpp: fix out-of-scope build error
qyot27 Mar 15, 2019
3bb92db
histogram.h: add stdint.h include
qyot27 Mar 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 39 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
endif()

IF( MSVC_IDE ) # Check for Visual Studio
IF( MSVC ) # Check for Visual Studio

#1800 = VS 12.0 (v120 toolset)
#1900 = VS 14.0 (v140 toolset)
Expand All @@ -30,25 +30,27 @@ IF( MSVC_IDE ) # Check for Visual Studio
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/Output/system")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/Output/c_api")

IF(CMAKE_GENERATOR_TOOLSET STREQUAL "v141_clang_c2")
#1900 is reported
message("v141_clang_c2 toolset was specified via -T. Reported MSVC_VERSION is: ${MSVC_VERSION}")
set(CLANG_IN_VS "1")
ENDIF()
IF(MSVC_IDE)
IF(CMAKE_GENERATOR_TOOLSET STREQUAL "v141_clang_c2")
#1900 is reported
message("v141_clang_c2 toolset was specified via -T. Reported MSVC_VERSION is: ${MSVC_VERSION}")
set(CLANG_IN_VS "1")
ENDIF()

# We want our project to also run on Windows XP
# 1900 (VS2015) is not supported but we leave here
IF(MSVC_VERSION VERSION_LESS 1910 )
IF(NOT CLANG_IN_VS STREQUAL "1")
set(CMAKE_GENERATOR_TOOLSET "v140_xp" CACHE STRING "The compiler toolset to use for Visual Studio." FORCE) # VS2015
# https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
add_definitions("/Zc:threadSafeInit-")
ENDIF()
ELSE()
IF(NOT CLANG_IN_VS STREQUAL "1")
set(CMAKE_GENERATOR_TOOLSET "v141_xp" CACHE STRING "The compiler toolset to use for Visual Studio." FORCE) # VS2017
# https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
add_definitions("/Zc:threadSafeInit-")
# We want our project to also run on Windows XP
# 1900 (VS2015) is not supported but we leave here
IF(MSVC_VERSION VERSION_LESS 1910 )
IF(NOT CLANG_IN_VS STREQUAL "1")
set(CMAKE_GENERATOR_TOOLSET "v140_xp" CACHE STRING "The compiler toolset to use for Visual Studio." FORCE) # VS2015
# https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
add_definitions("/Zc:threadSafeInit-")
ENDIF()
ELSE()
IF(NOT CLANG_IN_VS STREQUAL "1")
set(CMAKE_GENERATOR_TOOLSET "v141_xp" CACHE STRING "The compiler toolset to use for Visual Studio." FORCE) # VS2017
# https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
add_definitions("/Zc:threadSafeInit-")
ENDIF()
ENDIF()
ENDIF()

Expand All @@ -58,28 +60,33 @@ IF( MSVC_IDE ) # Check for Visual Studio
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-inconsistent-missing-override")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
ELSE()
# Enable C++ with SEH exceptions
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /EHa")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
# or add_compile_options( /EHa ) for CMake>=3?
# Enable C++ with SEH exceptions
# Avoid an obnoxious 'overrriding /EHsc with /EHa' warning when
# using something other than MSBuild
STRING( REPLACE "/EHsc" "/EHa" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
STRING( REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()
# Prevent VC++ from complaining about not using MS-specific functions
add_definitions("/D _CRT_SECURE_NO_WARNINGS /D _SECURE_SCL=0")

# Enable CRT heap debugging - only effective in debug builds
add_definitions("/D _CRTDBG_MAP_ALLOC")

add_definitions("/D __SSE2__")

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
# VC++ enables the SSE2 instruction set by default even on 32-bits. Step back a bit.
#add_definitions("/arch:SSE")
add_definitions("/arch:SSE2") # Better use this one, it's 2017 now, and helps optimizing hbd stuff still in C
endif()
# CPU_ARCH can be overridden with the corresponding values when using MSVC:
# IA32 (disabled),
# SSE (Pentium III and higher, 1999),
# SSE2 (Pentium 4 and higher, 2000/2001),
# AVX (Sandy Bridge and higher, 2011),
# AVX2 (Haswell and higher, 2013)
set(MSVC_CPU_ARCH "SSE2" CACHE STRING "Set MSVC architecture optimization level (default: SSE2)")
endif()

# Set additional optimization flags
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oy /Ot /GS- /Oi")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oy /Ot /GS- /Oi")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oy /Ot /GS- /Oi /arch:${MSVC_CPU_ARCH}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oy /Ot /GS- /Oi /arch:${MSVC_CPU_ARCH}")

# Set C++17 flag
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /std:c++17")
Expand All @@ -89,6 +96,7 @@ ELSE()
# c++17: if constexpr() and others from gcc 7
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17" ) # or -std=c++17 w/o gnu c++17 extensions
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native" )
SET( CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-stdcall-fixup" )

ENDIF()

Expand All @@ -104,4 +112,4 @@ configure_file(
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
8 changes: 3 additions & 5 deletions avs_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ elseif (MINGW)

# special AVX2 option for source files with *_avx2.cpp pattern
file(GLOB_RECURSE SRCS_AVX2 "*_avx2.cpp")
set_source_files_properties(${SRCS_AVX2} PROPERTIES COMPILE_FLAGS -mavx2 -mfma)
set_source_files_properties(${SRCS_AVX2} PROPERTIES COMPILE_FLAGS "-mavx2 -mfma")
endif()

# Specify include directories
Expand All @@ -63,10 +63,8 @@ target_include_directories("AvsCore" PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions("AvsCore" PRIVATE BUILDING_AVSCORE)

# Windows DLL dependencies
if (MSVC_IDE)
target_link_libraries("AvsCore" "Winmm.lib" "Vfw32.lib" "Msacm32.lib" "Gdi32.lib" "User32.lib" "Advapi32.lib" "Ole32.lib" "ImageHlp.lib")
elseif (MINGW)
target_link_libraries("AvsCore" "uuid" "winmm" "vfw32" "msacm32" "gdi32" "user32" "advapi32" "ole32" "imagehlp.lib")
if (MSVC OR MINGW)
target_link_libraries("AvsCore" "uuid" "winmm" "vfw32" "msacm32" "gdi32" "user32" "advapi32" "ole32" "imagehlp")
endif()

if (MSVC_IDE)
Expand Down
10 changes: 7 additions & 3 deletions avs_core/Files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ FILE(GLOB AvsCore_Sources RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"core/*.c"
"core/*.cpp"
"core/*.h"
"core/avisynth.rc"

"core/parser/*.c"
"core/parser/*.cpp"
Expand All @@ -39,12 +38,17 @@ FILE(GLOB AvsCore_Sources RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"filters/exprfilter/*.h"
)

IF( MSVC_IDE )
IF( MSVC OR MINGW )
# Export definitions in general are not needed on x64 and only cause warnings,
# unfortunately we still must need a .def file for some COM functions.
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
LIST(APPEND AvsCore_Sources "core/avisynth64.def")
else()
LIST(APPEND AvsCore_Sources "core/avisynth.def")
endif()
ENDIF()
ENDIF()

IF( MSVC_IDE )
# Ninja, unfortunately, seems to have some issues with using rc.exe
LIST(APPEND AvsCore_Sources "core/avisynth.rc")
ENDIF()
Loading