Skip to content

Commit

Permalink
C version mostly complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsh committed Oct 14, 2023
1 parent a7e83de commit eec25ac
Show file tree
Hide file tree
Showing 12 changed files with 415 additions and 312 deletions.
3 changes: 3 additions & 0 deletions .vscode/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ mktemp
mscgen
msvc
msvcrt
municode
objbase
parens
pidl
popen
priv
proc
Expand All @@ -56,6 +58,7 @@ wempty
werror
windres
winprefs
wmain
wmissing
wparentheses
wpointer
Expand Down
46 changes: 1 addition & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,4 @@
cmake_minimum_required(VERSION 3.26 FATAL_ERROR)
project(winprefs)

include(GNUInstallDirs)

set(GCC_CLANG_SHARED_C_FLAGS "-fno-builtin;-std=gnu11")
set(GCC_CLANG_DEBUG_C_FLAGS
"-ggdb;\
-O0;\
-pedantic;\
-Wall;\
-Wdeprecated-declarations;\
-Wempty-body;\
-Werror;\
-Werror=conversion;\
-Werror=float-conversion;\
-Werror=implicit-function-declaration;\
-Werror=incompatible-pointer-types;\
-Werror=int-conversion;\
-Werror=return-type;\
-Werror=sign-conversion;\
-Wmissing-braces;\
-Wmissing-field-initializers;\
-Wno-missing-prototypes;\
-Wno-strict-prototypes;\
-Wno-trigraphs;\
-Wno-unknown-pragmas;\
-Wparentheses;\
-Wpointer-sign;\
-Wshadow;\
-Wsign-compare;\
-Wswitch;\
-Wuninitialized;\
-Wunknown-pragmas;\
-Wunreachable-code;\
-Wunused-function;\
-Wunused-label;\
-Wunused-parameter;\
-Wunused-value;\
-Wunused-variable")

add_executable(winprefs main.c)
if(CMAKE_COMPILER_IS_GNUCC OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
target_compile_options(
winprefs PRIVATE ${GCC_CLANG_SHARED_C_FLAGS}
$<$<CONFIG:Debug>:${GCC_CLANG_DEBUG_C_FLAGS}>)
endif()
install(TARGETS winprefs DESTINATION ${CMAKE_INSTALL_BINDIR})
add_subdirectory(native)
267 changes: 0 additions & 267 deletions main.c

This file was deleted.

46 changes: 46 additions & 0 deletions native/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
include(GNUInstallDirs)

set(GCC_CLANG_SHARED_C_FLAGS "-fno-builtin;-std=gnu2x")
set(GCC_CLANG_DEBUG_C_FLAGS
"-ggdb;\
-O0;\
-pedantic;\
-Wall;\
-Wdeprecated-declarations;\
-Wempty-body;\
-Werror;\
-Werror=conversion;\
-Werror=float-conversion;\
-Werror=implicit-function-declaration;\
-Werror=incompatible-pointer-types;\
-Werror=int-conversion;\
-Werror=return-type;\
-Werror=sign-conversion;\
-Wmissing-braces;\
-Wmissing-field-initializers;\
-Wno-missing-prototypes;\
-Wno-strict-prototypes;\
-Wno-trigraphs;\
-Wno-unknown-pragmas;\
-Wparentheses;\
-Wpointer-sign;\
-Wshadow;\
-Wsign-compare;\
-Wswitch;\
-Wuninitialized;\
-Wunknown-pragmas;\
-Wunreachable-code;\
-Wunused-function;\
-Wunused-label;\
-Wunused-parameter;\
-Wunused-value;\
-Wunused-variable")

add_executable(winprefs constants.c main.c reg_command.c shell.c)
if(CMAKE_COMPILER_IS_GNUCC OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
target_link_options(winprefs PRIVATE -municode)
target_compile_options(
winprefs PRIVATE ${GCC_CLANG_SHARED_C_FLAGS}
$<$<CONFIG:Debug>:${GCC_CLANG_DEBUG_C_FLAGS}>)
endif()
install(TARGETS winprefs DESTINATION ${CMAKE_INSTALL_BINDIR})
5 changes: 5 additions & 0 deletions native/constants.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "constants.h"

const size_t MAX_KEY_LENGTH = 255;
const size_t MAX_VALUE_NAME = 16383;
const size_t CMD_MAX_COMMAND_LENGTH = 8191;
Loading

0 comments on commit eec25ac

Please sign in to comment.