Skip to content

Commit

Permalink
feat: compile compressonator for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
craftablescience committed Jun 29, 2024
1 parent 6f8e699 commit e398815
Show file tree
Hide file tree
Showing 57 changed files with 70 additions and 45 deletions.
25 changes: 15 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


# Options (General)
# Options
option(SOURCEPP_USE_DMXPP "Build dmxpp library" ON)
option(SOURCEPP_USE_FGDPP "Build fgdpp library" ON)
option(SOURCEPP_USE_KVPP "Build kvpp library" ON)
option(SOURCEPP_USE_MDLPP "Build mdlpp library" ON)
option(SOURCEPP_USE_VICEPP "Build vicepp library" ON)
option(SOURCEPP_USE_VPKPP "Build vpkpp library" ON)
if(NOT APPLE)
option(SOURCEPP_USE_VTFPP "Build vtfpp library" ON)
else()
set(SOURCEPP_USE_VTFPP OFF CACHE INTERNAL "")
endif()
option(SOURCEPP_USE_VTFPP "Build vtfpp library" ON)
option(SOURCEPP_BUILD_C_WRAPPERS "Build C wrappers for supported libraries" ON)
option(SOURCEPP_BUILD_TESTS "Build tests for enabled libraries" OFF)
option(SOURCEPP_USE_STATIC_MSVC_RUNTIME "Link to static MSVC runtime library" OFF)


# Options (Library)
# Option overrides
if(SOURCEPP_USE_VPKPP)
set(SOURCEPP_USE_KVPP ON CACHE INTERNAL "")
endif()


# Options per-library
option(FGDPP_ENABLE_SPEN_FGD_SUPPORT "Enable support for FGD alterations (https://github.com/TeamSpen210/HammerAddons/wiki/Unified-FGD) made by TeamSpen's HammerAddons. Fully backwards compatible with Valve's FGD standard." OFF)


Expand All @@ -41,6 +43,10 @@ if(NOT TARGET bufferstream)
endif()


# compressonator
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/compressonator")


# cryptopp
if (NOT TARGET cryptopp::cryptopp)
set(CRYPTOPP_BUILD_TESTING OFF CACHE INTERNAL "")
Expand All @@ -51,7 +57,7 @@ endif()

# ice
if(SOURCEPP_USE_VICEPP)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/thirdparty/ice")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/ice")
endif()


Expand Down Expand Up @@ -81,7 +87,7 @@ endif()

# stb
if(SOURCEPP_USE_VTFPP)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/thirdparty/stb")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/stb")
endif()


Expand Down Expand Up @@ -147,7 +153,6 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(AddPrettyParser)
include(AddSourcePPLibrary)
include(TargetLinkCompressonator)


# Add libraries
Expand Down
19 changes: 0 additions & 19 deletions cmake/TargetLinkCompressonator.cmake

This file was deleted.

36 changes: 36 additions & 0 deletions ext/compressonator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
set(COMPRESSONATOR_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "")

function(target_link_compressonator TARGET)
if(MSVC)
get_target_property(TARGET_MSVC_RUNTIME_LIBRARY ${TARGET} MSVC_RUNTIME_LIBRARY)
if((TARGET_MSVC_RUNTIME_LIBRARY MATCHES "NOTFOUND$") OR (TARGET_MSVC_RUNTIME_LIBRARY MATCHES "DLL$"))
target_link_libraries(${TARGET} PRIVATE
"${COMPRESSONATOR_DIR}/lib/win_x86_64/Compressonator_MD$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MD$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MD_AVX$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MD_AVX512$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MD_SSE$<$<CONFIG:Debug>:d>.lib")
else()
target_link_libraries(${TARGET} PRIVATE
"${COMPRESSONATOR_DIR}/lib/win_x86_64/Compressonator_MT$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MT$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MT_AVX$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MT_AVX512$<$<CONFIG:Debug>:d>.lib"
"${COMPRESSONATOR_DIR}/lib/win_x86_64/CMP_Core_MT_SSE$<$<CONFIG:Debug>:d>.lib")
endif()
elseif(APPLE)
target_link_libraries(${TARGET} PRIVATE
"${COMPRESSONATOR_DIR}/lib/osx_arm64/libCompressonator$<$<CONFIG:Debug>:d>.a"
"${COMPRESSONATOR_DIR}/lib/osx_arm64/libCMP_Core$<$<CONFIG:Debug>:d>.a")
elseif(UNIX)
target_link_libraries(${TARGET} PRIVATE
"${COMPRESSONATOR_DIR}/lib/linux_x86_64/libCompressonator$<$<CONFIG:Debug>:d>.a"
"${COMPRESSONATOR_DIR}/lib/linux_x86_64/libCMP_Core$<$<CONFIG:Debug>:d>.a"
"${COMPRESSONATOR_DIR}/lib/linux_x86_64/libCMP_Core_AVX$<$<CONFIG:Debug>:d>.a"
"${COMPRESSONATOR_DIR}/lib/linux_x86_64/libCMP_Core_AVX512$<$<CONFIG:Debug>:d>.a"
"${COMPRESSONATOR_DIR}/lib/linux_x86_64/libCMP_Core_SSE$<$<CONFIG:Debug>:d>.a")
else()
message(FATAL_ERROR "Unable to link to Compressonator library!")
endif()
target_include_directories(${TARGET} PRIVATE "${COMPRESSONATOR_DIR}/include")
endfunction()
19 changes: 19 additions & 0 deletions ext/compressonator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added ext/compressonator/lib/osx_arm64/libCMP_Core.a
Binary file not shown.
Binary file added ext/compressonator/lib/osx_arm64/libCMP_Cored.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 0 additions & 16 deletions src/thirdparty/compressonator/LICENSE

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit e398815

Please sign in to comment.