From 4d1dfe804f50a656093afdc6ef98a906478c5b77 Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Tue, 13 Feb 2024 21:27:06 +1100 Subject: [PATCH] This fixes issue #128. Gtest should not be installed. the .bin folder is removed. version bump. --- CMakeLists.txt | 6 +----- bin/.gitignore | 2 -- src/apps/CMakeLists.txt | 10 ---------- src/apps/ojph_compress/CMakeLists.txt | 6 ------ src/apps/ojph_expand/CMakeLists.txt | 6 ------ src/core/CMakeLists.txt | 18 ------------------ src/core/common/ojph_version.h | 2 +- tests/CMakeLists.txt | 13 ++++++++++--- tests/test_executables.cpp | 4 ++-- 9 files changed, 14 insertions(+), 53 deletions(-) delete mode 100644 bin/.gitignore diff --git a/CMakeLists.txt b/CMakeLists.txt index af40c1a..ed25302 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,11 +19,7 @@ option(OJPH_ENABLE_TIFF_SUPPORT "Enables input and output support for TIFF files option(OJPH_BUILD_TESTS "Enables building test code" OFF) option(OJPH_BUILD_EXECUTABLES "Enables building command line executables" ON) -## specify output directories -set(OJPH_DESTINATION_BINARY ${CMAKE_BINARY_DIR}/../bin) -set(OJPH_DESTINATION_ARCHIVE ${CMAKE_BINARY_DIR}/../lib) - -## specify the top directory for TIFF library (only for Micrsoft) +## specify the top directory for TIFF library (only for Microsoft Visual Studio) if (MSVC) set(TIFF_PATH "C:\\Program Files\\tiff") endif() diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index 7d1d8c5..0000000 --- a/bin/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -* diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt index 19b9bff..acc1670 100644 --- a/src/apps/CMakeLists.txt +++ b/src/apps/CMakeLists.txt @@ -34,13 +34,3 @@ endif() ## Build executables add_subdirectory(ojph_expand) add_subdirectory(ojph_compress) - -if (MSVC AND OJPH_ENABLE_TIFF_SUPPORT) - if (CMAKE_BUILD_TYPE MATCHES "Release") - file(COPY "${TIFF_PATH}\\bin\\tiff.dll" DESTINATION "${OJPH_DESTINATION_BINARY}") - file(COPY "${TIFF_PATH}\\bin\\tiffxx.dll" DESTINATION "${OJPH_DESTINATION_BINARY}") - elseif(CMAKE_BUILD_TYPE MATCHES "Debug") - file(COPY "${TIFF_PATH}\\bin\\tiffd.dll" DESTINATION "${OJPH_DESTINATION_BINARY}") - file(COPY "${TIFF_PATH}\\bin\\tiffxxd.dll" DESTINATION "${OJPH_DESTINATION_BINARY}") - endif() -endif() diff --git a/src/apps/ojph_compress/CMakeLists.txt b/src/apps/ojph_compress/CMakeLists.txt index cc9f64b..bbb77ab 100644 --- a/src/apps/ojph_compress/CMakeLists.txt +++ b/src/apps/ojph_compress/CMakeLists.txt @@ -49,9 +49,3 @@ else() install(TARGETS ojph_compress DESTINATION bin) endif() - -## copy target files to the top bin folder -add_custom_command(TARGET ojph_compress POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${OJPH_DESTINATION_BINARY} - COMMAND ${CMAKE_COMMAND} -E copy "$" ${OJPH_DESTINATION_BINARY} -) diff --git a/src/apps/ojph_expand/CMakeLists.txt b/src/apps/ojph_expand/CMakeLists.txt index e6eab46..c0ac185 100644 --- a/src/apps/ojph_expand/CMakeLists.txt +++ b/src/apps/ojph_expand/CMakeLists.txt @@ -49,9 +49,3 @@ else() install(TARGETS ojph_expand DESTINATION bin) endif() - -## copy target files to the top bin folder -add_custom_command(TARGET ojph_expand POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${OJPH_DESTINATION_BINARY} - COMMAND ${CMAKE_COMMAND} -E copy "$" ${OJPH_DESTINATION_BINARY} -) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 5a046cf..40b9649 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -94,21 +94,3 @@ else() SOVERSION "${OPENJPH_VERSION_MAJOR}.${OPENJPH_VERSION_MINOR}" VERSION "${OPENJPH_VERSION}") endif() - -## copy target files to the top bin folder -add_custom_command(TARGET openjph POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${OJPH_DESTINATION_BINARY} - COMMAND ${CMAKE_COMMAND} -E copy "$" ${OJPH_DESTINATION_BINARY} - COMMAND ${CMAKE_COMMAND} -E make_directory ${OJPH_DESTINATION_ARCHIVE} - COMMAND ${CMAKE_COMMAND} -E copy "$" ${OJPH_DESTINATION_ARCHIVE} -) -if (MSVC) - add_custom_command(TARGET openjph POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "$/${OJPH_LIB_NAME_STRING}.exp" ${OJPH_DESTINATION_ARCHIVE} - ) -endif() -if(EMSCRIPTEN) - add_custom_command(TARGET openjphsimd POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "$" ${OJPH_DESTINATION_BINARY} - ) -endif() diff --git a/src/core/common/ojph_version.h b/src/core/common/ojph_version.h index 7b9fc82..fdf28bc 100644 --- a/src/core/common/ojph_version.h +++ b/src/core/common/ojph_version.h @@ -35,4 +35,4 @@ #define OPENJPH_VERSION_MAJOR 0 #define OPENJPH_VERSION_MINOR 10 -#define OPENJPH_VERSION_PATCH 4 +#define OPENJPH_VERSION_PATCH 5 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dc2a893..03ac41c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,6 +9,7 @@ FetchContent_Declare( # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) set(BUILD_GMOCK OFF CACHE BOOL "" FORCE) +option(INSTALL_GTEST "Enable installation of googletest." OFF) FetchContent_MakeAvailable(googletest) # Fetch test files @@ -66,9 +67,15 @@ if (MSVC) file(COPY "${TIFF_PATH}\\bin\\tiffxxd.dll" DESTINATION "./") endif() endif() -elseif(MSYS) +else() add_custom_command(TARGET test_executables POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "../bin/msys-gtest.dll" "./" - COMMAND ${CMAKE_COMMAND} -E copy "../bin/msys-gtest_main.dll" "./" + COMMAND ${CMAKE_COMMAND} -E copy "$" "./" + COMMAND ${CMAKE_COMMAND} -E copy "$" "./" ) + if(MSYS) + add_custom_command(TARGET test_executables POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "../bin/msys-gtest.dll" "./" + COMMAND ${CMAKE_COMMAND} -E copy "../bin/msys-gtest_main.dll" "./" + ) + endif() endif() diff --git a/tests/test_executables.cpp b/tests/test_executables.cpp index 50e8f6d..7e6a00c 100644 --- a/tests/test_executables.cpp +++ b/tests/test_executables.cpp @@ -107,8 +107,8 @@ int execute(const std::string& cmd, std::string& result) #define REF_FILE_DIR "./jp2k_test_codestreams/openjph/references/" #define MSE_PAE_PATH "./mse_pae" #define COMPARE_FILES_PATH "./compare_files" - #define EXPAND_EXECUTABLE "../../bin/ojph_expand" - #define COMPRESS_EXECUTABLE "../../bin/ojph_compress" + #define EXPAND_EXECUTABLE "./ojph_expand" + #define COMPRESS_EXECUTABLE "./ojph_compress" #endif #define TOL_DOUBLE 0.01 #define TOL_INTEGER 1