You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/04/23 14:54:57 UTC

[plc4x] 02/03: - Refactored the directory structure to eliminate a lot of the intermediate directories

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch feature/c-api
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 87bc40366fe96ddda3fb33aca4e31fdff5cdeda9
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Apr 23 14:13:22 2020 +0200

    - Refactored the directory structure to eliminate a lot of the intermediate directories
---
 sandbox/plc4c/CMakeLists.txt                          |  2 ++
 sandbox/plc4c/api/CMakeLists.txt                      |  7 ++++---
 sandbox/plc4c/api/src/{main/c => }/Adder.c            |  3 +--
 sandbox/plc4c/api/{src/test/c => test}/AdderTest.c    |  2 +-
 sandbox/plc4c/drivers/modbus/CMakeLists.txt           |  5 +----
 .../drivers/{s7/src/main/c => modbus/src}/Test.c      |  0
 sandbox/plc4c/drivers/modbus/src/main/include/Test.h  | 19 -------------------
 sandbox/plc4c/drivers/s7/CMakeLists.txt               |  5 +----
 .../drivers/{modbus/src/main/c => s7/src}/Test.c      |  0
 sandbox/plc4c/drivers/s7/src/main/include/Test.h      | 19 -------------------
 sandbox/plc4c/examples/hello-world/CMakeLists.txt     |  7 +++----
 .../hello-world/src/{main/c => }/hello_world.c        |  2 +-
 .../plc4c/{api/src/main/include => includes}/Adder.h  |  0
 .../plc4c/{api/src/main/include => includes}/plc4c.h  |  6 +++---
 .../include/plc4c => includes/plc4c/api}/connection.h |  0
 .../include/plc4c => includes/plc4c/api}/system.h     |  0
 .../main/include/plc4c => includes/plc4c/api}/types.h |  0
 .../plc4c => includes/plc4c/spi}/types_private.h      |  0
 sandbox/plc4c/spi/CMakeLists.txt                      |  6 +++---
 sandbox/plc4c/spi/src/{main/c => }/connection.c       |  4 ++--
 sandbox/plc4c/spi/src/{main/c => }/system.c           |  4 ++--
 sandbox/plc4c/spi/src/{main/c => }/types.c            |  4 ++--
 22 files changed, 26 insertions(+), 69 deletions(-)

diff --git a/sandbox/plc4c/CMakeLists.txt b/sandbox/plc4c/CMakeLists.txt
index f2349da..c57cd06 100644
--- a/sandbox/plc4c/CMakeLists.txt
+++ b/sandbox/plc4c/CMakeLists.txt
@@ -66,6 +66,8 @@ if(DEBUG_OUTPUT)
   endforeach()
 endif()
 
+include_directories("includes")
+
 #[[
     Build all the modules of PLC4C
 ]]
diff --git a/sandbox/plc4c/api/CMakeLists.txt b/sandbox/plc4c/api/CMakeLists.txt
index 84766a9..160862e 100644
--- a/sandbox/plc4c/api/CMakeLists.txt
+++ b/sandbox/plc4c/api/CMakeLists.txt
@@ -17,13 +17,14 @@
   under the License.
 ]]
 
-include_directories("src/main/include")
-file(GLOB sources "src/main/c/*.c")
+#include_directories("src/main/include")
+
+file(GLOB sources "src/*.c")
 
 add_library(plc4c-api SHARED ${sources})
 
 if(BUILD_PHASE STREQUAL test-compile)
-    file(GLOB testSources "src/test/c/*.c")
+    file(GLOB testSources "test/*.c")
     add_executable(plc4c-api-test ${testSources})
     target_link_libraries (plc4c-api-test
                            plc4c-api
diff --git a/sandbox/plc4c/api/src/main/c/Adder.c b/sandbox/plc4c/api/src/Adder.c
similarity index 97%
rename from sandbox/plc4c/api/src/main/c/Adder.c
rename to sandbox/plc4c/api/src/Adder.c
index 54bc690..69b64b9 100644
--- a/sandbox/plc4c/api/src/main/c/Adder.c
+++ b/sandbox/plc4c/api/src/Adder.c
@@ -17,8 +17,7 @@
  * under the License.
  */
 #include<stdio.h>
-
-#include "Adder.h"
+#include <Adder.h>
 
 int add(int a, int b) {
     return a + b;
diff --git a/sandbox/plc4c/api/src/test/c/AdderTest.c b/sandbox/plc4c/api/test/AdderTest.c
similarity index 98%
rename from sandbox/plc4c/api/src/test/c/AdderTest.c
rename to sandbox/plc4c/api/test/AdderTest.c
index e3edb01..05b8bea 100644
--- a/sandbox/plc4c/api/src/test/c/AdderTest.c
+++ b/sandbox/plc4c/api/test/AdderTest.c
@@ -17,7 +17,7 @@
  * under the License.
  */
 #include <unity.h>
-#include "Adder.h"
+#include <Adder.h>
 
 void setUp(void) {
 }
diff --git a/sandbox/plc4c/drivers/modbus/CMakeLists.txt b/sandbox/plc4c/drivers/modbus/CMakeLists.txt
index 48c0bac..4d2164e 100644
--- a/sandbox/plc4c/drivers/modbus/CMakeLists.txt
+++ b/sandbox/plc4c/drivers/modbus/CMakeLists.txt
@@ -17,11 +17,8 @@
   under the License.
 ]]
 
-include_directories("src/main/include"
-                    "${PLC4C_ROOT_DIR}/target/generated-sources/plc4x/modbus/src/main/include")
-
 # Add the sources
-file(GLOB sources "src/main/c/*.c")
+file(GLOB sources "src/*.c")
 
 # Add the generated sources
 file(GLOB generatedSources "${PLC4C_ROOT_DIR}/target/generated-sources/plc4x/modbus/src/main/c/*.c")
diff --git a/sandbox/plc4c/drivers/s7/src/main/c/Test.c b/sandbox/plc4c/drivers/modbus/src/Test.c
similarity index 100%
rename from sandbox/plc4c/drivers/s7/src/main/c/Test.c
rename to sandbox/plc4c/drivers/modbus/src/Test.c
diff --git a/sandbox/plc4c/drivers/modbus/src/main/include/Test.h b/sandbox/plc4c/drivers/modbus/src/main/include/Test.h
deleted file mode 100644
index a031845..0000000
--- a/sandbox/plc4c/drivers/modbus/src/main/include/Test.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
-*/
-
diff --git a/sandbox/plc4c/drivers/s7/CMakeLists.txt b/sandbox/plc4c/drivers/s7/CMakeLists.txt
index 441ab59..56c0025 100644
--- a/sandbox/plc4c/drivers/s7/CMakeLists.txt
+++ b/sandbox/plc4c/drivers/s7/CMakeLists.txt
@@ -17,11 +17,8 @@
   under the License.
 ]]
 
-include_directories("src/main/include"
-                    "${PLC4C_ROOT_DIR}/target/generated-sources/plc4x/s7/src/main/include")
-
 # Add the sources
-file(GLOB sources "src/main/c/*.c")
+file(GLOB sources "src/*.c")
 
 # Add the generated sources
 file(GLOB generatedSources "${PLC4C_ROOT_DIR}/target/generated-sources/plc4x/s7/src/main/c/*.c")
diff --git a/sandbox/plc4c/drivers/modbus/src/main/c/Test.c b/sandbox/plc4c/drivers/s7/src/Test.c
similarity index 100%
rename from sandbox/plc4c/drivers/modbus/src/main/c/Test.c
rename to sandbox/plc4c/drivers/s7/src/Test.c
diff --git a/sandbox/plc4c/drivers/s7/src/main/include/Test.h b/sandbox/plc4c/drivers/s7/src/main/include/Test.h
deleted file mode 100644
index a031845..0000000
--- a/sandbox/plc4c/drivers/s7/src/main/include/Test.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
-*/
-
diff --git a/sandbox/plc4c/examples/hello-world/CMakeLists.txt b/sandbox/plc4c/examples/hello-world/CMakeLists.txt
index d06d6b2..30e9a30 100644
--- a/sandbox/plc4c/examples/hello-world/CMakeLists.txt
+++ b/sandbox/plc4c/examples/hello-world/CMakeLists.txt
@@ -17,12 +17,11 @@
   under the License.
 ]]
 
-include_directories("src/main/include"
-        "../../api/src/main/include")
+#include_directories("../../includes")
 
-file(GLOB sources "src/main/c/*.c")
+file(GLOB sources "src/*.c")
 
-add_executable(plc4c-examples-hello-world ${sources} src/main/c/hello_world.c)
+add_executable(plc4c-examples-hello-world ${sources} src/hello_world.c)
 
 target_link_libraries (plc4c-examples-hello-world
         plc4c-spi)
\ No newline at end of file
diff --git a/sandbox/plc4c/examples/hello-world/src/main/c/hello_world.c b/sandbox/plc4c/examples/hello-world/src/hello_world.c
similarity index 98%
rename from sandbox/plc4c/examples/hello-world/src/main/c/hello_world.c
rename to sandbox/plc4c/examples/hello-world/src/hello_world.c
index 4a8ef95..9a14b8f 100644
--- a/sandbox/plc4c/examples/hello-world/src/main/c/hello_world.c
+++ b/sandbox/plc4c/examples/hello-world/src/hello_world.c
@@ -17,7 +17,7 @@
  * under the License.
  */
 #include <stdio.h>
-#include "../../../../../api/src/main/include/plc4c.h"
+#include <plc4c.h>
 
 void onGlobalConnectionSuccess(plc4c_connection *connection) {
     printf("Connected to %s", plc4c_connection_get_connection_string(connection));
diff --git a/sandbox/plc4c/api/src/main/include/Adder.h b/sandbox/plc4c/includes/Adder.h
similarity index 100%
rename from sandbox/plc4c/api/src/main/include/Adder.h
rename to sandbox/plc4c/includes/Adder.h
diff --git a/sandbox/plc4c/api/src/main/include/plc4c.h b/sandbox/plc4c/includes/plc4c.h
similarity index 90%
rename from sandbox/plc4c/api/src/main/include/plc4c.h
rename to sandbox/plc4c/includes/plc4c.h
index ea09afd..fe66407 100644
--- a/sandbox/plc4c/api/src/main/include/plc4c.h
+++ b/sandbox/plc4c/includes/plc4c.h
@@ -24,9 +24,9 @@ extern "C" {
 
 /* Convenience header file that just imports all the different parts of the API */
 
-#include "plc4c/types.h"
-#include "plc4c/system.h"
-#include "plc4c/connection.h"
+#include "plc4c/api/types.h"
+#include "plc4c/api/system.h"
+#include "plc4c/api/connection.h"
 
 #ifdef __cplusplus
 }
diff --git a/sandbox/plc4c/api/src/main/include/plc4c/connection.h b/sandbox/plc4c/includes/plc4c/api/connection.h
similarity index 100%
rename from sandbox/plc4c/api/src/main/include/plc4c/connection.h
rename to sandbox/plc4c/includes/plc4c/api/connection.h
diff --git a/sandbox/plc4c/api/src/main/include/plc4c/system.h b/sandbox/plc4c/includes/plc4c/api/system.h
similarity index 100%
rename from sandbox/plc4c/api/src/main/include/plc4c/system.h
rename to sandbox/plc4c/includes/plc4c/api/system.h
diff --git a/sandbox/plc4c/api/src/main/include/plc4c/types.h b/sandbox/plc4c/includes/plc4c/api/types.h
similarity index 100%
rename from sandbox/plc4c/api/src/main/include/plc4c/types.h
rename to sandbox/plc4c/includes/plc4c/api/types.h
diff --git a/sandbox/plc4c/spi/src/main/include/plc4c/types_private.h b/sandbox/plc4c/includes/plc4c/spi/types_private.h
similarity index 100%
rename from sandbox/plc4c/spi/src/main/include/plc4c/types_private.h
rename to sandbox/plc4c/includes/plc4c/spi/types_private.h
diff --git a/sandbox/plc4c/spi/CMakeLists.txt b/sandbox/plc4c/spi/CMakeLists.txt
index 2b64d2f..2ed8405 100644
--- a/sandbox/plc4c/spi/CMakeLists.txt
+++ b/sandbox/plc4c/spi/CMakeLists.txt
@@ -17,8 +17,8 @@
   under the License.
 ]]
 
-include_directories("src/main/include"
-        "../api/src/main/include")
-file(GLOB sources "src/main/c/*.c")
+#include_directories("../includes")
+
+file(GLOB sources "src/*.c")
 
 add_library(plc4c-spi SHARED ${sources})
\ No newline at end of file
diff --git a/sandbox/plc4c/spi/src/main/c/connection.c b/sandbox/plc4c/spi/src/connection.c
similarity index 93%
rename from sandbox/plc4c/spi/src/main/c/connection.c
rename to sandbox/plc4c/spi/src/connection.c
index d97bf63..673efb0 100644
--- a/sandbox/plc4c/spi/src/main/c/connection.c
+++ b/sandbox/plc4c/spi/src/connection.c
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#include <plc4c/connection.h>
-#include <plc4c/types_private.h>
+#include <plc4c/api/connection.h>
+#include <plc4c/spi/types_private.h>
 
 return_code plc4c_connection_disconnect(plc4c_connection *connection) {
     return OK;
diff --git a/sandbox/plc4c/spi/src/main/c/system.c b/sandbox/plc4c/spi/src/system.c
similarity index 97%
rename from sandbox/plc4c/spi/src/main/c/system.c
rename to sandbox/plc4c/spi/src/system.c
index 7e96f05..fd8505e 100644
--- a/sandbox/plc4c/spi/src/main/c/system.c
+++ b/sandbox/plc4c/spi/src/system.c
@@ -18,8 +18,8 @@
  */
 
 #include <stdlib.h>
-#include <plc4c/system.h>
-#include <plc4c/types_private.h>
+#include <plc4c/api/system.h>
+#include <plc4c/spi/types_private.h>
 
 return_code plc4c_system_create(plc4c_system **system) {
     return OK;
diff --git a/sandbox/plc4c/spi/src/main/c/types.c b/sandbox/plc4c/spi/src/types.c
similarity index 95%
rename from sandbox/plc4c/spi/src/main/c/types.c
rename to sandbox/plc4c/spi/src/types.c
index dd3244e..f9223b5 100644
--- a/sandbox/plc4c/spi/src/main/c/types.c
+++ b/sandbox/plc4c/spi/src/types.c
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#include <plc4c/types.h>
-#include <plc4c/types_private.h>
+#include <plc4c/api/types.h>
+#include <plc4c/spi/types_private.h>
 
 char *plc4c_return_code_to_message(return_code err) {
     return "hurz";