Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated for new NECTO release #23

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/necto/project_templates/3_library_sdk/lib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file lib.c
* @file lib.h
* @brief ${PROJECT_NAME} library.
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.19)

if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
project(${PROJECT_NAME}_example LANGUAGES MikroC)
else()
project(${PROJECT_NAME}_example LANGUAGES C ASM)
endif()

include(mikroeUtils)

set(PROJECT_TYPE "${PROJECT_TYPE_VALUE}" CACHE STRING "" FORCE)

add_executable(${PROJECT_NAME}_example main.c)
############################ ${PROJECT_NAME} GENERATED CODE START ###########################
############################ ${PROJECT_NAME} GENERATED CODE END ###########################

find_package(MikroC.Core REQUIRED)
target_link_libraries(${PROJECT_NAME}_example
PUBLIC
MikroC.Core
${PROJECT_NAME}
)

if (${MIKROSDK_TYPE} STREQUAL "legacy")
find_package(MikroC.System REQUIRED)
target_link_libraries(${PROJECT_NAME}_example
PUBLIC
MikroC.System
${PROJECT_NAME}
)
endif()

if(COMPILER_REVISION)
if(${COMPILER_REVISION} VERSION_GREATER_EQUAL "1.0")
if(${TOOLCHAIN_LANGUAGE} STREQUAL "GNU")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.meproject)
fetch_startup_name(${CMAKE_CURRENT_SOURCE_DIR}/.meproject startupName)
if(startupName)
add_startup_all_targets(. ${CMAKE_CURRENT_SOURCE_DIR} ${startupName})
endif()
fetch_linker_name(${CMAKE_CURRENT_SOURCE_DIR}/.meproject linkerName)
if(linkerName)
add_ld_all_targets(. ${CMAKE_CURRENT_SOURCE_DIR} ${linkerName})
endif()
endif()
endif()
endif()
endif()

add_subdirectory(lib)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.19)

if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
project(${PROJECT_NAME} LANGUAGES MikroC)
else()
project(${PROJECT_NAME} LANGUAGES C ASM)
endif()

set(PROJECT_TYPE "${PROJECT_TYPE_VALUE}" CACHE STRING "" FORCE)

add_library(${PROJECT_NAME} STATIC lib.c lib.h)
############################ ${PROJECT_NAME} GENERATED CODE START ###########################
############################ ${PROJECT_NAME} GENERATED CODE END ###########################

target_link_libraries(${PROJECT_NAME}
PUBLIC
MikroC.Core
)

if (${MIKROSDK_TYPE} STREQUAL "legacy")
target_link_libraries(${PROJECT_NAME}
PUBLIC
MikroC.System
)
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @file lib.c
* @brief ${PROJECT_NAME} library.
*/

/* User code here */
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @file lib.h
* @brief ${PROJECT_NAME} library.
*/

/* User code here */
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @file main.c
* @brief Main function for ${PROJECT_NAME} application.
*/

/**
* Any initialization code needed for MCU to function properly.
* Do not remove this line or clock might not be set correctly.
*/
#ifdef PREINIT_SUPPORTED
#include "preinit.h"
#endif

int main(void)
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif

/* Replace with your application code */
while (1)
{
}

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "Application with library",
"type": "application_with_library",
"language": "MikroC",
"description": "Creates an Application with Library project configured for mikroSDK 2.0 and CMake to generate a static library with an example implementation. The project includes both application and library source files. Outputs: (.hex .a).",
"project_file": "CMakeLists.txt",
"open_in_editor": ["lib.c"],
"icon": "library_normal.mpng",
"files": ["CMakeLists.txt", "main.c", "lib/lib.c", "lib/lib.h", "lib/CMakeLists.txt"]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file lib.c
* @file lib.h
* @brief ${PROJECT_NAME} library.
*/

Expand Down
Loading