Skip to content

Commit

Permalink
Adjust cmake to handle changes to Max SDK from 8.2 onwards (flucoma#32)
Browse files Browse the repository at this point in the history
* Adjust cmake to handle changes to Max SDK from 8.2 onwards

* correct typo
  • Loading branch information
weefuzzy authored and jamesb93 committed Sep 20, 2021
1 parent 5065ff9 commit bc7d477
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
10 changes: 6 additions & 4 deletions source/script/max-posttarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

Expand Down Expand Up @@ -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})
Expand Down
15 changes: 11 additions & 4 deletions source/script/max-pretarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit bc7d477

Please sign in to comment.