From d07a9b94cfc2875637da3710eefab4e0ca0cbb89 Mon Sep 17 00:00:00 2001 From: Ilia Udalov Date: Wed, 25 Jan 2017 00:01:35 +0300 Subject: [PATCH] Change file structure --- .gitmodules | 12 ++++++------ .travis.yml | 4 ++-- CMakeLists.txt | 17 +++++++++-------- build.sh | 12 ------------ libs/gtest | 1 + {lua-tests => libs}/luaunit | 0 libs/sol | 1 + src/{ => cpp}/lua-module.cpp | 0 src/{ => cpp}/shared-table.cpp | 0 src/{ => cpp}/shared-table.h | 0 src/{ => cpp}/spin-mutex.h | 0 src/{ => cpp}/stored-object.cpp | 0 src/{ => cpp}/stored-object.h | 0 src/{ => cpp}/threading.cpp | 0 src/{ => cpp}/threading.h | 0 src/{ => cpp}/utils.h | 0 src/sol | 1 - tests/{ => cpp}/shared-table.cpp | 0 tests/{ => cpp}/test_main.cpp | 0 tests/gtest | 1 - {lua-tests => tests/lua}/run_tests.lua | 7 +++++-- {lua-tests => tests/lua}/smoke_test.lua | 0 22 files changed, 24 insertions(+), 32 deletions(-) delete mode 100755 build.sh create mode 160000 libs/gtest rename {lua-tests => libs}/luaunit (100%) create mode 160000 libs/sol rename src/{ => cpp}/lua-module.cpp (100%) rename src/{ => cpp}/shared-table.cpp (100%) rename src/{ => cpp}/shared-table.h (100%) rename src/{ => cpp}/spin-mutex.h (100%) rename src/{ => cpp}/stored-object.cpp (100%) rename src/{ => cpp}/stored-object.h (100%) rename src/{ => cpp}/threading.cpp (100%) rename src/{ => cpp}/threading.h (100%) rename src/{ => cpp}/utils.h (100%) delete mode 160000 src/sol rename tests/{ => cpp}/shared-table.cpp (100%) rename tests/{ => cpp}/test_main.cpp (100%) delete mode 160000 tests/gtest rename {lua-tests => tests/lua}/run_tests.lua (85%) rename {lua-tests => tests/lua}/smoke_test.lua (100%) diff --git a/.gitmodules b/.gitmodules index 19e68fb..177cb4d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "src/sol"] - path = src/sol +[submodule "libs/sol"] + path = libs/sol url = https://github.com/ThePhD/sol2.git -[submodule "tests/gtest"] - path = tests/gtest +[submodule "libs/gtest"] + path = libs/gtest url = https://github.com/google/googletest.git -[submodule "lua-tests/luaunit"] - path = lua-tests/luaunit +[submodule "libs/luaunit"] + path = libs/luaunit url = https://github.com/bluebird75/luaunit diff --git a/.travis.yml b/.travis.yml index 214b2ab..116b13e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ matrix: - cmake -DLUA_INCLUDE_DIR="/usr/include/lua5.2" -DLUA_LIBRARY="/usr/lib/x86_64-linux-gnu/liblua5.2.so" .. - make -j4 all && make install - ./tests - - cd ../lua-tests/ && ./run_tests.lua + - ./run_tests.lua # Mac OS X / Clang 3.8 - compiler: clang os: osx @@ -42,4 +42,4 @@ matrix: - mkdir build_dir && cd build_dir - cmake .. && make -j4 all && make install - ./tests - - cd ../lua-tests && ./run_tests.lua + - ./run_tests.lua diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c306d2..2e1337d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,10 @@ if (NOT LUA_INCLUDE_DIR OR NOT LUA_LIBRARY) endif() endif() -include_directories(src src/sol/single/sol ${LUA_INCLUDE_DIR}) +include_directories(src/cpp libs/sol/single/sol ${LUA_INCLUDE_DIR}) -FILE(GLOB SOURCES src/*.cpp src/*.h) - -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build) +FILE(GLOB SOURCES src/cpp/*.cpp src/cpp/*.h) +FILE(GLOB LUA_SOURCES src/lua/*.lua) if(APPLE) # Supress warning CMP0042 @@ -31,8 +30,9 @@ set_target_properties(effil PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENER # TESTS --- #---------- -FILE(GLOB TEST_SOURCES tests/*.cpp) -set(GTEST_DIR tests/gtest/googletest) +FILE(GLOB TEST_SOURCES tests/cpp/*.cpp tests/cpp/*.h) +FILE(GLOB LUA_TEST_SOURCES tests/lua/*.lua) +set(GTEST_DIR libs/gtest/googletest) include_directories(${GTEST_DIR}/include ${GTEST_DIR}) add_executable(tests ${TEST_SOURCES} ${GTEST_DIR}/src/gtest-all.cc) @@ -43,5 +43,6 @@ set_target_properties(tests PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENER #---------- # INSTALL - #---------- - -install(FILES ${LUA_SOURCES} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +install(FILES ${LUA_SOURCES} ${LUA_TEST_SOURCES} + DESTINATION ${CMAKE_BINARY_DIR} + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ) diff --git a/build.sh b/build.sh deleted file mode 100755 index 86c45d6..0000000 --- a/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -ROOT_DIR=$( cd $(dirname $0); pwd ) -WORK_DIR=$ROOT_DIR/.work_dir - -if ! [ -d $WORK_DIR ]; then - mkdir $WORK_DIR -fi - -cd $WORK_DIR -cmake $ROOT_DIR -make -j4 -make install diff --git a/libs/gtest b/libs/gtest new file mode 160000 index 0000000..9ae086a --- /dev/null +++ b/libs/gtest @@ -0,0 +1 @@ +Subproject commit 9ae086a9ebafabdc49b71bb7f3879f551adee09a diff --git a/lua-tests/luaunit b/libs/luaunit similarity index 100% rename from lua-tests/luaunit rename to libs/luaunit diff --git a/libs/sol b/libs/sol new file mode 160000 index 0000000..5b12924 --- /dev/null +++ b/libs/sol @@ -0,0 +1 @@ +Subproject commit 5b12924d9eab43b9621b8784b5ed576686c2fb50 diff --git a/src/lua-module.cpp b/src/cpp/lua-module.cpp similarity index 100% rename from src/lua-module.cpp rename to src/cpp/lua-module.cpp diff --git a/src/shared-table.cpp b/src/cpp/shared-table.cpp similarity index 100% rename from src/shared-table.cpp rename to src/cpp/shared-table.cpp diff --git a/src/shared-table.h b/src/cpp/shared-table.h similarity index 100% rename from src/shared-table.h rename to src/cpp/shared-table.h diff --git a/src/spin-mutex.h b/src/cpp/spin-mutex.h similarity index 100% rename from src/spin-mutex.h rename to src/cpp/spin-mutex.h diff --git a/src/stored-object.cpp b/src/cpp/stored-object.cpp similarity index 100% rename from src/stored-object.cpp rename to src/cpp/stored-object.cpp diff --git a/src/stored-object.h b/src/cpp/stored-object.h similarity index 100% rename from src/stored-object.h rename to src/cpp/stored-object.h diff --git a/src/threading.cpp b/src/cpp/threading.cpp similarity index 100% rename from src/threading.cpp rename to src/cpp/threading.cpp diff --git a/src/threading.h b/src/cpp/threading.h similarity index 100% rename from src/threading.h rename to src/cpp/threading.h diff --git a/src/utils.h b/src/cpp/utils.h similarity index 100% rename from src/utils.h rename to src/cpp/utils.h diff --git a/src/sol b/src/sol deleted file mode 160000 index 039331e..0000000 --- a/src/sol +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 039331e163bb3a4870426e7b8ae7b55b53ecc579 diff --git a/tests/shared-table.cpp b/tests/cpp/shared-table.cpp similarity index 100% rename from tests/shared-table.cpp rename to tests/cpp/shared-table.cpp diff --git a/tests/test_main.cpp b/tests/cpp/test_main.cpp similarity index 100% rename from tests/test_main.cpp rename to tests/cpp/test_main.cpp diff --git a/tests/gtest b/tests/gtest deleted file mode 160000 index 5e7fd50..0000000 --- a/tests/gtest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5e7fd50e17b6edf1cadff973d0ec68966cf3265e diff --git a/lua-tests/run_tests.lua b/tests/lua/run_tests.lua similarity index 85% rename from lua-tests/run_tests.lua rename to tests/lua/run_tests.lua index 9a4cbbc..d2a1704 100755 --- a/lua-tests/run_tests.lua +++ b/tests/lua/run_tests.lua @@ -1,7 +1,10 @@ #!/usr/bin/env lua -package.cpath = package.cpath .. ";../build/?.so;;../build/?.dylib" -test = require "luaunit.luaunit" +-- TODO: remove hardcode +package.path = package.path .. ";../libs/luaunit/?.lua" +package.cpath = package.cpath .. ";./?.so;./?.dylib" + +test = require "luaunit" do -- Hack input arguments to make tests verbose by default diff --git a/lua-tests/smoke_test.lua b/tests/lua/smoke_test.lua similarity index 100% rename from lua-tests/smoke_test.lua rename to tests/lua/smoke_test.lua