diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,14 +24,32 @@ include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(ECMInstallIcons) -include( CheckIncludeFiles ) +include(CheckIncludeFiles) include(ECMGenerateHeaders) include(ECMAddAppIcon) +include(GenerateExportHeader) ## Make it easy for radselect and kiten to find libkiten headers -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/lib) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib) include_directories(${CMAKE_CURRENT_BINARY_DIR}) +## Find mman.h on Windows +if(WIN32) + find_path(MMAN_INCLUDE_PATH NAMES sys/mman.h) + if(NOT MMAN_INCLUDE_PATH) + message(FATAL_ERROR "On Windows, you need to install mman-win32 headers.") + endif(NOT MMAN_INCLUDE_PATH) + message(STATUS "Found mman-win32 include :") + message(STATUS ${MMAN_INCLUDE_PATH}) + include_directories(${MMAN_INCLUDE_PATH}) + find_library(MMAN_LIBRARY NAMES mman) + if(NOT MMAN_LIBRARY) + message(FATAL_ERROR "On Windows, you need to install mman-win32 library.") + endif(NOT MMAN_LIBRARY) + message(STATUS "Found mman-win32 library :") + message(STATUS ${MMAN_LIBRARY}) +endif(WIN32) + ## Generate config.h check_include_files(stdint.h HAVE_STDINT_H) check_include_files(inttypes.h HAVE_INTTYPES_H) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -24,15 +24,30 @@ ${dictionary_SRCS}) add_library(kiten SHARED ${kiten_LIB_SRCS}) -target_link_libraries(kiten - Qt5::Core - Qt5::Widgets - KF5::Completion - KF5::ConfigCore - KF5::ConfigGui - KF5::CoreAddons - KF5::I18n - KF5::WidgetsAddons) +generate_export_header(kiten) + +if(WIN32) + target_link_libraries(kiten + Qt5::Core + Qt5::Widgets + KF5::Completion + KF5::ConfigCore + KF5::ConfigGui + KF5::CoreAddons + KF5::I18n + KF5::WidgetsAddons + ${MMAN_LIBRARY}) +else(WIN32) + target_link_libraries(kiten + Qt5::Core + Qt5::Widgets + KF5::Completion + KF5::ConfigCore + KF5::ConfigGui + KF5::CoreAddons + KF5::I18n + KF5::WidgetsAddons) +endif(WIN32) set_target_properties(kiten PROPERTIES VERSION ${KITEN_LIB_VERSION} SOVERSION ${KITEN_LIB_SOVERSION}) install( TARGETS kiten ${INSTALL_TARGETS_DEFAULT_ARGS}) @@ -45,7 +60,6 @@ entrylist.h historyptrlist.h kromajiedit.h - libkitenexport.h DESTINATION ${INCLUDE_INSTALL_DIR}/libkiten COMPONENT Devel ) install(FILES diff --git a/lib/DictEdict/dictfileedict.h b/lib/DictEdict/dictfileedict.h --- a/lib/DictEdict/dictfileedict.h +++ b/lib/DictEdict/dictfileedict.h @@ -28,7 +28,7 @@ #include "dictfile.h" #include "indexededictfile.h" -#include "libkitenexport.h" +#include "kiten_export.h" #include "linearedictfile.h" #include diff --git a/lib/DictEdict/entryedict.h b/lib/DictEdict/entryedict.h --- a/lib/DictEdict/entryedict.h +++ b/lib/DictEdict/entryedict.h @@ -25,7 +25,7 @@ #include "entry.h" -#include "libkitenexport.h" +#include "kiten_export.h" #include #include diff --git a/lib/DictKanjidic/dictfilekanjidic.h b/lib/DictKanjidic/dictfilekanjidic.h --- a/lib/DictKanjidic/dictfilekanjidic.h +++ b/lib/DictKanjidic/dictfilekanjidic.h @@ -26,7 +26,7 @@ #include "dictfile.h" -#include "libkitenexport.h" +#include "kiten_export.h" #include diff --git a/lib/DictKanjidic/entrykanjidic.h b/lib/DictKanjidic/entrykanjidic.h --- a/lib/DictKanjidic/entrykanjidic.h +++ b/lib/DictKanjidic/entrykanjidic.h @@ -25,7 +25,7 @@ #include "entry.h" -#include "libkitenexport.h" +#include "kiten_export.h" #include diff --git a/lib/dictfile.h b/lib/dictfile.h --- a/lib/dictfile.h +++ b/lib/dictfile.h @@ -21,7 +21,7 @@ #ifndef KITEN_DICTFILE_H #define KITEN_DICTFILE_H -#include "libkitenexport.h" +#include "kiten_export.h" #include #include diff --git a/lib/dictionarymanager.h b/lib/dictionarymanager.h --- a/lib/dictionarymanager.h +++ b/lib/dictionarymanager.h @@ -22,7 +22,7 @@ #ifndef KITEN_DICTIONARYMANAGER_H #define KITEN_DICTIONARYMANAGER_H -#include "libkitenexport.h" +#include "kiten_export.h" #include #include diff --git a/lib/dictionarypreferencedialog.h b/lib/dictionarypreferencedialog.h --- a/lib/dictionarypreferencedialog.h +++ b/lib/dictionarypreferencedialog.h @@ -23,7 +23,7 @@ #include -#include "libkitenexport.h" +#include "kiten_export.h" /** * @short This abstract base class specifies the interface for dictionary diff --git a/lib/dictquery.h b/lib/dictquery.h --- a/lib/dictquery.h +++ b/lib/dictquery.h @@ -29,7 +29,7 @@ class QChar; -#include "libkitenexport.h" +#include "kiten_export.h" /** * @short A class to allow users of libkiten to properly setup a database diff --git a/lib/entry.h b/lib/entry.h --- a/lib/entry.h +++ b/lib/entry.h @@ -27,7 +27,7 @@ #include #include -#include "libkitenexport.h" +#include "kiten_export.h" #include "dictquery.h" diff --git a/lib/entrylist.h b/lib/entrylist.h --- a/lib/entrylist.h +++ b/lib/entrylist.h @@ -29,7 +29,7 @@ #include "dictquery.h" #include "entry.h" -#include "libkitenexport.h" +#include "kiten_export.h" /** * EntryList is a simple container for Entry objects, and is-a QList diff --git a/lib/historyptrlist.h b/lib/historyptrlist.h --- a/lib/historyptrlist.h +++ b/lib/historyptrlist.h @@ -24,7 +24,7 @@ #include -#include "libkitenexport.h" +#include "kiten_export.h" class EntryList; diff --git a/lib/libkitenexport.h b/lib/libkitenexport.h deleted file mode 100644 --- a/lib/libkitenexport.h +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * This file is part of Kiten, a KDE Japanese Reference Tool * - * Copyright (C) 2006 Joseph Kerian * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public License * - * along with this library; see the file COPYING.LIB. If not, write to * - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301, USA. * - *****************************************************************************/ - -#ifndef KITEN_LIBKITENEXPORT_H -#define KITEN_LIBKITENEXPORT_H - -#define KDE_EXPORT __attribute__ ((visibility("default"))) -#define KDE_IMPORT __attribute__ ((visibility("default"))) - -#if defined Q_OS_WIN -# ifndef KITEN_EXPORT -# ifdef MAKE_KITEN_LIB -# define KITEN_EXPORT KDE_EXPORT -# else -# define KITEN_EXPORT KDE_IMPORT -# endif -# endif -#else /* UNIX */ -# define KITEN_EXPORT KDE_EXPORT -#endif - -#endif diff --git a/xjdxgen.c b/xjdxgen.c --- a/xjdxgen.c +++ b/xjdxgen.c @@ -33,6 +33,10 @@ --Joe */ +#ifdef _MSC_VER +#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup") +#endif + #include #include #include