-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See issue #76: Pulling over code from other, oolder branch
- Loading branch information
1 parent
91ca9fc
commit 622e386
Showing
30 changed files
with
18,226 additions
and
4 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
cmake_minimum_required(VERSION 3.19) | ||
|
||
project(pantscc | ||
LANGUAGES | ||
C CXX | ||
VERSION | ||
0.0.1 | ||
) | ||
|
||
set(CMAKE_VERBOSE_MAKEFILE TRUE) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_C_STANDARD_REQUIRED ON) | ||
set(CMAKE_C_EXTENSIONS OFF) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Don't fallback if CXX_STANDARD not found | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
add_subdirectory(app) | ||
add_subdirectory(core) | ||
add_subdirectory(trivialc) | ||
add_subdirectory(trivialcpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
set(MODULE_NAME "app") | ||
set(EXECUTABLE_NAME "${PROJECT_NAME}-${MODULE_NAME}") | ||
|
||
project(${EXECUTABLE_NAME}) | ||
|
||
add_executable(${EXECUTABLE_NAME}) | ||
target_sources(${EXECUTABLE_NAME} | ||
PRIVATE | ||
src/foo.c | ||
src/main.cpp | ||
) | ||
|
||
target_compile_options(${EXECUTABLE_NAME} | ||
PRIVATE | ||
-Wall -Wextra -Wno-c++98-compat | ||
) | ||
|
||
target_link_libraries(${EXECUTABLE_NAME} | ||
PRIVATE | ||
pantscc-core | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cc_sources(name="sources") | ||
|
||
cc_binary( | ||
name="exe", | ||
dependencies=[":sources"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "foo.h" | ||
|
||
int add(int a, int b) | ||
{ | ||
return a + b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef FOO_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
int add(int a, int b); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif //__cplusplus | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <iostream> | ||
|
||
#include "core/greeter.h" | ||
#include "foo.h" | ||
|
||
int main() | ||
{ | ||
int result = add(1, 2); | ||
greet(); | ||
std::cout << "Hello, C++ world! " << result << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cc_binary( | ||
name="tests", | ||
dependencies=["./src:sources", "./tests:tests"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
set(MODULE_NAME "core") | ||
set(LIBRARY_NAME "${PROJECT_NAME}-${MODULE_NAME}") | ||
|
||
project(${LIBRARY_NAME}) | ||
|
||
add_library(${LIBRARY_NAME} STATIC) | ||
target_sources(${LIBRARY_NAME} | ||
PRIVATE | ||
src/greeter.c | ||
) | ||
|
||
target_include_directories(${LIBRARY_NAME} | ||
PUBLIC | ||
include | ||
) | ||
|
||
target_compile_options(${LIBRARY_NAME} | ||
PRIVATE | ||
-Wall -Wextra -Wno-c++98-compat | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cc_sources() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef CORE_GREETER_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void greet(void); | ||
|
||
int add(int a, int b); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif //__cplusplus | ||
|
||
#endif // CORE_GREETER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cc_sources( | ||
name="sources" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef CORE_GREETER_PRIVATE_H | ||
|
||
// This file only exists to ensure that private and exported headers can work together | ||
char greetingSymbol(void); | ||
|
||
#endif // CORE_GREETER_PRIVATE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "core/greeter.h" | ||
|
||
#include "greeter-private.h" | ||
#include <stdio.h> | ||
|
||
// Declared in core/greeter.h | ||
void greet(void) | ||
{ | ||
char symbol = greetingSymbol(); | ||
printf("Greetings, world%c", symbol); | ||
} | ||
|
||
int add(int a, int b) | ||
{ | ||
return a + b; | ||
} | ||
|
||
// Declared in greeter-private.h | ||
char greetingSymbol(void) | ||
{ | ||
return '!'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cc_sources( | ||
name="tests" | ||
) |
Oops, something went wrong.