diff --git a/source/script/max-posttarget.cmake b/source/script/max-posttarget.cmake index 75185c5f..661ac4dd 100644 --- a/source/script/max-posttarget.cmake +++ b/source/script/max-posttarget.cmake @@ -3,6 +3,10 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +target_sources(${PROJECT_NAME} PRIVATE + "${C74_MAX_API_DIR}/max-includes/common/commonsyms.c" +) + set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON @@ -26,7 +30,7 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /W3 ) else() target_compile_options(${PROJECT_NAME} PRIVATE - -Wall -Wno-gnu-zero-variadic-macro-arguments -Wextra -Wpedantic -Wreturn-type + -Wall -Wno-gnu-zero-variadic-macro-arguments -Wextra -Wpedantic -Wreturn-type -include "${C74_MAX_INCLUDES}/macho-prefix.pch" ) endif() @@ -82,9 +86,7 @@ if (APPLE) #If we target 10.7 (actually < 10.9), we have to manually include this: target_compile_options(${PROJECT_NAME} PRIVATE -stdlib=libc++) elseif (WIN32) - - target_sources(${PROJECT_NAME} PRIVATE "${C74_MAX_API_DIR}/max-includes/common/commonsyms.c") - + target_link_libraries(${PROJECT_NAME} PRIVATE ${MaxAPI_LIB}) target_link_libraries(${PROJECT_NAME} PRIVATE ${MaxAudio_LIB}) target_link_libraries(${PROJECT_NAME} PRIVATE ${Jitter_LIB}) diff --git a/source/script/max-pretarget.cmake b/source/script/max-pretarget.cmake index 4d8ad242..ebe2b7b0 100644 --- a/source/script/max-pretarget.cmake +++ b/source/script/max-pretarget.cmake @@ -17,7 +17,17 @@ endif() if (NOT DEFINED C74_MAX_API_DIR) file(TO_CMAKE_PATH "${MAX_SDK_PATH}" MAX_SDK_FULLPATH) - set(C74_MAX_API_DIR "${MAX_SDK_FULLPATH}/source/c74support") + if(EXISTS "${MAX_SDK_FULLPATH}/source/c74support") + set(C74_MAX_API_DIR "${MAX_SDK_FULLPATH}/source/c74support") + # newer SDK layout, full Max-SDK download + elseif(EXISTS "${MAX_SDK_FULLPATH}/source/max-sdk-base/c74support") + set(C74_MAX_API_DIR "${MAX_SDK_FULLPATH}/source/max-sdk-base/c74support") + # newer SDK layout, just max-sdk-base + elseif(EXISTS "${MAX_SDK_FULLPATH}/c74support") + set(C74_MAX_API_DIR "${MAX_SDK_FULLPATH}/c74support") + else() + message(FATAL_ERROR "Could not find Cycling 74 support folder") + endif() endif () #set(C74_INCLUDES "${C74_MAX_API_DIR}/include") set(C74_MAX_INCLUDES ${C74_MAX_API_DIR}/max-includes) @@ -28,9 +38,6 @@ set(C74_SCRIPTS "../../script") set(C74_CXX_STANDARD 0) -if (APPLE) - SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${C74_MAX_INCLUDES}/macho-prefix.pch\"") -endif () # if (NOT DEFINED C74_BUILD_MAX_EXTENSION) # set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../../externals")