first commit
This commit is contained in:
commit
08323ced24
|
@ -0,0 +1,22 @@
|
|||
cmake_minimum_required(VERSION 3.00)
|
||||
PROJECT(main)
|
||||
file(GLOB SOURCE_FILES
|
||||
"src/*.c"
|
||||
)
|
||||
add_library(foo src/foo.c)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
|
||||
target_link_directories(${PROJECT_NAME} PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/lib
|
||||
${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} foo)
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
.PHONY: all main.exe clean
|
||||
all: main.exe
|
||||
|
||||
|
||||
main.exe : build/gen
|
||||
cd build && mingw32-make && copy main.exe ..
|
||||
|
||||
build/gen:
|
||||
tools\gen.cmd
|
||||
|
||||
clean:
|
||||
del main.exe & cd build && mingw32-make clean
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef FUNC_H_
|
||||
#define FUNC_H_
|
||||
int foo(void);
|
||||
#endif
|
|
@ -0,0 +1,92 @@
|
|||
[Project]
|
||||
FileName=project.dev
|
||||
Name=main
|
||||
Type=1
|
||||
Ver=2
|
||||
ObjFiles=
|
||||
Includes=
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=
|
||||
IsCpp=0
|
||||
Icon=
|
||||
ExeOutput=build
|
||||
ObjectOutput=
|
||||
LogOutput=
|
||||
LogOutputEnabled=0
|
||||
OverrideOutput=0
|
||||
OverrideOutputName=project.exe
|
||||
HostApplication=
|
||||
UseCustomMakefile=1
|
||||
CustomMakefile=Makefile.build
|
||||
CommandLine=
|
||||
Folders=src
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000000000000000
|
||||
UnitCount=3
|
||||
|
||||
[VersionInfo]
|
||||
Major=1
|
||||
Minor=0
|
||||
Release=0
|
||||
Build=0
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=1.0.0.0
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
AutoIncBuildNr=0
|
||||
SyncProduct=1
|
||||
|
||||
[Unit2]
|
||||
FileName=src\main.c
|
||||
Folder=src
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=build.cmd
|
||||
CompileCpp=0
|
||||
|
||||
[Unit1]
|
||||
FileName=CMakeLists.txt
|
||||
Folder=
|
||||
Compile=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit4]
|
||||
FileName=gen.cmd
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit5]
|
||||
FileName=gen.cmd
|
||||
|
||||
[Unit3]
|
||||
FileName=Makefile.build
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
[Editor_0]
|
||||
CursorCol=1
|
||||
CursorRow=19
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_2]
|
||||
CursorCol=23
|
||||
CursorRow=6
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editors]
|
||||
Order=1
|
||||
Focused=1
|
||||
[Editor_1]
|
||||
CursorCol=2
|
||||
CursorRow=4
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_3]
|
||||
CursorCol=1
|
||||
CursorRow=3
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
[Editor_4]
|
||||
CursorCol=2
|
||||
CursorRow=3
|
||||
TopLine=1
|
||||
LeftChar=1
|
|
@ -0,0 +1,32 @@
|
|||
; The name of the installer
|
||||
Name "Devcpp 6.0g CMake"
|
||||
|
||||
; To change from default installer icon:
|
||||
;Icon "YOURPROGRAM.ico"
|
||||
|
||||
; The setup filename
|
||||
OutFile "Dev6.0g CMake.exe"
|
||||
|
||||
; The default installation directory
|
||||
InstallDir <<select>>
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Pages
|
||||
|
||||
Page directory
|
||||
Page instfiles
|
||||
;--------------------------------
|
||||
Section "Run"
|
||||
; Set output path to the installation directory.
|
||||
SetOutPath $INSTDIR
|
||||
File /r tools
|
||||
File /r src
|
||||
File /r include
|
||||
File /r lib
|
||||
File main.dev
|
||||
File main.layout
|
||||
File CMakeLists.txt
|
||||
File Makefile.build
|
||||
Exec 'cmd /c start "" "$instdir\main.dev"'
|
||||
SectionEnd
|
|
@ -0,0 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <func.h>
|
||||
int main(void) {
|
||||
printf("%d\n", foo());
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018 Thilo Schuchort
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,100 @@
|
|||
@echo off
|
||||
setlocal ENABLEEXTENSIONS
|
||||
setlocal enableDelayedExpansion
|
||||
|
||||
@rem set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set "CMAKE_VERSION=3.13.0"
|
||||
|
||||
@rem extract semantic version codes
|
||||
for /f "tokens=1,2,3 delims=." %%a in ("%CMAKE_VERSION%") do set CMAKE_VERSION_MAJOR=%%a&set CMAKE_VERSION_MINOR=%%b&set CMAKE_VERSION_PATCH=%%c
|
||||
|
||||
@rem get script directory name
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
|
||||
@rem strip trailing backslash from DIRNAME path to make it easier to work with
|
||||
IF %DIRNAME:~-1%==\ SET DIRNAME=%DIRNAME:~0,-1%
|
||||
|
||||
@rem get OS bitness
|
||||
echo (ignore reg error, I don't know where it comes from)
|
||||
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS_BITNESS=32BIT || set OS_BITNESS=64BIT
|
||||
|
||||
set UNZIP_EXE=%DIRNAME%\.cmakew\7zip\7z.exe
|
||||
|
||||
@rem require 7zip to unzip the cmake dist because windows sucks
|
||||
if not exist %UNZIP_EXE% (
|
||||
echo Downloading 7zip...
|
||||
|
||||
if %OS_BITNESS%==64BIT (
|
||||
call :downloadFile https://www.7-zip.org/a/7z1801-x64.exe %TEMP%\7zInstall.exe
|
||||
) else (
|
||||
call :downloadFile https://www.7-zip.org/a/7z1801.exe %TEMP%\7zInstall.exe
|
||||
)
|
||||
|
||||
echo Installing 7zip
|
||||
|
||||
@rem don't forget the trailing backslash here because 7zip is too stupid to deal with paths and just removes the last char
|
||||
%TEMP%\7zInstall.exe /S /D=%DIRNAME%\.cmakew\7zip\
|
||||
del %TEMP%\7zInstall.exe
|
||||
)
|
||||
|
||||
set CMAKE_DIR=%DIRNAME%\.cmakew\cmake-%CMAKE_VERSION%
|
||||
set CMAKE_ZIP=%TEMP%\cmake-%CMAKE_VERSION%.zip
|
||||
set CMAKE_EXE=%CMAKE_DIR%\bin\cmake.exe
|
||||
|
||||
@rem require correct cmake version
|
||||
if not exist %CMAKE_EXE% (
|
||||
echo Downloading cmake version %CMAKE_VERSION%...
|
||||
|
||||
if %OS_BITNESS%==64BIT (
|
||||
call :downloadFile https://cmake.org/files/v%CMAKE_VERSION_MAJOR%.%CMAKE_VERSION_MINOR%/cmake-%CMAKE_VERSION%-win64-x64.zip %CMAKE_ZIP%
|
||||
) else (
|
||||
call :downloadFile https://cmake.org/files/v%CMAKE_VERSION_MAJOR%.%CMAKE_VERSION_MINOR%/cmake-%CMAKE_VERSION%-win32-x86.zip %CMAKE_ZIP%
|
||||
)
|
||||
|
||||
echo Installing cmake
|
||||
|
||||
%UNZIP_EXE% x %CMAKE_ZIP% -o%DIRNAME%\.cmakew -y
|
||||
del %CMAKE_ZIP%
|
||||
|
||||
if %OS_BITNESS%==64BIT (
|
||||
ren %DIRNAME%\.cmakew\cmake-%CMAKE_VERSION%-win64-x64 cmake-%CMAKE_VERSION%
|
||||
) else (
|
||||
ren %DIRNAME%\.cmakew\cmake-%CMAKE_VERSION%-win32-x86 cmake-%CMAKE_VERSION%
|
||||
)
|
||||
)
|
||||
|
||||
@rem parse cli args to pass them to cmWake
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto runCmake
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto runCmake
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:runCmake
|
||||
%CMAKE_EXE% %CMD_LINE_ARGS%
|
||||
goto end
|
||||
|
||||
|
||||
@rem args: fileUrl, filePath
|
||||
:downloadFile
|
||||
powershell -Command "(New-Object Net.WebClient).DownloadFile('%~1', '%~2')"
|
||||
EXIT /B 0
|
||||
|
||||
:end
|
||||
if "%OS%"=="Windows_NT" endlocal
|
|
@ -0,0 +1,102 @@
|
|||
#!/bin/bash
|
||||
|
||||
cmake_version="3.10.3"
|
||||
|
||||
arr_cmake_v=(${cmake_version//./ })
|
||||
cmake_version_major=(${arr_cmake_v[0]})
|
||||
cmake_version_minor=(${arr_cmake_v[1]})
|
||||
cmake_version_patch=(${arr_cmake_v[2]})
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
cmake_bin="./cmakew/cmake-$cmake_version/bin/cmake"
|
||||
|
||||
# download cmake if neccessary
|
||||
if [ ! -f "$cmake_bin" ]; then
|
||||
download_link=""
|
||||
|
||||
if [ "$darwin" = true ]; then
|
||||
download_link="https://cmake.org/files/v$cmake_version_major.$cmake_version_minor/cmake-$cmake_version-Darwin-x86_64.tar.gz"
|
||||
else
|
||||
download_link="https://cmake.org/files/v$cmake_version_major.$cmake_version_minor/cmake-$cmake_version-Linux-x86_64.tar.gz"
|
||||
fi
|
||||
|
||||
curl "$download_link" -o "/tmp/cmake-$cmake_version.tar.gz"
|
||||
mkdir -p "cmakew/cmake-$cmake_version"
|
||||
tar -xzf "/tmp/cmake-$cmake_version.tar.gz" -C "./cmakew/cmake-$cmake_version" --strip-components=1
|
||||
rm "/tmp/cmake-$cmake_version.tar.gz"
|
||||
fi
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
if [ "$cygwin" = true ]; then
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# run cmake
|
||||
exec "$cmake_bin" "$@"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
set PATH=%~dp0cmake-wrapper;%PATH%
|
||||
rd build /s/q
|
||||
md build
|
||||
cd build
|
||||
call cmakew .. -G "MinGW Makefiles" && echo OK > gen
|
Loading…
Reference in New Issue