Skip to content

Commit 4d4f4e8

Browse files
authored
Merges PR #236, and another two smaller issues. (#237)
There are three changes here. The first is the most important. Change 1: Thank you @cary-ilm * Rename src/core/common to src/core/openjph OpenJPH headers are included in application code via `#include <openjph/ojph_version.h>`. The headers are expected to be in a folder named "openjph". The cmake configuration places them there in the installation step. However, if OpenJPH is incorporated into an application via cmake's `add_subdirectory`, there is no installation step, so there is no "openjph" folder, leading the `#include <openjph/ojph_version.h>` to fail. Renaming the "common" directory to "openjph" resolves the build issue, since the headers then live inside the source tree in a directory with same name as the installation. The use of the "common" directory name is entirely internal to the OpenJPH build, it has no impact on the installation. The name should be arbitrary, so there should be no downside to renaming it this way. Signed-off-by: Cary Phillips <cary@ilm.com> * This fixes PR compilation --------- Signed-off-by: Cary Phillips <cary@ilm.com> Co-authored-by: Cary Phillips <cary@ilm.com> Change 2: Message type constants are not descriptive enough, and they maybe inadvertently replaced by a preprocessor macro. They are: ``` enum OJPH_MSG_LEVEL : int { ALL_MSG = 0, // uninitialized or print all message INFO = 1, // info message WARN = 2, // warning message ERROR = 3, // error message (the highest severity) NO_MSG = 4, // no message (higher severity for message printing only) }; ``` They were replaced with ``` enum OJPH_MSG_LEVEL : int { OJPH_MSG_ALL_MSG = 0, // uninitialized or print all message OJPH_MSG_INFO = 1, // info message OJPH_MSG_WARN = 2, // warning message OJPH_MSG_ERROR = 3, // error message (the highest severity) OJPH_MSG_NO_MSG = 4, // no message (higher severity for message printing only) }; ``` which is less like to have the identified issues. Change 3: Addresses the problem identified in @clshortfuse in issue #235
1 parent a1d29da commit 4d4f4e8

File tree

14 files changed

+8
-8
lines changed

14 files changed

+8
-8
lines changed

ojph_version.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Parse version file
77
# credit: https://stackoverflow.com/a/47084079
88

9-
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/core/common/ojph_version.h" VERFILE)
9+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/core/openjph/ojph_version.h" VERFILE)
1010
if (NOT VERFILE)
1111
message(FATAL_ERROR "Failed to parse ojph_version.h!")
1212
endif()

src/apps/ojph_expand/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if(EMSCRIPTEN)
2121
endif()
2222
else()
2323
if (NOT OJPH_DISABLE_SIMD)
24-
if (("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_X86_64")
24+
if (("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_X86_64")
2525
OR ("${OJPH_TARGET_ARCH}" MATCHES "OJPH_ARCH_I386")
2626
OR MULTI_GEN_X86_64)
2727

src/core/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ file(GLOB CODING_SSSE3 "coding/*_ssse3.cpp")
1010
file(GLOB CODING_WASM "coding/*_wasm.cpp")
1111
file(GLOB CODING_AVX2 "coding/*_avx2.cpp")
1212
file(GLOB CODING_AVX512 "coding/*_avx512.cpp")
13-
file(GLOB COMMON "common/*.h")
13+
file(GLOB COMMON "openjph/*.h")
1414
file(GLOB OTHERS "others/*.cpp" "others/*.c")
1515
file(GLOB TRANSFORM "transform/*.cpp" "transform/*.h")
1616
file(GLOB TRANSFORM_SSE "transform/*_sse.cpp")
@@ -137,7 +137,7 @@ endif()
137137
## include library version/name
138138
set_target_properties(openjph PROPERTIES POSITION_INDEPENDENT_CODE ON)
139139
target_compile_definitions(openjph PUBLIC _FILE_OFFSET_BITS=64)
140-
target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include>)
140+
target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/openjph> $<INSTALL_INTERFACE:include>)
141141

142142
## This is to check if aligned_alloc or posix_memalign is available
143143
# We want the code to compile for C11 and C++11.
@@ -173,7 +173,7 @@ install(TARGETS openjph
173173
EXPORT openjph-targets
174174
)
175175

176-
install(DIRECTORY common/
176+
install(DIRECTORY openjph/
177177
DESTINATION include/openjph
178178
FILES_MATCHING
179179
PATTERN "*.h"

0 commit comments

Comments
 (0)