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

Linux: Allow for conditional use of system SQLite library instead of bundled #205

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
43 changes: 43 additions & 0 deletions package-system/sqlite/FindSQLite.cmake.Linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#

set(MY_NAME "SQLite")
set(TARGET_WITH_NAMESPACE "3rdParty::${MY_NAME}")
if (TARGET ${TARGET_WITH_NAMESPACE})
return()
endif()

if (LY_SYSTEM_PACKAGE_${MY_NAME})

find_package(SQLite3)
if (NOT SQLite3_FOUND)
message(FATAL_ERROR "LY_SYSTEM_PACKAGE_${MY_NAME} specified but development files for ${MY_NAME} not found.")
else()
set_target_properties(SQLite::SQLite3 PROPERTIES LY_SYSTEM_LIBRARY TRUE)
add_library(${TARGET_WITH_NAMESPACE} ALIAS SQLite::SQLite3)
set(${MY_NAME}_FOUND True)
endif()

else()

set(${MY_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/SQLite)
set(${MY_NAME}_LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/SQLite/lib)
set(${MY_NAME}_LIBRARY ${${MY_NAME}_LIBS_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}sqlite3${CMAKE_STATIC_LIBRARY_SUFFIX})

add_library(${TARGET_WITH_NAMESPACE} STATIC IMPORTED GLOBAL)

set_target_properties(${TARGET_WITH_NAMESPACE} PROPERTIES IMPORTED_LOCATION "${${MY_NAME}_LIBRARY}")

ly_target_include_system_directories(TARGET ${TARGET_WITH_NAMESPACE} INTERFACE ${${MY_NAME}_INCLUDE_DIR})

target_link_libraries(${TARGET_WITH_NAMESPACE}
INTERFACE ${CMAKE_DL_LIBS})

set(${MY_NAME}_FOUND True)

endif()
4 changes: 3 additions & 1 deletion package-system/sqlite/build_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"package_url":"https://www.sqlite.org",
"package_license":"CUSTOM",
"package_license_file":"copyright.txt",
"cmake_find_source":"FindSQLite.cmake",
"cmake_find_target":"FindSQLite.cmake",
"additional_src_files":[
"copyright.txt"
],
"Platforms":{
"Windows":{
"Windows":{
"cmake_find_source":"FindSQLite.cmake.NonLinux",
"package_version":"3.37.2-rev1",
"custom_build_cmd": [
"build_windows.cmd"
Expand All @@ -24,6 +24,7 @@
},
"Darwin":{
"Mac":{
"cmake_find_source":"FindSQLite.cmake.NonLinux",
"package_version":"3.37.2-rev2",
"custom_build_cmd": [
"./build_unix_like.sh"
Expand All @@ -35,6 +36,7 @@
},
"Linux":{
"Linux":{
"cmake_find_source":"FindSQLite.cmake.Linux",
"package_version":"3.37.2-rev1",
"custom_build_cmd": [
"./build_unix_like.sh"
Expand Down