Skip to content

Commit

Permalink
build: remove duplicated sources list from CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Jun 22, 2023
1 parent eba00ae commit f220fce
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 64 deletions.
98 changes: 36 additions & 62 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.12)

project(darling-dmg)

set(dmg_sources
src/unichar.cpp
src/Reader.cpp
src/FileReader.cpp
src/HFSVolume.cpp
src/AppleDisk.cpp
src/SubReader.cpp
src/HFSBTree.cpp
src/HFSFork.cpp
src/HFSCatalogBTree.cpp
src/HFSExtentsOverflowBTree.cpp
src/HFSAttributeBTree.cpp

src/DMGDisk.cpp
src/DMGPartition.cpp
src/DMGDecompressor.cpp
src/adc.cpp
src/HFSZlibReader.cpp
src/MemoryReader.cpp

src/GPTDisk.cpp

src/MacBinary.cpp
src/ResourceFork.cpp
src/CacheZone.cpp
src/CachedReader.cpp

src/HFSHighLevelVolume.cpp
set(
CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/"
)

set(
LIB_SOURCES
"adc.cpp"
"AppleDisk.cpp"
"CacheZone.cpp"
"CachedReader.cpp"
"DMGDecompressor.cpp"
"DMGDisk.cpp"
"DMGPartition.cpp"
"FileReader.cpp"
"GPTDisk.cpp"
"HFSAttributeBTree.cpp"
"HFSBTree.cpp"
"HFSCatalogBTree.cpp"
"HFSExtentsOverflowBTree.cpp"
"HFSFork.cpp"
"HFSHighLevelVolume.cpp"
"HFSVolume.cpp"
"HFSZlibReader.cpp"
"MacBinary.cpp"
"MemoryReader.cpp"
"Reader.cpp"
"ResourceFork.cpp"
"unichar.cpp"
"SubReader.cpp"
)

list(TRANSFORM LIB_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/src/")

# This part of CMakeLists.txt is for when building darling-dmg
# as a standalone FUSE module outside of Darling.
if (NOT DARLING)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")

add_definitions(-D_FILE_OFFSET_BITS=64)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -ggdb -O0")

Expand Down Expand Up @@ -67,35 +68,8 @@ if (WITH_TESTS)
add_test(NAME CacheTest COMMAND CacheTest)
endif (WITH_TESTS)

add_library(dmg SHARED
src/unichar.cpp
src/Reader.cpp
src/FileReader.cpp
src/HFSVolume.cpp
src/AppleDisk.cpp
src/SubReader.cpp
src/HFSBTree.cpp
src/HFSFork.cpp
src/HFSCatalogBTree.cpp
src/HFSExtentsOverflowBTree.cpp
src/HFSAttributeBTree.cpp

src/DMGDisk.cpp
src/DMGPartition.cpp
src/DMGDecompressor.cpp
src/adc.cpp
src/HFSZlibReader.cpp
src/MemoryReader.cpp

src/GPTDisk.cpp

src/MacBinary.cpp
src/ResourceFork.cpp
src/CacheZone.cpp
src/CachedReader.cpp

src/HFSHighLevelVolume.cpp
)
add_library(dmg SHARED)
target_sources(dmg PRIVATE ${LIB_SOURCES})
target_link_libraries(dmg -licuuc -lcrypto -lz -lbz2 ${LIBXML2_LIBRARY})
install(TARGETS dmg DESTINATION lib)

Expand Down Expand Up @@ -129,7 +103,7 @@ else (NOT DARLING)
wrap_elf(fuse libfuse.so)

add_darling_executable(hdiutil
${dmg_sources}
${LIB_SOURCES}
src/main-hdiutil.cpp
)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Read only access only.
| Dependency | Required version | Notes |
|------------|----------------------|------------------------------------|
| GCC/Clang | >5 (GCC), >3 (Clang) | Compiler with C++11 support |
| CMake | 3.10 | Build system |
| CMake | 3.12 | Build system |
| pkg-config | | Library-agnostic package detection |
| OpenSSL | | Base64 decoding |
| Bzip2 | | Decompression |
Expand All @@ -28,7 +28,7 @@ Read only access only.
| libicu | | Unicode support |
| libxml2 | | XML (property list) parsing |

`darling-dmg` requires a C++11-capable compiler, CMake >3.10 and `make` alongside the remaining dependencies mentioned above. Below are common ways to install library dependencies.
`darling-dmg` requires a C++11-capable compiler, CMake >3.12 and `make` alongside the remaining dependencies mentioned above. Below are common ways to install library dependencies.

On Fedora (and derivatives):

Expand Down

0 comments on commit f220fce

Please sign in to comment.