Skip to content

https://github.com/sqlite/sqlite/pull/10#issuecomment-1538376858 - #2

Merged
rhuijben merged 1 commit into
rhuijben:masterfrom
nono303:master
May 14, 2023
Merged

rhuijben merged 1 commit into
rhuijben:masterfrom
nono303:master

Conversation

@nono303

@nono303 nono303 commented May 14, 2023

Copy link
Copy Markdown

Hi @rhuijben,
You may have seen the PR https://github.com/sqlite/sqlite/pull/10 and as it might take time for sqlite forum community to validate or alow it… I propose to merge @jingyu CMakeLists.txt on your repository to be tested and reviewed

@rhuijben
rhuijben merged commit fb4702b into rhuijben:master May 14, 2023
@rhuijben

Copy link
Copy Markdown
Owner

Thanks. Huge patch, so please follow up if you might find something breaking bases on this.

@nono303

nono303 commented May 15, 2023

Copy link
Copy Markdown
Author

Fyi, my cmake cmd line used on windows:

cmake -G "Ninja" ^
-DCMAKE_INSTALL_PREFIX=C:\sdk\release\vs17_x64-avx ^
-DCMAKE_BUILD_TYPE=RelWithDebInfo ^
-DCMAKE_REQUIRED_INCLUDES=C:\sdk\release\vs17_x64-avx\include ^
-DENABLE_SHARED=ON ^
-DSHAREDLIB_PREFIX=lib ^
-DENABLE_STATIC=OFF ^
-DBUILD_SHELL=ON ^
-DENABLE_STATIC_SHELL=OFF ^
-DENABLE_EDITLINE=OFF ^
-DENABLE_READLINE=OFF ^
-DENABLE_THREADSAFE=ON ^
-DENABLE_DYNAMIC_EXTENSIONS=ON ^
-DENABLE_MATH=ON ^
-DENABLE_FTS4=ON ^
-DENABLE_FTS3=OFF ^
-DENABLE_FTS5=ON ^
-DENABLE_RTREE=ON ^
-DENABLE_SESSION=OFF ^
-DENABLE_DEBUG=OFF ^
-DRECOMMENDED_OPTIONS=ON ^
-DENABLE_COLUMN_METADATA=ON ^
-DENABLE_DBSTAT_VTAB=ON ^
-DENABLE_ICU=ON ^
-DICU_ROOT=C:\sdk\release\vs17_x64-avx ^
-DENABLE_RBU=ON ^
-DENABLE_STAT4=ON ^
-DOMIT_JSON=OFF ^
-DOMIT_DECLTYPE=OFF ^
-DOMIT_AUTOINIT=OFF ^
-DUSE_URI=OFF ^
-DWIN32_MALLOC=ON ^
-DWIN32_HEAP_CREATE=ON ^
-DBUILD_WITH_XPSDK=OFF ^
C:\sdk\src\sqlite

@rhuijben

Copy link
Copy Markdown
Owner

@nono303

nono303 commented May 15, 2023

Copy link
Copy Markdown
Author

Hi @rhuijben
Ok OK sorry, I don’t have a Linux system to test ^^
Had fixed issues #3

  • CMakeLists.txt:480
    • Added sqlite3.pc.in (or just comment l. 480 as you want)
  • CMakeLists.txt:525
    • $<INSTALL_INTERFACE:include> is empty and ${CMAKE_REQUIRED_INCLUDES} need to be set in cmd line (bad idea indeed!). I changed it to ${CMAKE_INSTALL_PREFIX}/include but if you find or say me why $<INSTALL_INTERFACE:include> is empty I’ll be happy to know!
  • CMakeLists.txt:533
    • copy paste without changing old target name…
diff --git "a/CMakeLists.txt" "b/CMakeLists.txt"
index 400c17f..c2da259 100644
--- "a/CMakeLists.txt"
+++ "b/CMakeLists.txt"
@@ -488,7 +488,7 @@ if(ENABLE_SHARED)
     add_library(sqlite3-shared SHARED ${SQLITE3_LIB_SRC})
     target_compile_definitions(sqlite3-shared PRIVATE ${SQLITE_API_DECL})
     target_link_libraries(sqlite3-shared ${SQLITE3_DEP_LIBRARIES})
-    target_include_directories(sqlite3-shared PUBLIC ${CMAKE_REQUIRED_INCLUDES})
+    target_include_directories(sqlite3-shared PUBLIC ${CMAKE_INSTALL_PREFIX}/include)
     set_target_properties(sqlite3-shared PROPERTIES
         OUTPUT_NAME ${SHAREDLIB_PREFIX}${PROJECT_NAME}
         VERSION ${PROJECT_VERSION}
@@ -522,7 +522,7 @@ if(BUILD_SHELL)
     if(ENABLE_STATIC_SHELL)
         add_dependencies(sqlite3 sqlite3-static)
         target_link_libraries(sqlite3 sqlite3-static ${SQLITE3_DEP_LIBRARIES})
-        target_include_directories(sqlite3 sqlite3-static PUBLIC ${CMAKE_REQUIRED_INCLUDES})
+        target_include_directories(sqlite3 sqlite3-static PUBLIC ${CMAKE_INSTALL_PREFIX}/include)
     else()
         add_dependencies(sqlite3 sqlite3-shared)
         target_link_libraries(sqlite3 sqlite3-shared)
@@ -530,7 +530,7 @@ if(BUILD_SHELL)
 
     if(UNIX)
         if(CMAKE_BUILD_TYPE STREQUAL Release)
-            add_custom_command(TARGET shell_app POST_BUILD
+            add_custom_command(TARGET sqlite3 POST_BUILD
                 COMMAND ${CMAKE_STRIP} ${EXE_NAME}
             )
         endif()

@rhuijben

Copy link
Copy Markdown
Owner

@nono303 applied most of the patch, but used a different approach for the final step.

With that I get the build going, but the library name is still broken.
image

I was guessing that was only in the trace output yesterday, but that name is really there

@nono303

nono303 commented May 17, 2023

Copy link
Copy Markdown
Author

...different approach for the final step

👌

...but that name is really there

Yes and that need an quick explanation as for Windows build, symbols file (pdb) take the name of the target
As the shared lib and shell app have the same OUTPUT_NAME : there is a conflict in the installed pdb (see l.500 & l.549)
My idea is to have an option SHAREDLIB_PREFIX that can (or not) be set as 'lib' for example, to prefix the OUTPUT_NAME of all shared lib (only) released files (dll, lib, pdb)
Based on f2d623b, could you test with this patch (another bad copy-paste & a missing property on the rewrite of the final step)

diff --git "a/CMakeLists.txt" "b/CMakeLists.txt"
index 405d654..c14620a 100644
--- "a/CMakeLists.txt"
+++ "b/CMakeLists.txt"
@@ -425,7 +425,7 @@ else()
 endif()
 
 message(STATUS "Build shared library:                                 ${ENABLE_SHARED}")
-message(STATUS "Shared library name:                                  ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}")
+message(STATUS "Shared library name:                                  ${SHAREDLIB_PREFIX}${PROJECT_NAME}")
 message(STATUS "Build static library:                                 ${ENABLE_STATIC}")
 message(STATUS "Build shell tool:                                     ${BUILD_SHELL}")
 message(STATUS "Statically link shell tool:                           ${ENABLE_STATIC_SHELL}")
@@ -489,7 +489,7 @@ if(ENABLE_SHARED)
     target_link_libraries(sqlite3-shared ${SQLITE3_DEP_LIBRARIES})
     target_include_directories(sqlite3-shared PUBLIC ${CMAKE_INSTALL_PREFIX}/include)
     set_target_properties(sqlite3-shared PROPERTIES
-        OUTPUT_NAME ${PROJECT_NAME}
+        OUTPUT_NAME ${SHAREDLIB_PREFIX}${PROJECT_NAME}
         VERSION ${PROJECT_VERSION}
         SOVERSION ${PROJECT_VERSION_MAJOR})

this should give equivalent trace on Linux (without pdb install and dll > so)

  1. with -DSHAREDLIB_PREFIX=lib cmake option:
...
-- Shared library name:                                  libsqlite3
...
-- Installing: C:/sdk/release/vs17_x64-avx/lib/libsqlite3.lib
-- Installing: C:/sdk/release/vs17_x64-avx/bin/libsqlite3.dll
-- Installing: C:/sdk/release/vs17_x64-avx/bin/libsqlite3.pdb
...
  1. without SHAREDLIB_PREFIX cmake option:
...
-- Shared library name:                                  sqlite3
...
-- Installing: C:/sdk/release/vs17_x64-avx/lib/sqlite3.lib
-- Installing: C:/sdk/release/vs17_x64-avx/bin/sqlite3.dll
-- Installing: C:/sdk/release/vs17_x64-avx/bin/sqlite3.pdb
...

I does a last "copy-paste fury" review and everything should work fine for everyone after this patch ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants