diff --git a/CMakeLists.txt b/CMakeLists.txt index e43eb833..7abeffc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,9 @@ project(SDL3_image VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}" ) -include("${CMAKE_CURRENT_LIST_DIR}/cmake/CheckCPUArchitecture.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/cmake/GetGitRevisionDescription.cmake" ) -include("${CMAKE_CURRENT_LIST_DIR}/cmake/PrivateSdlFunctions.cmake" ) +include("${CMAKE_CURRENT_LIST_DIR}/cmake/GetGitRevisionDescription.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/cmake/PrivateSdlFunctions.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/cmake/sdlcpu.cmake") include("${CMAKE_CURRENT_LIST_DIR}/cmake/sdlplatform.cmake") include("${CMAKE_CURRENT_LIST_DIR}/cmake/sdlmanpages.cmake") sdl_calculate_derived_version_variables(${MAJOR_VERSION} ${MINOR_VERSION} ${MICRO_VERSION}) @@ -60,7 +60,7 @@ include(CMakePackageConfigHelpers) include(GNUInstallDirs) set(PLATFORM_SUPPORTS_SHARED ON) -if(VITA OR PSP OR PS2 OR N3DS OR RISCOS) +if(EMSCRIPTEN OR VITA OR PSP OR PS2 OR N3DS OR RISCOS) set(PLATFORM_SUPPORTS_SHARED OFF) endif() @@ -218,7 +218,7 @@ if(NOT TARGET SDL3::Headers OR NOT TARGET ${sdl3_target_name}) find_package(SDL3 ${SDL_REQUIRED_VERSION} REQUIRED COMPONENTS ${sdl_required_components}) endif() -SDL_DetectCPUArchitecture() +SDL_DetectTargetCPUArchitectures(SDL_CPU_NAMES) SDL_DetectCMakePlatform() # Set PROJECT_VERSION of subprojects to "" if it's project call does not set VERSION @@ -417,7 +417,7 @@ if(SDLIMAGE_DAV1D) message(STATUS "${PROJECT_NAME}: Using vendored dav1d") set(BUILD_SHARED_LIBS ${SDLIMAGE_DAV1D_SHARED}) add_subdirectory(external/dav1d EXCLUDE_FROM_ALL) - if(DAV1D_ASM AND (CHECK_CPU_ARCHITECTURE_X64 OR CHECK_CPU_ARCHITECTURE_X86)) + if(DAV1D_ASM AND (SDL_CPU_X64 OR SDL_CPU_X86)) enable_language(ASM_NASM) endif() set(DAV1D_LIBRARY dav1d) @@ -1016,10 +1016,8 @@ if(SDLIMAGE_INSTALL) if(WIN32 AND NOT MINGW) set(SDLIMAGE_INSTALL_CMAKEDIR "${SDLIMAGE_INSTALL_CMAKEDIR_ROOT}") - set(LICENSES_PREFIX "licenses/SDL3_image") else() set(SDLIMAGE_INSTALL_CMAKEDIR "${SDLIMAGE_INSTALL_CMAKEDIR_ROOT}/SDL3_image") - set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/SDL3_image") endif() configure_package_config_file(cmake/SDL3_imageConfig.cmake.in SDL3_imageConfig.cmake @@ -1062,9 +1060,7 @@ if(SDLIMAGE_INSTALL) ) if(SDLIMAGE_INSTALL_CPACK) - if(SDL2COMPAT_FRAMEWORK) - set(CPACK_GENERATOR "DragNDrop") - elseif(MSVC) + if(MSVC) set(CPACK_GENERATOR "ZIP") else() set(CPACK_GENERATOR "TGZ") diff --git a/cmake/CPackProjectConfig.cmake.in b/cmake/CPackProjectConfig.cmake.in index 735e2ea2..4c7ce7d5 100644 --- a/cmake/CPackProjectConfig.cmake.in +++ b/cmake/CPackProjectConfig.cmake.in @@ -9,17 +9,17 @@ set(SDL_CMAKE_PLATFORM "@SDL_CMAKE_PLATFORM@") set(SDL_CPU_NAMES "@SDL_CPU_NAMES@") list(SORT SDL_CPU_NAMES) +string(TOLOWER "${SDL_CMAKE_PLATFORM}" SDL_CMAKE_PLATFORM) +string(TOLOWER "${SDL_CPU_NAMES}" SDL_CPU_NAMES) +if(lower_sdl_cmake_platform STREQUAL lower_sdl_cpu_names) + set(SDL_CPU_NAMES_WITH_DASHES) +endif() + string(REPLACE ";" "-" SDL_CPU_NAMES_WITH_DASHES "${SDL_CPU_NAMES}") if(SDL_CPU_NAMES_WITH_DASHES) set(SDL_CPU_NAMES_WITH_DASHES "-${SDL_CPU_NAMES_WITH_DASHES}") endif() -string(TOLOWER "${SDL_CMAKE_PLATFORM}" lower_sdl_cmake_platform) -string(TOLOWER "${SDL_CPU_NAMES}" lower_sdl_cpu_names) -if(lower_sdl_cmake_platform STREQUAL lower_sdl_cpu_names) - set(SDL_CPU_NAMES_WITH_DASHES) -endif() - set(MSVC @MSVC@) set(MINGW @MINGW@) if(MSVC) diff --git a/cmake/CheckCPUArchitecture.cmake b/cmake/CheckCPUArchitecture.cmake deleted file mode 100644 index 1eebbd4f..00000000 --- a/cmake/CheckCPUArchitecture.cmake +++ /dev/null @@ -1,42 +0,0 @@ -include(CheckCSourceCompiles) -include(CMakePushCheckState) - -function(_internal_check_cpu_architecture macro_check NAME VARIABLE) - cmake_push_check_state() - string(TOUPPER "${NAME}" UPPER_NAME) - set(CACHE_VARIABLE "CHECK_CPU_ARCHITECTURE_${UPPER_NAME}") - set(test_src " -int main(int argc, char *argv[]) { -#if ${macro_check} - return 0; -#else - choke -#endif -} -") - check_c_source_compiles("${test_src}" "${CACHE_VARIABLE}") - cmake_pop_check_state() - if(${CACHE_VARIABLE}) - set(${VARIABLE} "TRUE" PARENT_SCOPE) - else() - set(${VARIABLE} "FALSE" PARENT_SCOPE) - endif() -endfunction() - -function(check_cpu_architecture ARCH VARIABLE) - if(ARCH STREQUAL "x86") - _internal_check_cpu_architecture("defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" x86 ${VARIABLE}) - elseif(ARCH STREQUAL "x64") - _internal_check_cpu_architecture("defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" x64 ${VARIABLE}) - elseif(ARCH STREQUAL "arm32") - _internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE}) - elseif(ARCH STREQUAL "arm64") - _internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE}) - elseif(ARCH STREQUAL "loongarch64") - _internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE}) - else() - message(WARNING "Unknown CPU architectures (${ARCH}).") - set(${VARIABLE} FALSE) - endif() - set("${VARIABLE}" "${${VARIABLE}}" PARENT_SCOPE) -endfunction()