Skip to content

Commit

Permalink
Merge pull request #109 from thewtex/cmake-tweaks
Browse files Browse the repository at this point in the history
CMake tweaks
Thank you Matt for this addition.
It all looks good.
  • Loading branch information
aous72 committed Aug 11, 2023
2 parents 02c1b16 + 43c0824 commit e122c1e
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ option(OJPH_ENABLE_INTEL_AVX512 "enables the use of AVX512 SIMD instructions and
option(BUILD_SHARED_LIBS "Shared Libraries" ON)
option(OJPH_ENABLE_TIFF_SUPPORT "Enables input and output support for TIFF files" ON)
option(OJPH_BUILD_TESTS "Enables building test code" OFF)
option(OJPH_BUILD_EXECUTABLES "Enables building command line executables" ON)

# This is related to how the timestamp is set for URL downloaded files.
# Set DOWNLOAD_EXTRACT_TIMESTAMP
Expand Down Expand Up @@ -229,8 +230,10 @@ if(NOT OJPH_DISABLE_INTEL_SIMD)
list(APPEND OJPH_COMPRESS ${OJPH_IMG_IO_AVX2})
endif()

add_executable(ojph_expand ${OJPH_EXPAND})
add_executable(ojph_compress ${OJPH_COMPRESS})
if(OJPH_BUILD_EXECUTABLES)
add_executable(ojph_expand ${OJPH_EXPAND})
add_executable(ojph_compress ${OJPH_COMPRESS})
endif()

if (MSVC)
set_source_files_properties(src/apps/others/ojph_img_io_avx2.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX2")
Expand All @@ -239,24 +242,28 @@ else()
set_source_files_properties(src/apps/others/ojph_img_io_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2)
endif()

if( USE_TIFF )
target_link_libraries(ojph_expand openjph ${TIFF_LIBRARIES})
target_link_libraries(ojph_compress openjph ${TIFF_LIBRARIES})
else()
target_link_libraries(ojph_expand openjph)
target_link_libraries(ojph_compress openjph)
if(OJPH_BUILD_EXECUTABLES)
if( USE_TIFF )
target_link_libraries(ojph_expand PUBLIC openjph ${TIFF_LIBRARIES})
target_link_libraries(ojph_compress PUBLIC openjph ${TIFF_LIBRARIES})
else()
target_link_libraries(ojph_expand PUBLIC openjph)
target_link_libraries(ojph_compress PUBLIC openjph)
endif()
endif()


################################################################################################
# Install
################################################################################################

install(TARGETS ojph_expand
DESTINATION bin)
if(OJPH_BUILD_EXECUTABLES)
install(TARGETS ojph_expand
DESTINATION bin)

install(TARGETS ojph_compress
DESTINATION bin)
install(TARGETS ojph_compress
DESTINATION bin)
endif()

include(GNUInstallDirs)
install(TARGETS openjph LIBRARY
Expand Down

0 comments on commit e122c1e

Please sign in to comment.