Bug 77928 - [CMAKE] Use *bin* and *lib* directories for executable and libraries
Summary: [CMAKE] Use *bin* and *lib* directories for executable and libraries
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 20:04 PST by Gyuyoung Kim
Modified: 2012-02-07 17:51 PST (History)
9 users (show)

See Also:


Attachments
Patch (1.72 KB, patch)
2012-02-06 20:05 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (1.72 KB, patch)
2012-02-06 21:45 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (10.56 KB, patch)
2012-02-07 02:47 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (10.58 KB, patch)
2012-02-07 04:27 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2012-02-06 20:04:07 PST
In cmake build system, shared libraries are being built in source directory. It is better to set a common place to maintain built libraries. In addition, test bot uploads libraries with test result. Thus, I need a common place for all libraries in order to upload all libraries.
Comment 1 Gyuyoung Kim 2012-02-06 20:05:38 PST
Created attachment 125757 [details]
Patch
Comment 2 Gyuyoung Kim 2012-02-06 20:06:39 PST
CC'ing Daniel, Patrick and Kubo.
Comment 3 Gyuyoung Kim 2012-02-06 21:45:29 PST
Created attachment 125765 [details]
Patch
Comment 4 Patrick R. Gansterer 2012-02-07 00:42:43 PST
Comment on attachment 125765 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=125765&action=review

> Source/cmake/WebKitFS.cmake:4
> +FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/libs)

AFAIK this isn't necessary. CMake takes care of creating directories when needed.

> CMakeLists.txt:45
> +SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/libs")

Why "libs", isn't "lib" more common for such a directory (like "bin" is more common than "Programs")?
Comment 5 Gyuyoung Kim 2012-02-07 00:51:12 PST
(In reply to comment #4)
> (From update of attachment 125765 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=125765&action=review
> 
> > Source/cmake/WebKitFS.cmake:4
> > +FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/libs)
> 
> AFAIK this isn't necessary. CMake takes care of creating directories when needed.

Ok, I fix it. Frankly, above code is not necessary. I added it to create directory more correctly as *Programs*.


> > CMakeLists.txt:45
> > +SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/libs")
> 
> Why "libs", isn't "lib" more common for such a directory (like "bin" is more common than "Programs")?

QT port is using *bin* and *lib*. By comparison, GTK port is using *Programs* and *.libs*. I think we have to get agreement from port maintainers(Wince, Blackberry and EFL). I agree. :-)
Comment 6 Patrick R. Gansterer 2012-02-07 01:43:08 PST
(In reply to comment #5)
> (In reply to comment #4)
> > Why "libs", isn't "lib" more common for such a directory (like "bin" is more common than "Programs")?
> 
> QT port is using *bin* and *lib*. By comparison, GTK port is using *Programs* and *.libs*. I think we have to get agreement from port maintainers(Wince, Blackberry and EFL). I agree. :-)

There is also the common "/usr/bin" and "/usr/lib".
Comment 7 Gyuyoung Kim 2012-02-07 02:47:48 PST
Created attachment 125798 [details]
Patch
Comment 8 Gyuyoung Kim 2012-02-07 02:49:43 PST
New patch is submitted. I set bin and lib directory for executable and library.

Daniel reviews this patch, I think blackberry port also agrees with this change.
Comment 9 Patrick R. Gansterer 2012-02-07 03:35:24 PST
Comment on attachment 125798 [details]
Patch

IMHO you should use sth. like:
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
in the root CMakeLists.txt, instead of adding this to the different executeable names.
Comment 10 Gyuyoung Kim 2012-02-07 04:21:57 PST
(In reply to comment #9)
> (From update of attachment 125798 [details])
> IMHO you should use sth. like:
> SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
> SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
> SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
> in the root CMakeLists.txt, instead of adding this to the different executeable names.


When we set CMAKE_ARCHIVE_OUTPUT_DIRECTORY, static libraries are also moved to lib directory. I think it is better to move shared libraries to lib directory only.

Why don't we use below setting ?

SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
Comment 11 Gyuyoung Kim 2012-02-07 04:27:35 PST
Created attachment 125813 [details]
Patch
Comment 12 Patrick R. Gansterer 2012-02-07 04:28:31 PST
(In reply to comment #10)
> (In reply to comment #9)
> > (From update of attachment 125798 [details] [details])
> > IMHO you should use sth. like:
> > SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
> > SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
> > SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
> > in the root CMakeLists.txt, instead of adding this to the different executeable names.
> 
> 
> When we set CMAKE_ARCHIVE_OUTPUT_DIRECTORY, static libraries are also moved to lib directory. I think it is better to move shared libraries to lib directory only.
> 
> Why don't we use below setting ?
> 
> SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
> SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

It's ok for me too. I only want to avoid the "'Programs/' prefix" on the different targets. ;-)
Comment 13 Daniel Bates 2012-02-07 10:03:08 PST
Comment on attachment 125813 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=125813&action=review

> CMakeLists.txt:46
> +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
> +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

I don't have a CMake build at the moment. I assume that these directories are created by CMake in the directory CMAKE_BINARY_DIR.
Comment 14 Gyuyoung Kim 2012-02-07 16:57:20 PST
(In reply to comment #13)
> (From update of attachment 125813 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=125813&action=review
> 
> > CMakeLists.txt:46
> > +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
> > +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
> 
> I don't have a CMake build at the moment. I assume that these directories are created by CMake in the directory CMAKE_BINARY_DIR.

Yes, right. *.so files are created in CMAKE_BINARY_DIR/lib and excutables are created in CMAKE_BINARY_DIR/bin.
Comment 15 WebKit Review Bot 2012-02-07 17:51:28 PST
Comment on attachment 125813 [details]
Patch

Clearing flags on attachment: 125813

Committed r107020: <http://trac.webkit.org/changeset/107020>
Comment 16 WebKit Review Bot 2012-02-07 17:51:37 PST
All reviewed patches have been landed.  Closing bug.