Skip to content

Commit

Permalink
Use CMAKE_RUNTIME_OUTPUT_DIRECTORY to simplify build directory struct…
Browse files Browse the repository at this point in the history
…ure (#1258)
  • Loading branch information
wengxt authored Feb 3, 2025
1 parent 1a6ca37 commit a7f5bd1
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ get_filename_component(CMAKE_INSTALL_FULL_LIBDATADIR "${CMAKE_INSTALL_LIBDATADIR
mark_as_advanced(CMAKE_INSTALL_LIBDATADIR)
mark_as_advanced(CMAKE_INSTALL_FULL_LIBDATADIR)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

include(Fcitx5CompilerSettings)

set(FCITX_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if (ENABLE_DBUS)

if (DBUS_DAEMON_BIN)
add_test(NAME ${TESTCASE}
COMMAND DBusWrapper "${DBUS_DAEMON_BIN}" "${CMAKE_CURRENT_BINARY_DIR}/${TESTCASE}" ${${TESTCASE}_ARGS})
COMMAND DBusWrapper "${DBUS_DAEMON_BIN}" "$<TARGET_FILE:${TESTCASE}>" ${${TESTCASE}_ARGS})
endif()
endforeach()
endif()
Expand Down
6 changes: 3 additions & 3 deletions test/testaddon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "fcitx-utils/log.h"
#include "fcitx-utils/metastring.h"
#include "fcitx-utils/testing.h"
#include "fcitx/addoninstance.h"
#include "fcitx/addonmanager.h"
#include "addon/dummyaddon_public.h"
Expand All @@ -16,9 +17,8 @@ double f(int) { return 0; }

int main() {
fcitx::Log::setLogRule("default=5");
setenv("SKIP_FCITX_PATH", "1", 1);
setenv("XDG_DATA_DIRS", FCITX5_SOURCE_DIR "/test/addon2", 1);
setenv("FCITX_ADDON_DIRS", FCITX5_BINARY_DIR "/test/addon", 1);
fcitx::setupTestingEnvironment(FCITX5_BINARY_DIR, {"bin"},
{FCITX5_SOURCE_DIR "/test/addon2/fcitx5"});
fcitx::AddonManager manager;
manager.registerDefaultLoader(nullptr);
manager.load();
Expand Down
4 changes: 1 addition & 3 deletions test/testcompose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ constexpr char testCompose[] = {
"BELOW\n"};

int main() {
setupTestingEnvironment(FCITX5_BINARY_DIR,
{"testing/testfrontend", "testing/testui"},
{"test"});
setupTestingEnvironment(FCITX5_BINARY_DIR, {"bin"}, {"test"});

char arg0[] = "testcompose";
char arg1[] = "--disable=all";
Expand Down
35 changes: 20 additions & 15 deletions test/testdbusmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,49 @@
*
*/
#include <unistd.h>
#include <cstdint>
#include <string>
#include <tuple>
#include <type_traits>
#include <vector>
#include "fcitx-utils/dbus/bus.h"
#include "fcitx-utils/dbus/message.h"
#include "fcitx-utils/dbus/variant.h"
#include "fcitx-utils/log.h"
#include "fcitx-utils/metastring.h"
#include "fcitx-utils/unixfd.h"

using namespace fcitx::dbus;
using namespace fcitx;

int main() {
Bus bus(BusType::Session);

static_assert(std::is_same<DBusSignatureToType<'i', 'u'>::type,
std::tuple<int32_t, uint32_t>>::value,
static_assert(std::is_same_v<DBusSignatureToType<'i', 'u'>::type,
std::tuple<int32_t, uint32_t>>,
"Type is not same");
static_assert(std::is_same<DBusSignatureToType<'i'>::type, int32_t>::value,
static_assert(std::is_same_v<DBusSignatureToType<'i'>::type, int32_t>,
"Type is not same");
static_assert(std::is_same<DBusSignatureToType<'a', 'u'>::type,
std::vector<uint32_t>>::value,
static_assert(std::is_same_v<DBusSignatureToType<'a', 'u'>::type,
std::vector<uint32_t>>,
"Type is not same");
static_assert(
std::is_same<DBusSignatureToType<'a', '(', 'i', 'u', ')'>::type,
std::vector<DBusStruct<int32_t, uint32_t>>>::value,
std::is_same_v<DBusSignatureToType<'a', '(', 'i', 'u', ')'>::type,
std::vector<DBusStruct<int32_t, uint32_t>>>,
"Type is not same");
static_assert(
std::is_same<
std::is_same_v<
DBusSignatureToType<'a', 'i', 'a', '(', 'i', 'u', ')'>::type,
std::tuple<std::vector<int32_t>,
std::vector<DBusStruct<int32_t, uint32_t>>>>::value,
std::vector<DBusStruct<int32_t, uint32_t>>>>,
"Type is not same");
static_assert(
std::is_same<DBusSignatureToType<'a', 'i', '(', 'i', 'u', ')'>::type,
std::tuple<std::vector<int32_t>,
DBusStruct<int32_t, uint32_t>>>::value,
std::is_same_v<
DBusSignatureToType<'a', 'i', '(', 'i', 'u', ')'>::type,
std::tuple<std::vector<int32_t>, DBusStruct<int32_t, uint32_t>>>,
"Type is not same");

static_assert(std::is_same<DBusSignatureToType<'(', 'i', 'i', ')'>::type,
dbus::DBusStruct<int32_t, int32_t>>::value,
static_assert(std::is_same_v<DBusSignatureToType<'(', 'i', 'i', ')'>::type,
dbus::DBusStruct<int32_t, int32_t>>,
"Type is not same");

static_assert(
Expand Down
2 changes: 1 addition & 1 deletion test/testemoji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace fcitx;

int main() {
setupTestingEnvironment(
FCITX5_BINARY_DIR, {"src/modules/emoji"},
FCITX5_BINARY_DIR, {"bin"},
{"test", "src/modules", FCITX5_SOURCE_DIR "/src/modules"});
AddonManager manager(FCITX5_BINARY_DIR "/src/modules/emoji");
manager.registerDefaultLoader(nullptr);
Expand Down
4 changes: 1 addition & 3 deletions test/testinputcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@ void scheduleEvent(EventDispatcher *dispatcher, Instance *instance) {

void test_custom_panel() {

setupTestingEnvironment(FCITX5_BINARY_DIR,
{"testing/testfrontend", "testing/testui"},
{"test"});
setupTestingEnvironment(FCITX5_BINARY_DIR, {"bin"}, {"test"});

char arg0[] = "testcompose";
char arg1[] = "--disable=all";
Expand Down
4 changes: 1 addition & 3 deletions test/testinstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ void testModifierOnlyHotkey(Instance &instance) {
}

int main() {
setupTestingEnvironment(FCITX5_BINARY_DIR,
{"testing/testim", "testing/testfrontend"},
{"test"});
setupTestingEnvironment(FCITX5_BINARY_DIR, {"bin"}, {"test"});

char arg0[] = "testinstance";
char arg1[] = "--disable=all";
Expand Down
4 changes: 1 addition & 3 deletions test/testquickphrase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ void testRestoreCallback(Instance *instance) {

int main() {
setupTestingEnvironment(
FCITX5_BINARY_DIR,
{"src/modules/quickphrase", "testing/testfrontend", "testing/testui",
"testing/testim"},
FCITX5_BINARY_DIR, {"bin"},
{"test", "src/modules", FCITX5_SOURCE_DIR "/test/addon/fcitx5"});

char arg0[] = "testquickphrase";
Expand Down
4 changes: 1 addition & 3 deletions test/testspell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ void scheduleEvent(EventDispatcher *dispatcher, Instance *instance) {

int main() {
setupTestingEnvironment(
FCITX5_BINARY_DIR,
{"src/modules/spell", "testing/testfrontend", "testing/testui",
"testing/testim"},
FCITX5_BINARY_DIR, {"bin"},
{"test", "src/modules", FCITX5_SOURCE_DIR "/src/modules"});

char arg0[] = "testspell";
Expand Down
4 changes: 1 addition & 3 deletions test/testunicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ void scheduleEvent(EventDispatcher *dispatcher, Instance *instance) {

int main() {
setupTestingEnvironment(
FCITX5_BINARY_DIR,
{"src/modules/unicode", "testing/testfrontend", "testing/testui",
"testing/testim"},
FCITX5_BINARY_DIR, {"bin"},
{"test", "src/modules", FCITX5_SOURCE_DIR "/src/modules"});

char arg0[] = "testunicode";
Expand Down
4 changes: 1 addition & 3 deletions test/testxim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ class XIMTest {
int main() {
setenv("XMODIFIERS", xmodifiers, 1);
setupTestingEnvironment(
FCITX5_BINARY_DIR,
{"src/modules/quickphrase", "src/frontend/xim", "src/modules/xcb",
"testing/testui", "testing/testim"},
FCITX5_BINARY_DIR, {"bin"},
{"test", "src/modules", FCITX5_SOURCE_DIR "/test/addon/fcitx5"});

char arg0[] = "testquickphrase";
Expand Down

0 comments on commit a7f5bd1

Please sign in to comment.