Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,10 @@ endif()
################################################################################################

include(GNUInstallDirs)
install(TARGETS openjph
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(DIRECTORY src/core/common/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/openjph
FILES_MATCHING
PATTERN "*.h")
install(EXPORT openjph-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/openjph
)

install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
Expand All @@ -179,6 +174,16 @@ configure_file(
@ONLY
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/openjph-configVersion.cmake
COMPATIBILITY SameMinorVersion)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/openjph-configVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/openjph
)


################################################################################################
# Testing (OJPH_BUILD_TESTS)
################################################################################################
Expand Down
5 changes: 2 additions & 3 deletions src/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ if( OJPH_ENABLE_TIFF_SUPPORT )

if( TIFF_FOUND )
set(USE_TIFF TRUE CACHE BOOL "Add TIFF support")
include_directories( ${TIFF_INCLUDE_DIR} )
add_definitions(-DOJPH_ENABLE_TIFF_SUPPORT)
elseif(MSVC)
message(STATUS "TIFF support has been enabled by no path to the TIFF library "
else()
message(WARNING "TIFF support has been requested but no path to the TIFF library "
"has been specified; please configure with -DCMAKE_PREFIX_PATH=<TIFF library directory>, "
"or disable TIFF support using -DOJPH_ENABLE_TIFF_SUPPORT=OFF.")
endif( TIFF_FOUND )
Expand Down
31 changes: 14 additions & 17 deletions src/apps/ojph_compress/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
## building ojph_compress
#########################

include_directories(../common)
include_directories(../../core/common)

file(GLOB OJPH_COMPRESS "ojph_compress.cpp")
file(GLOB OJPH_IMG_IO "../others/ojph_img_io.cpp")
file(GLOB OJPH_IMG_IO_SSE4 "../others/ojph_img_io_sse41.cpp")
Expand All @@ -19,15 +16,12 @@ source_group("common" FILES ${OJPH_IMG_IO_H})
if(EMSCRIPTEN)
add_compile_options(-std=c++11 -O3 -fexceptions)
add_link_options(-sWASM=1 -sASSERTIONS=1 -sALLOW_MEMORY_GROWTH=1 -sNODERAWFS=1 -sENVIRONMENT=node -sEXIT_RUNTIME=1 -sEXCEPTION_CATCHING_ALLOWED=['fake'])
add_executable(ojph_compress ${SOURCES})
add_executable(ojph_compress_simd ${SOURCES} ${OJPH_IMG_IO_SSE4})
target_compile_options(ojph_compress_simd PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128 -msse4.1)
source_group("others" FILES ${OJPH_IMG_IO_SSE4})

target_link_libraries(ojph_compress PRIVATE openjph)
install(TARGETS ojph_compress DESTINATION bin)
target_include_directories(ojph_compress_simd PRIVATE ../common)
target_link_libraries(ojph_compress_simd PRIVATE openjphsimd)
install(TARGETS ojph_compress_simd DESTINATION bin)
install(TARGETS ojph_compress_simd)
else()
if (NOT OJPH_DISABLE_SIMD)
if (("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_X86_64") OR ("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_I386"))
Expand All @@ -48,18 +42,21 @@ else()
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS -mavx2)
endif()
elseif ("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_ARM")

endif()

endif()

add_executable(ojph_compress ${SOURCES})

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

install(TARGETS ojph_compress DESTINATION bin)
add_executable(ojph_compress ${SOURCES})
target_include_directories(ojph_compress PRIVATE ../common)
if (TIFF_FOUND AND (NOT EMSCRIPTEN))
target_link_libraries(ojph_compress PRIVATE openjph TIFF::TIFF)
else()
target_link_libraries(ojph_compress PRIVATE openjph)
endif()

install(TARGETS ojph_compress
EXPORT openjph-config
)
28 changes: 15 additions & 13 deletions src/apps/ojph_expand/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
## building ojph_expand
#######################

include_directories(../common)
include_directories(../../core/common)

file(GLOB OJPH_EXPAND "ojph_expand.cpp")
file(GLOB OJPH_IMG_IO "../others/ojph_img_io.cpp")
Expand All @@ -19,15 +17,16 @@ source_group("common" FILES ${OJPH_IMG_IO_H})
if(EMSCRIPTEN)
add_compile_options(-std=c++11 -O3 -fexceptions)
add_link_options(-sWASM=1 -sASSERTIONS=1 -sALLOW_MEMORY_GROWTH=1 -sNODERAWFS=1 -sENVIRONMENT=node -sEXIT_RUNTIME=1 -sEXCEPTION_CATCHING_ALLOWED=['fake'])
add_executable(ojph_expand ${SOURCES})
add_executable(ojph_expand_simd ${SOURCES} ${OJPH_IMG_IO_SSE4})
target_compile_options(ojph_expand_simd PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128 -msse4.1)
source_group("others" FILES ${OJPH_IMG_IO_SSE4})

target_link_libraries(ojph_expand PRIVATE openjph)
install(TARGETS ojph_expand DESTINATION bin)
target_link_libraries(ojph_expand_simd PRIVATE openjphsimd)
install(TARGETS ojph_expand_simd DESTINATION bin)
target_include_directories(ojph_expand_simd PRIVATE ../common)
if (TIFF_FOUND)
target_link_libraries(ojph_expand_simd PRIVATE openjphsimd TIFF::TIFF)
else()
target_link_libraries(ojph_expand_simd PRIVATE openjphsimd)
endif()
install(TARGETS ojph_expand_simd)
else()
if (NOT OJPH_DISABLE_SIMD)
if (("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_X86_64") OR ("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_I386"))
Expand All @@ -54,12 +53,15 @@ else()
endif()

add_executable(ojph_expand ${SOURCES})

if( USE_TIFF )
target_link_libraries(ojph_expand PUBLIC openjph ${TIFF_LIBRARIES})
target_include_directories(ojph_expand PRIVATE ../common)
if (TIFF_FOUND AND (NOT EMSCRIPTEN))
target_link_libraries(ojph_expand PRIVATE openjph TIFF::TIFF )
else()
target_link_libraries(ojph_expand PUBLIC openjph)
target_link_libraries(ojph_expand PRIVATE openjph)
endif()

install(TARGETS ojph_expand DESTINATION bin)
install(TARGETS ojph_expand
EXPORT openjph-config
)

endif()
9 changes: 5 additions & 4 deletions src/apps/ojph_stream_expand/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

if (OJPH_BUILD_STREAM_EXPAND)

include_directories(../common)
include_directories(../../core/common)
set(CMAKE_CXX_STANDARD 14)

file(GLOB OJPH_STREAM_EXPAND "*.cpp" "*.h")
file(GLOB OJPH_SOCKETS "../others/ojph_sockets.cpp")
file(GLOB OJPH_SOCKETS_H "../common/ojph_sockets.h")
Expand All @@ -20,12 +18,15 @@ if (OJPH_BUILD_STREAM_EXPAND)
source_group("common" FILES ${OJPH_SOCKETS_H} ${OJPH_THREADS_H})

add_executable(ojph_stream_expand ${SOURCES})
target_include_directories(ojph_stream_expand PRIVATE ../common)
if(MSVC)
target_link_libraries(ojph_stream_expand PUBLIC openjph ws2_32)
else()
target_link_libraries(ojph_stream_expand PUBLIC openjph pthread)
endif(MSVC)

install(TARGETS ojph_stream_expand DESTINATION bin)
install(TARGETS ojph_stream_expand
EXPORT openjph-config
)

endif(OJPH_BUILD_STREAM_EXPAND)
19 changes: 13 additions & 6 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

include_directories(common)

file(GLOB CODESTREAM "codestream/*.cpp" "codestream/*.h")
file(GLOB CODESTREAM_SSE "codestream/*_sse.cpp")
file(GLOB CODESTREAM_SSE2 "codestream/*_sse2.cpp")
Expand Down Expand Up @@ -38,11 +36,10 @@ if(EMSCRIPTEN)
add_library(openjph ${SOURCES})
add_library(openjphsimd ${SOURCES} ${CODESTREAM_WASM} ${CODING_WASM} ${TRANSFORM_WASM})

target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include>)
target_include_directories(openjphsimd PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include>)

target_compile_options(openjphsimd PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128)

target_include_directories(openjphsimd PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include/openjph>)

source_group("codestream" FILES ${CODESTREAM_WASM})
source_group("coding" FILES ${CODING_WASM})
source_group("transform" FILES ${TRANSFORM_WASM})
Expand Down Expand Up @@ -124,8 +121,8 @@ if (BUILD_SHARED_LIBS AND WIN32)
endif()

## include library version/name
target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include>)
target_compile_definitions(openjph PUBLIC _FILE_OFFSET_BITS=64)
target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include/openjph>)

if (MSVC)
set(OJPH_LIB_NAME_STRING "openjph.${OPENJPH_VERSION_MAJOR}.${OPENJPH_VERSION_MINOR}")
Expand All @@ -139,3 +136,13 @@ else()
SOVERSION "${OPENJPH_VERSION_MAJOR}.${OPENJPH_VERSION_MINOR}"
VERSION "${OPENJPH_VERSION}")
endif()

install(TARGETS openjph
EXPORT openjph-config
)

install(DIRECTORY common/
DESTINATION include/openjph
FILES_MATCHING
PATTERN "*.h"
)