Skip to content

Commit fa0fe7f

Browse files
author
Dreams-Makers Studio
committed
fix(windows): resolve LNK2019 linker error + MSVC format warnings
- Separate shared lib ARCHIVE_OUTPUT_DIRECTORY to lib/shared/ to prevent the DLL import lib from overwriting the static lib on Windows (both were outputting maxcomp.lib to the same directory) - Fix printf format: fl.count is int, use %d instead of %zu (MSVC C4477)
1 parent e02f4f6 commit fa0fe7f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cli/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3535,7 +3535,7 @@ int main(int argc, char* argv[])
35353535
double ratio = (double)agg_total_input / (double)agg_total_output;
35363536
double saving = (1.0 - (double)agg_total_output / (double)agg_total_input) * 100.0;
35373537
if (!bench_csv && !bench_json)
3538-
printf("\n=== AGGREGATE (%zu files, L%d) ===\n"
3538+
printf("\n=== AGGREGATE (%d files, L%d) ===\n"
35393539
" Total input: %12zu bytes (%.1f MB)\n"
35403540
" Total compressed: %12zu bytes (%.1f MB)\n"
35413541
" Overall ratio: %8.2fx (%.1f%% smaller)\n",
@@ -3544,13 +3544,13 @@ int main(int argc, char* argv[])
35443544
agg_total_output, (double)agg_total_output / (1024.0 * 1024.0),
35453545
ratio, saving);
35463546
else if (bench_json)
3547-
printf(",\n \"aggregate\": { \"files\": %zu, \"level\": %d, \"total_input\": %zu, \"total_compressed\": %zu, \"ratio\": %.4f, \"saving_pct\": %.1f }\n",
3547+
printf(",\n \"aggregate\": { \"files\": %d, \"level\": %d, \"total_input\": %zu, \"total_compressed\": %zu, \"ratio\": %.4f, \"saving_pct\": %.1f }\n",
35483548
fl.count, lvl, agg_total_input, agg_total_output, ratio, saving);
35493549
else if (bench_csv == 2)
35503550
printf("\n| **TOTAL** | **%zu** | **%.2fx** | **%.1f%%** | | |\n",
35513551
agg_total_output, ratio, saving);
35523552
else
3553-
printf("TOTAL,%zu,%zu,L%d,%zu,%.4f,%.1f\n",
3553+
printf("TOTAL,%d,%zu,L%d,%zu,%.4f,%.1f\n",
35543554
fl.count, agg_total_input, lvl, agg_total_output, ratio, saving);
35553555
}
35563556
file_list_free(&fl);

lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ if(BUILD_SHARED_LIBS)
9090
OUTPUT_NAME maxcomp
9191
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
9292
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
93-
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
93+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/shared"
9494
)
9595
if(UNIX)
9696
target_link_libraries(maxcomp_shared PRIVATE m)

0 commit comments

Comments
 (0)