[Maria-developers] Patch: Separate builddir from src dir with cmake
Hi everyone, I have updated the attached patch to apply to the 5.1 tree. Please see the comments in my original mail below. Any objections to apply this patch? -------- Original Meddelelse -------- Subject: Separate builddir from src dir with cmake Date: Mon, 12 Jul 2010 14:01:23 +0200 From: Bo Thorsen <bo@askmonty.org> Organization: Monty Program AB To: maria-developers@lists.launchpad.net Hi people, Our cmake scripts weren't able to build outside the source dir. This is bad for 3 reasons: - it's supposed to work - cmake recommends building outside the src dir - on Windows, cmake can't build 32 and 64 bit in the same solution, so patches has to be manually copied to test compilation on the other The attached patch fixes all the issues. I ran a find on the source dir before and after the the build, and they were identical. I didn't actually check that no existing files we're modified, but bzr di claim this isn't the case. I didn't port the zip creation script, but that shouldn't be a problem. src != blddir is more a development thing, and the buildbot slave producing the zip file will just continue to build in the same dir. The cpack installer builds just fine. OK to push to 5.1? Should I send this patch to the Oracle as well to minimize the drift between the cmake files? Bo Thorsen. Monty Program AB. -- MariaDB: MySQL replacement Community developed. Feature enhanced. Backward compatible.
Hi, Bo! On Aug 18, Bo Thorsen wrote:
OK to push to 5.1?
see questions below
Should I send this patch to the Oracle as well to minimize the drift between the cmake files?
I'd say yes. Why not?
=== modified file 'CMakeLists.txt' --- CMakeLists.txt 2010-07-01 13:50:54 +0000 +++ CMakeLists.txt 2010-07-12 11:03:38 +0000 @@ -381,12 +381,14 @@
# Add files to the installer INSTALL(FILES COPYING EXCEPTIONS-CLIENT DESTINATION .) -INSTALL(FILES support-files/my-huge.ini support-files/my-innodb-heavy-4G.ini DESTINATION .) +INSTALL(FILES ${CMAKE_BINARY_DIR}/support-files/my-huge.ini support-files/my-innodb-heavy-4G.ini DESTINATION .) -INSTALL(FILES support-files/my-large.ini support-files/my-medium.ini DESTINATION .) +INSTALL(FILES ${CMAKE_BINARY_DIR}/support-files/my-large.ini support-files/my-medium.ini DESTINATION .) -INSTALL(FILES support-files/my-small.ini DESTINATION .) +INSTALL(FILES ${CMAKE_BINARY_DIR}/support-files/my-small.ini DESTINATION .) INSTALL(FILES Docs/INSTALL-BINARY DESTINATION Docs) INSTALL(FILES COPYING DESTINATION Docs) -FILE(GLOB headerfiles "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") +FILE(GLOB headerfiles "${CMAKE_SOURCE_DIR}/include/*.h")
1. what does this do ? 2. I'd suggest to add a new variable, instead of reusing headerfiles
+INSTALL(FILES ${headerfiles} DESTINATION include COMPONENT headers) +FILE(GLOB headerfiles "${CMAKE_BINARY_DIR}/include/*.h") INSTALL(FILES ${headerfiles} DESTINATION include COMPONENT headers) INSTALL(FILES include/mysql/plugin.h DESTINATION include/mysql COMPONENT headers) INSTALL(FILES libmysql/libmysql.def DESTINATION include COMPONENT headers)
=== modified file 'scripts/CMakeLists.txt' --- scripts/CMakeLists.txt 2010-06-28 13:31:47 +0000 +++ scripts/CMakeLists.txt 2010-07-12 11:46:17 +0000 @@ -14,13 +14,15 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Build mysql_fix_privilege_tables.sql +SET(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
you don't seem to use that
+FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql" FIX_FILE1) +FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql" FIX_FILE2) -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql +ADD_CUSTOM_COMMAND(OUTPUT mysql_fix_privilege_tables.sql - COMMAND copy /b - mysql_system_tables.sql + mysql_system_tables_fix.sql - mysql_fix_privilege_tables.sql + COMMAND copy /b \"${FIX_FILE1}\" + \"${FIX_FILE2}\" mysql_fix_privilege_tables.sql DEPENDS - ${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables.sql - ${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables_fix.sql) + ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql + ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql)
why is that ?
=== modified file 'sql/CMakeLists.txt' --- sql/CMakeLists.txt 2010-06-25 13:09:45 +0000 +++ sql/CMakeLists.txt 2010-07-12 11:09:05 +0000 ... -SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/sql_yacc.h - ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc - ${CMAKE_SOURCE_DIR}/sql/lex_hash.h - ${CMAKE_SOURCE_DIR}/include/mysql_version.h - ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc - ${PROJECT_SOURCE_DIR}/include/mysqld_error.h - ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - ${PROJECT_SOURCE_DIR}/include/sql_state.h +SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/include/mysql_version.h + ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc + ${CMAKE_BINARY_DIR}/include/mysqld_error.h + ${CMAKE_BINARY_DIR}/include/mysqld_ername.h + ${CMAKE_BINARY_DIR}/include/sql_state.h
you've removed sql_yacc.h, sql_yacc.cc, and lex_hash.h from this command. Why ? Aren't they generated ? I see that below you generate them in the source dir. Why ?
PROPERTIES GENERATED 1)
Regards, Sergei
participants (2)
-
Bo Thorsen
-
Sergei Golubchik