Skip to content

Commit

Permalink
Merge pull request #527 from ut-issl/feature/split-c89-to-cmake-option
Browse files Browse the repository at this point in the history
Pre Release (v3.9.0-beta.2): Split C89 compile option to BUILD_C2A_AS_C99
  • Loading branch information
sksat authored Apr 25, 2023
2 parents 74eeafe + eb816a1 commit 3040141
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ option(C2A_USE_SIMPLE_LIBC "use C2A-core hosted simple libc implementat
option(C2A_USE_C99_STDINT "use C99 standard stdint.h" ON)

option(BUILD_C2A_AS_SILS_FW "build C2A as SILS firmware" ON)
option(BUILD_C2A_AS_C99 "build C2A as C99" OFF)
option(BUILD_C2A_AS_CXX "build C2A as C++" OFF)
option(BUILD_C2A_AS_UTF8 "build C2A as UTF-8" ON)

Expand Down
2 changes: 1 addition & 1 deletion c2a_core_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ void C2A_core_main(void);
#define C2A_CORE_VER_MAJOR (3)
#define C2A_CORE_VER_MINOR (9)
#define C2A_CORE_VER_PATCH (0)
#define C2A_CORE_VER_PRE ("beta.1")
#define C2A_CORE_VER_PRE ("beta.2")

#endif
22 changes: 13 additions & 9 deletions common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ if(BUILD_C2A_AS_CXX)
# memo: set_source_files_properties() must be set before add_library/add_executable on Visual Studio CMake
set_source_files_properties(${C2A_SRCS} PROPERTIES LANGUAGE CXX) # C++
else()
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
# TODO: remove this!
# -Wno-commentが`std=c90`の後に来る必要があるのでC89のうちはこうするしかない
target_compile_options(${PROJECT_NAME} PUBLIC "-std=c90")
if(BUILD_C2A_AS_C99)
set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99) # C99
else()
set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 90) # C89
# TODO: set always!
# GNU拡張を禁止すると1行コメントがエラーになる
if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
set_target_properties(${PROJECT_NAME} PROPERTIES C_EXTENSIONS FALSE) # no extensions(GNU)
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
# TODO: remove this!
# -Wno-commentが`std=c90`の後に来る必要があるのでC89のうちはこうするしかない
target_compile_options(${PROJECT_NAME} PUBLIC "-std=c90")
else()
set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 90) # C89
# TODO: set always!
# GNU拡張を禁止すると1行コメントがエラーになる
if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
set_target_properties(${PROJECT_NAME} PROPERTIES C_EXTENSIONS FALSE) # no extensions(GNU)
endif()
endif()
endif()
endif()
Expand Down

0 comments on commit 3040141

Please sign in to comment.