Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make ktx target includes and libs private #3

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
28 changes: 19 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ add_library( ktx_read ${LIB_TYPE}
${KTX_MAIN_SRC}
)

macro(commom_lib_settings lib write )
macro(commom_lib_settings lib write)

set_target_properties(${lib} PROPERTIES
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/ktx.h
Expand Down Expand Up @@ -209,7 +209,7 @@ macro(commom_lib_settings lib write )
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>

PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/basisu/transcoder>
$<INSTALL_INTERFACE:lib/basisu/transcoder>

Expand Down Expand Up @@ -285,6 +285,7 @@ macro(commom_lib_settings lib write )
if(WIN32)
target_link_libraries(
${lib}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/other_lib/win/Release-x64/zstd_static.lib
)
# By wrapping in generator expression we force multi configuration generators (like Visual Studio)
Expand All @@ -295,47 +296,59 @@ macro(commom_lib_settings lib write )
if(IOS)
target_link_libraries(
${lib}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/other_lib/ios/Release-iphoneos/libzstd.a
)
)
else()
# Set a common RUNTIME_OUTPUT_DIR for all target, so that INSTALL RPATH
# is functional in build directory as well. BUILD_WITH_INSTALL_RPATH is necessary
# for working code signing.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${KTX_BUILD_DIR}/$<CONFIG>>)
target_link_libraries(
${lib}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/other_lib/mac/Release/libzstd.a
)
)
endif()

elseif(EMSCRIPTEN)
target_sources(
${lib}
PRIVATE
lib/zstddeclib.c
)

elseif(LINUX)
find_package(zstd REQUIRED)
find_package(Threads REQUIRED)
target_link_libraries(
${lib}
PUBLIC
dl
Threads::Threads
)
target_link_libraries(
${lib}
PRIVATE
zstd::zstd
)

elseif(ANDROID)
# add_library(zstd STATIC IMPORTED)
# set_target_properties(zstd PROPERTIES
# IMPORTED_LOCATION /Users/Shared/SDK/zstd/build/cmake/install-android/lib/libzstd.a
# )
# target_link_libraries(
# ktx
# PRIVATE
# zstd
# )
set(ZSTD_BUILD_PROGRAMS OFF)
set(ZSTD_BUILD_TESTS OFF)
add_subdirectory(/Users/Shared/SDK/zstd/build/cmake zstd)
target_link_libraries(
${lib}
PRIVATE
libzstd_static
)
endif()
Expand All @@ -351,7 +364,7 @@ macro(commom_lib_settings lib write )
)
target_include_directories(
${lib}
PUBLIC
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/dfdutils>
$<INSTALL_INTERFACE:lib/dfdutils>
)
Expand Down Expand Up @@ -426,10 +439,7 @@ PRIVATE
)
target_include_directories(
ktx
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib>
$<INSTALL_INTERFACE:lib>

PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/basisu>
$<INSTALL_INTERFACE:lib/basisu>
)
Expand Down
2 changes: 1 addition & 1 deletion interface/basisu_c_binding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ target_include_directories(
PUBLIC
inc
PRIVATE
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/utils
)

Expand Down
2 changes: 1 addition & 1 deletion tests/loadtests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ target_include_directories(
PUBLIC
${SDL2_INCLUDE_DIRS}
appfwSDL
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/other_include
${PROJECT_SOURCE_DIR}/utils
Expand Down
2 changes: 1 addition & 1 deletion tests/loadtests/glloadtests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function( create_gl_target target sources KTX_GL_CONTEXT_PROFILE KTX_GL_CONTEXT_
PRIVATE
$<TARGET_PROPERTY:appfwSDL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:GLAppSDL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:objUtil,INTERFACE_INCLUDE_DIRECTORIES>
)

Expand Down
2 changes: 1 addition & 1 deletion tests/loadtests/vkloadtests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ target_include_directories(
PRIVATE
${SDL2_INCLUDE_DIRS}
$<TARGET_PROPERTY:appfwSDL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:objUtil,INTERFACE_INCLUDE_DIRECTORIES>
appfwSDL/VulkanAppSDL
vkloadtests
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ add_executable( unittests
target_include_directories(
unittests
PRIVATE
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/lib
)

Expand All @@ -39,7 +39,7 @@ add_executable( texturetests
target_include_directories(
texturetests
PRIVATE
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/other_include
${PROJECT_SOURCE_DIR}/lib
unittests
Expand Down
2 changes: 1 addition & 1 deletion tests/transcodetests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ add_executable( transcodetests
target_include_directories(
transcodetests
PRIVATE
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:obj_basisu_cbind,INTERFACE_INCLUDE_DIRECTORIES>
${CMAKE_CURRENT_SOURCE_DIR}/../../other_include
${CMAKE_CURRENT_SOURCE_DIR}/../../lib
Expand Down
2 changes: 1 addition & 1 deletion tools/ktx2check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_include_directories(
ktx2check
PRIVATE
.
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:objUtil,INTERFACE_INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/other_include
Expand Down
2 changes: 1 addition & 1 deletion tools/ktx2ktx2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_include_directories(
ktx2ktx2
PRIVATE
.
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:objUtil,INTERFACE_INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/other_include
Expand Down
2 changes: 1 addition & 1 deletion tools/ktxinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_include_directories(
ktxinfo
PRIVATE
.
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:objUtil,INTERFACE_INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/lib
)
Expand Down
2 changes: 1 addition & 1 deletion tools/ktxsc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_include_directories(
ktxsc
PRIVATE
.
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:objUtil,INTERFACE_INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/other_include
Expand Down
2 changes: 1 addition & 1 deletion tools/toktx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ target_include_directories(
toktx
PRIVATE
.
$<TARGET_PROPERTY:ktx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:objUtil,INTERFACE_INCLUDE_DIRECTORIES>
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/lib/basisu
Expand Down