-
Notifications
You must be signed in to change notification settings - Fork 87
Cmake build system implementation #525
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
base: master
Are you sure you want to change the base?
Conversation
f44df7f
to
392aa69
Compare
Also, for some reason ICU cannot find the resource bundles even thought they are linked to the binary. I'm probably missing a compile flag, feature or something. Any idea on that?
|
Did you specify static link against resource bundle created by ICU? |
It's dinamically linked, libltfs is compiled as a dynamic lib, the ICU messages bundles are compiled statically and linked into libltfs. libltfs should be a static lib? |
No. The For example, below is the build log of
You can confirm the symbol table of
|
The symbols exists in the library
And cmake compiles it like this
|
I didn't try your code at all yet. But does auto tools build on your tree work fine? If so, you need to investigate step by step and find differences. Please do not forget that I never ask you to do this. You just want to do this. |
Yes, I know that I want to implement this, I'm not blaming anyone, I'm trying to get some advice for this. I'm trying to look at the differences between versions |
The message says error code retuned from ICU is
U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot be found */ The root cause is how to create message library file. In auto tools, Try the patch below. diff --git a/.gitignore b/.gitignore
index 0711b11..e36512a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,12 @@ ltfs.pc
.libs/
messages/.lib
.dirstamp
+# Files renerated by CMake
+CMakeFiles
+*.cmake
+CMakeCache.txt
+install_manifest.txt
+*.so
# Files created by OS
.DS_Store
# Files for development
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5245b51..10130b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,14 @@
cmake_minimum_required(VERSION 3.20)
-project(ltfs,
+project(ltfs
# TODO: Find a better solution to mark this version as different from the official build
VERSION "2.5.0.9999"
+ LANGUAGES C
)
+
+set(CMAKE_VERBOSE_MAKEFILE 1)
+set(CMAKE_C_COMPILER gcc)
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0")
+
include(CheckSymbolExists REQUIRED)
include(CheckTypeSize REQUIRED)
include(CheckLibraryExists REQUIRED)
diff --git a/messages/.gitignore b/messages/.gitignore
new file mode 100644
index 0000000..a445398
--- /dev/null
+++ b/messages/.gitignore
@@ -0,0 +1 @@
+res*
diff --git a/messages/CMakeLists.txt b/messages/CMakeLists.txt
index 46ef6c1..3b853b5 100644
--- a/messages/CMakeLists.txt
+++ b/messages/CMakeLists.txt
@@ -26,12 +26,13 @@ foreach(NAME IN LISTS MESSAGES_LIBS)
OUTPUT "res_${NAME}/lib${NAME}.a"
COMMAND mkdir -p res_${NAME}
COMMAND ${ICU_GENRB_EXECUTABLE} -q ${SRCS} -d res_${NAME} 1> /dev/null
- COMMAND find res_${NAME} -name *.res > res_${NAME}/paths.txt
- COMMAND ${ICU_PKGDATA_EXECUTABLE} -d res_${NAME}/ -m static -p ${NAME} -q res_${NAME}/paths.txt 1> /dev/null
+ COMMAND cd res_${NAME} && ls *.res > paths.txt
+ COMMAND cd res_${NAME} && ${ICU_PKGDATA_EXECUTABLE} -m static -p ${NAME} -q paths.txt 1> /dev/null
BYPRODUCTS "res_${NAME}"
)
# Add the command as a target to be build when all is invoked Message resource problem is gone like below in my env.
|
conf/CMakeLists.txt
Outdated
# NOTE: This can be done using an .in file with @VARS@ but somehow this is done using sed | ||
set(PLAT_OPTS) | ||
if(ENABLE_LINTAPE) | ||
list(APPEND PLAT_OPTS "\\nplugin tape lin_tape ${libdir}/ltfs/libtape-lin_tape.so") | ||
endif() | ||
|
||
if(LINUX) | ||
list(APPEND PLAT_OPTS "\\nplugin tape sg ${libdir}/ltfs/libtape-sg.so") | ||
elseif(APPLE) | ||
list(APPEND PLAT_OPTS "\\nplugin tape iokit ${libdir}/ltfs/libtape-iokit.so") | ||
elseif(BSD) | ||
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") | ||
list(APPEND PLAT_OPTS "\\nplugin tape cam ${libdir}/ltfs/libtape-cam.so") | ||
elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") | ||
list(APPEND PLAT_OPTS "\\nplugin tape scsipi-ibmtape ${libdir}/ltfs/libtape-scsipi-ibmtape.so") | ||
endif() | ||
endif() | ||
|
||
file(REAL_PATH "ltfs.conf.in" CONFIG_FILE) | ||
add_custom_command(OUTPUT "ltfs.conf" | ||
COMMAND sed -e "s!__PLATFORM_DRIVERS__!${PLAT_OPTS}!" ${CONFIG_FILE} > .tmp1 | ||
COMMAND sed -e "s!__LIBDIR__!${CMAKE_INSTALL_FULL_LIBDIR}!" .tmp1 > .tmp2 | ||
COMMAND sed -e "s!__DEFAULT_TAPE__!${DEFAULT_TAPE}!" .tmp2 > .tmp1 | ||
COMMAND sed -e "s!__DEFAULT_IOSCHED__!${DEFAULT_IOSCHED}!" .tmp1 > .tmp2 | ||
COMMAND sed -e "s!__DEFAULT_KMI__!${DEFAULT_KMI}!" .tmp2 > .tmp1 | ||
COMMAND sed -e "s!__CONFDIR__!${CMAKE_INSTALL_FULL_SYSCONFDIR}!" .tmp1 > ltfs.conf | ||
DEPENDS ${CONFIG_FILE} | ||
BYPRODUCTS .tmp1 .tmp2 | ||
) | ||
add_custom_target("conf" ALL DEPENDS "ltfs.conf") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piste-jp This works, but cannot this be done in a .in file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks you are right. We might be able to use .in
file instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a description how to build the tree with cmake even if it is experimental support.
fix: CMake definition for cmake specific files feat: add cmake lists to drivers and kmi fix: revert unnecesary changes fix: missing .c file fix: typos and names chore: add build specific version number and add comments feat: add last cmakelists fix: fix compilation issues feat: fix names feat: add manpages feat: cmake working
Sorry for the delay, I was occupied with other stuff.
Should I add it to the README? |
Summary of changes
This pull request includes following changes or fixes.
Description
Added CMakeLists.txt for cmake to work and do some changes in code to not use
config.h
Type of change
Checklist:
Progress