-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvement to CMakeLists.txt files. Now, in windows, tiff library fi…
…les are copied to the bin folder.
- Loading branch information
Showing
3 changed files
with
145 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,58 @@ | ||
# Add tiff library | ||
############################################################ | ||
if( OJPH_ENABLE_TIFF_SUPPORT ) | ||
|
||
if( MSVC ) | ||
|
||
set(TIFF_INCLUDE_DIR "C:\\Program Files\\tiff\\include" CACHE PATH "the directory containing the TIFF headers") | ||
set(TIFF_LIBRARY_DEBUG "C:\\Program Files\\tiff\\lib\\tiffd.lib" CACHE FILEPATH "the path to the TIFF library for debug configurations") | ||
set(TIFF_LIBRARY_RELEASE "C:\\Program Files\\tiff\\lib\\tiff.lib" CACHE FILEPATH "the path to the TIFF library for release configurations") | ||
set(TIFFXX_LIBRARY_DEBUG "C:\\Program Files\\tiff\\lib\\tiffxxd.lib" CACHE FILEPATH "the path to the TIFFXX library for debug configurations") | ||
set(TIFFXX_LIBRARY_RELEASE "C:\\Program Files\\tiff\\lib\\tiffxx.lib" CACHE FILEPATH "the path to the TIFFXX library for release configurations") | ||
|
||
message( STATUS "WIN32 detected: Setting CMakeCache TIFF values as follows, use CMake-gui Advanced to modify them" ) | ||
message( STATUS " TIFF_INCLUDE_DIR : \"${TIFF_INCLUDE_DIR}\" " ) | ||
message( STATUS " TIFF_LIBRARY_DEBUG : \"${TIFF_LIBRARY_DEBUG}\" " ) | ||
message( STATUS " TIFF_LIBRARY_RELEASE : \"${TIFF_LIBRARY_RELEASE}\" " ) | ||
message( STATUS " TIFFXX_LIBRARY_DEBUG : \"${TIFFXX_LIBRARY_DEBUG}\" " ) | ||
message( STATUS " TIFFXX_LIBRARY_RELEASE : \"${TIFFXX_LIBRARY_RELEASE}\" " ) | ||
|
||
endif( MSVC ) | ||
|
||
FIND_PACKAGE( TIFF ) | ||
|
||
if( TIFF_FOUND ) | ||
set(USE_TIFF TRUE CACHE BOOL "Add TIFF support") | ||
include_directories( ${TIFF_INCLUDE_DIR} ) | ||
add_definitions(-DOJPH_ENABLE_TIFF_SUPPORT) | ||
endif( TIFF_FOUND ) | ||
|
||
endif() | ||
############################################################ | ||
|
||
## Change folders | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../lib) | ||
|
||
## Build executables | ||
add_subdirectory(ojph_expand) | ||
add_subdirectory(ojph_compress) | ||
|
||
if(OJPH_BUILD_EXECUTABLES) | ||
|
||
# Add tiff library | ||
############################################################ | ||
if( OJPH_ENABLE_TIFF_SUPPORT ) | ||
|
||
if( MSVC ) | ||
|
||
set(TIFF_PATH "C:\\Program Files\\tiff") | ||
set(TIFF_INCLUDE_DIR "${TIFF_PATH}\\include" CACHE PATH "the directory containing the TIFF headers") | ||
set(TIFF_LIBRARY_DEBUG "${TIFF_PATH}\\lib\\tiffd.lib" CACHE FILEPATH "the path to the TIFF library for debug configurations") | ||
set(TIFF_LIBRARY_RELEASE "${TIFF_PATH}\\lib\\tiff.lib" CACHE FILEPATH "the path to the TIFF library for release configurations") | ||
set(TIFFXX_LIBRARY_DEBUG "${TIFF_PATH}\\lib\\tiffxxd.lib" CACHE FILEPATH "the path to the TIFFXX library for debug configurations") | ||
set(TIFFXX_LIBRARY_RELEASE "${TIFF_PATH}\\lib\\tiffxx.lib" CACHE FILEPATH "the path to the TIFFXX library for release configurations") | ||
|
||
message( STATUS "WIN32 detected: Setting CMakeCache TIFF values as follows, use CMake-gui Advanced to modify them" ) | ||
message( STATUS " TIFF_INCLUDE_DIR : \"${TIFF_INCLUDE_DIR}\" " ) | ||
message( STATUS " TIFF_LIBRARY_DEBUG : \"${TIFF_LIBRARY_DEBUG}\" " ) | ||
message( STATUS " TIFF_LIBRARY_RELEASE : \"${TIFF_LIBRARY_RELEASE}\" " ) | ||
message( STATUS " TIFFXX_LIBRARY_DEBUG : \"${TIFFXX_LIBRARY_DEBUG}\" " ) | ||
message( STATUS " TIFFXX_LIBRARY_RELEASE : \"${TIFFXX_LIBRARY_RELEASE}\" " ) | ||
|
||
endif( MSVC ) | ||
|
||
FIND_PACKAGE( TIFF ) | ||
|
||
if( TIFF_FOUND ) | ||
set(USE_TIFF TRUE CACHE BOOL "Add TIFF support") | ||
include_directories( ${TIFF_INCLUDE_DIR} ) | ||
add_definitions(-DOJPH_ENABLE_TIFF_SUPPORT) | ||
endif( TIFF_FOUND ) | ||
|
||
endif() | ||
############################################################ | ||
|
||
## Change folders | ||
This comment has been minimized.
Sorry, something went wrong. |
||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../bin) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../lib) | ||
|
||
## 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 "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") | ||
file(COPY "${TIFF_PATH}\\bin\\tiffxx.dll" DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") | ||
elseif(CMAKE_BUILD_TYPE MATCHES "Debug") | ||
file(COPY "${TIFF_PATH}\\bin\\tiffd.dll" DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") | ||
file(COPY "${TIFF_PATH}\\bin\\tiffxxd.dll" DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") | ||
endif() | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,53 @@ | ||
## building ojph_compress | ||
######################### | ||
|
||
if(OJPH_BUILD_EXECUTABLES) | ||
|
||
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") | ||
file(GLOB OJPH_IMG_IO_AVX2 "../others/ojph_img_io_avx2.cpp") | ||
file(GLOB OJPH_IMG_IO_H "../common/ojph_img_io.h") | ||
|
||
list(APPEND SOURCES ${OJPH_COMPRESS} ${OJPH_IMG_IO} ${OJPH_IMG_IO_H}) | ||
|
||
source_group("main" FILES ${OJPH_COMPRESS}) | ||
source_group("others" FILES ${OJPH_IMG_IO}) | ||
source_group("common" FILES ${OJPH_IMG_IO_H}) | ||
|
||
if(EMSCRIPTEN) | ||
add_compile_options(-std=c++11 -O3 -fexceptions -DOJPH_DISABLE_INTEL_SIMD) | ||
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_link_libraries(ojph_compress_simd PRIVATE openjphsimd) | ||
install(TARGETS ojph_compress_simd DESTINATION bin) | ||
else() | ||
if(NOT OJPH_DISABLE_INTEL_SIMD) | ||
add_executable(ojph_compress ${SOURCES} ${OJPH_IMG_IO_SSE4} ${OJPH_IMG_IO_AVX2}) | ||
|
||
if (MSVC) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS "/arch:AVX2") | ||
else() | ||
set_source_files_properties(${OJPH_IMG_IO_SSE4} PROPERTIES COMPILE_FLAGS -msse4.1) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS -mavx2) | ||
endif() | ||
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") | ||
file(GLOB OJPH_IMG_IO_AVX2 "../others/ojph_img_io_avx2.cpp") | ||
file(GLOB OJPH_IMG_IO_H "../common/ojph_img_io.h") | ||
|
||
list(APPEND SOURCES ${OJPH_COMPRESS} ${OJPH_IMG_IO} ${OJPH_IMG_IO_H}) | ||
|
||
source_group("main" FILES ${OJPH_COMPRESS}) | ||
source_group("others" FILES ${OJPH_IMG_IO}) | ||
source_group("common" FILES ${OJPH_IMG_IO_H}) | ||
|
||
if(EMSCRIPTEN) | ||
add_compile_options(-std=c++11 -O3 -fexceptions -DOJPH_DISABLE_INTEL_SIMD) | ||
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_link_libraries(ojph_compress_simd PRIVATE openjphsimd) | ||
install(TARGETS ojph_compress_simd DESTINATION bin) | ||
else() | ||
if(NOT OJPH_DISABLE_INTEL_SIMD) | ||
add_executable(ojph_compress ${SOURCES} ${OJPH_IMG_IO_SSE4} ${OJPH_IMG_IO_AVX2}) | ||
|
||
if (MSVC) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS "/arch:AVX2") | ||
else() | ||
add_executable(ojph_compress ${SOURCES}) | ||
endif() | ||
|
||
if( USE_TIFF ) | ||
target_link_libraries(ojph_compress PUBLIC openjph ${TIFF_LIBRARIES}) | ||
else() | ||
target_link_libraries(ojph_compress PUBLIC openjph) | ||
set_source_files_properties(${OJPH_IMG_IO_SSE4} PROPERTIES COMPILE_FLAGS -msse4.1) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS -mavx2) | ||
endif() | ||
else() | ||
add_executable(ojph_compress ${SOURCES}) | ||
endif() | ||
|
||
install(TARGETS ojph_compress DESTINATION bin) | ||
if( USE_TIFF ) | ||
target_link_libraries(ojph_compress PUBLIC openjph ${TIFF_LIBRARIES}) | ||
else() | ||
target_link_libraries(ojph_compress PUBLIC openjph) | ||
endif() | ||
|
||
install(TARGETS ojph_compress DESTINATION bin) | ||
|
||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,52 @@ | ||
## building ojph_expand | ||
####################### | ||
|
||
if(OJPH_BUILD_EXECUTABLES) | ||
|
||
include_directories(../common) | ||
include_directories(../../core/common) | ||
|
||
file(GLOB OJPH_EXPAND "ojph_expand.cpp") | ||
file(GLOB OJPH_IMG_IO "../others/ojph_img_io.cpp") | ||
file(GLOB OJPH_IMG_IO_SSE4 "../others/ojph_img_io_sse41.cpp") | ||
file(GLOB OJPH_IMG_IO_AVX2 "../others/ojph_img_io_avx2.cpp") | ||
file(GLOB OJPH_IMG_IO_H "../common/ojph_img_io.h") | ||
|
||
list(APPEND SOURCES ${OJPH_EXPAND} ${OJPH_IMG_IO} ${OJPH_IMG_IO_H}) | ||
|
||
source_group("main" FILES ${OJPH_EXPAND}) | ||
source_group("others" FILES ${OJPH_IMG_IO}) | ||
source_group("common" FILES ${OJPH_IMG_IO_H}) | ||
|
||
if(EMSCRIPTEN) | ||
add_compile_options(-std=c++11 -O3 -fexceptions -DOJPH_DISABLE_INTEL_SIMD) | ||
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) | ||
else() | ||
if(NOT OJPH_DISABLE_INTEL_SIMD) | ||
add_executable(ojph_expand ${SOURCES} ${OJPH_IMG_IO_SSE4} ${OJPH_IMG_IO_AVX2}) | ||
|
||
if (MSVC) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS "/arch:AVX2") | ||
else() | ||
set_source_files_properties(${OJPH_IMG_IO_SSE4} PROPERTIES COMPILE_FLAGS -msse4.1) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS -mavx2) | ||
endif() | ||
else() | ||
add_executable(ojph_expand ${SOURCES}) | ||
endif() | ||
|
||
if( USE_TIFF ) | ||
target_link_libraries(ojph_expand PUBLIC openjph ${TIFF_LIBRARIES}) | ||
include_directories(../common) | ||
include_directories(../../core/common) | ||
|
||
file(GLOB OJPH_EXPAND "ojph_expand.cpp") | ||
file(GLOB OJPH_IMG_IO "../others/ojph_img_io.cpp") | ||
file(GLOB OJPH_IMG_IO_SSE4 "../others/ojph_img_io_sse41.cpp") | ||
file(GLOB OJPH_IMG_IO_AVX2 "../others/ojph_img_io_avx2.cpp") | ||
file(GLOB OJPH_IMG_IO_H "../common/ojph_img_io.h") | ||
|
||
list(APPEND SOURCES ${OJPH_EXPAND} ${OJPH_IMG_IO} ${OJPH_IMG_IO_H}) | ||
|
||
source_group("main" FILES ${OJPH_EXPAND}) | ||
source_group("others" FILES ${OJPH_IMG_IO}) | ||
source_group("common" FILES ${OJPH_IMG_IO_H}) | ||
|
||
if(EMSCRIPTEN) | ||
add_compile_options(-std=c++11 -O3 -fexceptions -DOJPH_DISABLE_INTEL_SIMD) | ||
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) | ||
else() | ||
if(NOT OJPH_DISABLE_INTEL_SIMD) | ||
add_executable(ojph_expand ${SOURCES} ${OJPH_IMG_IO_SSE4} ${OJPH_IMG_IO_AVX2}) | ||
|
||
if (MSVC) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS "/arch:AVX2") | ||
else() | ||
target_link_libraries(ojph_expand PUBLIC openjph) | ||
set_source_files_properties(${OJPH_IMG_IO_SSE4} PROPERTIES COMPILE_FLAGS -msse4.1) | ||
set_source_files_properties(${OJPH_IMG_IO_AVX2} PROPERTIES COMPILE_FLAGS -mavx2) | ||
endif() | ||
else() | ||
add_executable(ojph_expand ${SOURCES}) | ||
endif() | ||
|
||
install(TARGETS ojph_expand DESTINATION bin) | ||
if( USE_TIFF ) | ||
target_link_libraries(ojph_expand PUBLIC openjph ${TIFF_LIBRARIES}) | ||
else() | ||
target_link_libraries(ojph_expand PUBLIC openjph) | ||
endif() | ||
|
||
install(TARGETS ojph_expand DESTINATION bin) | ||
|
||
endif() |
Please just use GnuInstallDirs and don't change these explicitly. If it's needed somehow for MSVC builds (although most projects seem to go by without changing anything there either), then set them for MSVC only...