Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
1340da7b
Commit
1340da7b
authored
13 years ago
by
Giuseppe Bilotta
Browse files
Options
Downloads
Patches
Plain Diff
Refactor and clean up gettext management
parent
89af509d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmake/Modules/FindGettextLib.cmake
+48
-0
48 additions, 0 deletions
cmake/Modules/FindGettextLib.cmake
src/CMakeLists.txt
+26
-28
26 additions, 28 deletions
src/CMakeLists.txt
with
74 additions
and
28 deletions
cmake/Modules/FindGettextLib.cmake
0 → 100644
+
48
−
0
View file @
1340da7b
# Package finder for gettext libs and include files
SET
(
CUSTOM_GETTEXT_PATH
"
${
PROJECT_SOURCE_DIR
}
/../../gettext"
CACHE FILEPATH
"path to custom gettext"
)
# by default
SET
(
GETTEXT_FOUND FALSE
)
FIND_PATH
(
GETTEXT_INCLUDE_DIR
NAMES libintl.h
PATHS
"
${
CUSTOM_GETTEXT_PATH
}
/include"
DOC
"gettext include directory"
)
FIND_PROGRAM
(
GETTEXT_MSGFMT
NAMES msgfmt
PATHS
"
${
CUSTOM_GETTEXT_PATH
}
/bin"
DOC
"path to msgfmt"
)
# modern Linux, as well as Mac, seem to not need require special linking
# TODO check the requirements on other BSDs and older Linux
IF
(
WIN32
)
FIND_LIBRARY
(
GETTEXT_LIBRARY
NAMES libintl.lib intl.lib libintl3.lib intl3.lib
PATHS
"
${
CUSTOM_GETTEXT_PATH
}
/lib"
DOC
"gettext *intl*.lib"
)
FIND_LIBRARY
(
GETTEXT_DLL
NAMES libintl.dll intl.dll libintl3.dll intl3.dll
PATHS
"
${
CUSTOM_GETTEXT_PATH
}
/lib"
DOC
"gettext *intl*.dll"
)
FIND_LIBRARY
(
GETTEXT_ICONV_DLL
NAMES libiconv2.dll
PATHS
"
${
CUSTOM_GETTEXT_PATH
}
/lib"
DOC
"gettext *iconv*.lib"
)
ENDIF
(
WIN32
)
IF
(
GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT
)
IF
(
WIN32
)
# in the Win32 case check also for the extra linking requirements
IF
(
GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL
)
SET
(
GETTEXT_FOUND TRUE
)
ENDIF
()
ELSE
(
WIN32
)
SET
(
GETTEXT_FOUND TRUE
)
ENDIF
(
WIN32
)
ENDIF
()
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
26
−
28
View file @
1340da7b
...
...
@@ -6,12 +6,22 @@ if(RUN_IN_PLACE)
endif
(
RUN_IN_PLACE
)
if
(
USE_GETTEXT
)
add_definitions
(
-DUSE_GETTEXT
)
message
(
STATUS
"GetText enabled"
)
else
()
set
(
GETTEXT_INCLUDE_DIR
""
)
set
(
GETTEXT_BIN_DIR
""
)
set
(
GETTEXT_LIBRARIES
""
)
find_package
(
GettextLib REQUIRED
)
if
(
GETTEXT_FOUND
)
add_definitions
(
-DUSE_GETTEXT
)
message
(
STATUS
"gettext include path:
${
GETTEXT_INCLUDE_DIR
}
"
)
message
(
STATUS
"gettext msgfmt path:
${
GETTEXT_MSGFMT
}
"
)
if
(
WIN32
)
message
(
STATUS
"gettext library:
${
GETTEXT_LIBRARY
}
"
)
message
(
STATUS
"gettext dll:
${
GETTEXT_DLL
}
"
)
message
(
STATUS
"gettext iconv dll:
${
GETTEXT_ICONV_DLL
}
"
)
endif
()
message
(
STATUS
"GetText enabled"
)
else
()
message
(
ERROR
"GetText enabled but not found, disabling"
)
set
(
USE_GETTEXT FALSE
)
endif
(
GETTEXT_FOUND
)
else
(
USE_GETTEXT
)
message
(
STATUS
"GetText disabled"
)
endif
(
USE_GETTEXT
)
...
...
@@ -39,14 +49,6 @@ if(WIN32)
CACHE FILEPATH
"Path to zlibwapi.dll (for installation)"
)
set
(
IRRLICHT_SOURCE_DIR
"
${
PROJECT_SOURCE_DIR
}
/../../irrlicht-1.7.2"
CACHE PATH
"irrlicht dir"
)
if
(
USE_GETTEXT
)
set
(
GETTEXT_INCLUDE_DIR
"
${
PROJECT_SOURCE_DIR
}
/../../gettext/include"
CACHE PATH
"gettext include directory"
)
set
(
GETTEXT_BIN_DIR
"
${
PROJECT_SOURCE_DIR
}
/../../gettext/bin"
CACHE PATH
"gettext bin directory"
)
set
(
GETTEXT_LIBRARIES
"
${
PROJECT_SOURCE_DIR
}
/../../gettext/lib/libintl.lib"
CACHE FILEPATH
"gettext libintl.lib"
)
endif
(
USE_GETTEXT
)
else
()
# Unix probably
if
(
BUILD_CLIENT
)
...
...
@@ -175,7 +177,7 @@ if(BUILD_CLIENT)
${
BZIP2_LIBRARIES
}
${
PNG_LIBRARIES
}
${
X11_LIBRARIES
}
${
GETTEXT_LIBRAR
IES
}
${
GETTEXT_LIBRAR
Y
}
${
PLATFORM_LIBS
}
${
CLIENT_PLATFORM_LIBS
}
${
JTHREAD_LIBRARY
}
...
...
@@ -234,7 +236,7 @@ else()
endif
()
if
(
WIN32 AND USE_GETTEXT
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-l
intl -L
${
GETTEXT_
BIN_DIR
}
"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-l
${
GETTEXT_
LIBRARY
}
"
)
endif
()
set
(
CMAKE_CXX_FLAGS_RELEASE
"-DNDEBUG
${
RELEASE_WARNING_FLAGS
}
${
WARNING_FLAGS
}
-O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops"
)
...
...
@@ -277,10 +279,14 @@ if(BUILD_CLIENT)
if
(
DEFINED ZLIB_DLL
)
install
(
FILES
${
ZLIB_DLL
}
DESTINATION
${
BINDIR
}
)
endif
()
if
(
USE_GETTEXT AND DEFINED GETTEXT_BIN_DIR
)
install
(
FILES
${
GETTEXT_BIN_DIR
}
/libintl3.dll DESTINATION
${
BINDIR
}
)
install
(
FILES
${
GETTEXT_BIN_DIR
}
/libiconv2.dll DESTINATION
${
BINDIR
}
)
endif
()
if
(
USE_GETTEXT
)
if
(
defined GETTEXT_DLL
)
install
(
FILES
${
GETTEXT_DLL
}
DESTINATION
${
BINDIR
}
)
endif
()
if
(
defined GETTEXT_ICONV_DLL
)
install
(
FILES
${
GETTEXT_ICONV_DLL
}
DESTINATION
${
BINDIR
}
)
endif
()
endif
(
USE_GETTEXT
)
endif
()
endif
(
BUILD_CLIENT
)
...
...
@@ -289,14 +295,6 @@ if(BUILD_SERVER)
endif
(
BUILD_SERVER
)
if
(
USE_GETTEXT
)
if
(
WIN32
)
set
(
GETTEXT_MSGFMT
"
${
GETTEXT_BIN_DIR
}
/msgfmt.exe"
CACHE FILEPATH
"path to msgfmt"
)
elseif
(
APPLE
)
set
(
GETTEXT_MSGFMT
"
${
GETTEXT_BIN_DIR
}
/msgfmt"
CACHE FILEPATH
"path to msgfmt"
)
else
()
set
(
GETTEXT_MSGFMT
"msgfmt"
)
endif
()
add_custom_command
(
OUTPUT
${
CMAKE_BINARY_DIR
}
/locale/de/LC_MESSAGES COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
CMAKE_BINARY_DIR
}
/locale/de/LC_MESSAGES COMMENT
"mo-update [de]: Creating locale directory."
)
add_custom_command
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment