Заставка

Программирование на старых и современных языках, а так-же дизайн

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Программирование на старых и современных языках, а так-же дизайн » Си/Си++ » Создание makefile для BC++7.30 спомощью CMAKE


Создание makefile для BC++7.30 спомощью CMAKE

Сообщений 1 страница 2 из 2

1

1. Укажем в PATH путь к компилятору BC++ у меня он находится C:\BCC102\ и C:\BCC102\bin\:
https://i.ibb.co/M7vV7gN/bcc-path-min.jpg

2. Создадим папку на диске C cmaketest
3. Создадим файл hello.c:

Код:
#include <stdio.h>

int main(void) {
  printf("Hello");
  return 0;
}

4. Создадим файл cmakelists.txt в папке cmaketest:

Код:
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(Demo)
file(GLOB Demo_SRC
    "*.c"
)
 
add_executable(Demo ${Demo_SRC})

5. Создадим файл build.bat:

Код:
@echo off
"c:\cmake\bin\cmake" -G"Borland Makefiles" -DCMAKE_MAKE_PROGRAM="make.exe" -DCMAKE_CXX_COMPILER="bcc32c.exe" -DCMAKE_C_COMPILER="bcc32c.exe" -DCMAKE_VERBOSE_MAKEFILE=1 ..
make

6. Запуститм build.bat
Результат:

Код:
C:\cmaketest\build>build.bat
-- The C compiler identification is Embarcadero 7.30.36015
-- The CXX compiler identification is Embarcadero 7.30.36015
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/BCC102/bin/bcc32c.exe - skipped
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/BCC102/bin/bcc32c.exe - skipped
-- Configuring done
-- Generating done
-- Build files have been written to: C:/cmaketest/build
MAKE Version 5.41  Copyright (c) 1987, 2014 Embarcadero Technologies, Inc.
        C:\cmake\bin\cmake.exe -SC:\cmaketest -BC:\cmaketest\build --check-build-system CMakeFiles\Makefile.cmake 0
        C:\cmake\bin\cmake.exe -E cmake_progress_start C:\cmaketest\build\CMakeFiles C:\cmaketest\build\\CMakeFiles\progress.marks
        make  -f CMakeFiles\Makefile2 -l -o  all
MAKE Version 5.41  Copyright (c) 1987, 2014 Embarcadero Technologies, Inc.
        make  -f CMakeFiles\Demo.dir\build.make -l -o  CMakeFiles\Demo.dir\depend
MAKE Version 5.41  Copyright (c) 1987, 2014 Embarcadero Technologies, Inc.
        C:\cmake\bin\cmake.exe -E cmake_depends "Borland Makefiles" C:\cmaketest C:\cmaketest C:\cmaketest\build C:\cmaketest\build C:\cmaketest\build\CMakeFiles\Demo.dir\DependInfo.cmake --color=
Scanning dependencies of target Demo
        make  -f CMakeFiles\Demo.dir\build.make -l -o  CMakeFiles\Demo.dir\build
MAKE Version 5.41  Copyright (c) 1987, 2014 Embarcadero Technologies, Inc.
[ 50%] Building C object CMakeFiles/Demo.dir/hello.c.obj
        C:\BCC102\bin\bcc32c.exe -tR -DWIN32   -tM -Od -v -oCMakeFiles\Demo.dir\hello.c.obj -c C:\cmaketest\hello.c
Embarcadero C++ 7.30 for Win32 Copyright (c) 2012-2017 Embarcadero Technologies, Inc.
C:\cmaketest\hello.c:
[100%] Linking C executable Demo.exe
        C:\BCC102\bin\bcc32c.exe -tR -eDemo.exe -tM -lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192 -v -tC -tM -Od -v @MAKE0000.@@@
Embarcadero C++ 7.30 for Win32 Copyright (c) 2012-2017 Embarcadero Technologies, Inc.
Turbo Incremental Link 6.90 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
[100%] Built target Demo
        C:\cmake\bin\cmake.exe -E cmake_progress_start C:\cmaketest\build\CMakeFiles 0

Ура! У нас только-что создался exe-файл!

0

2

Так выглядет makefile:

Код:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Borland Makefiles" Generator, CMake Version 3.21

# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

.SUFFIXES: .hpux_make_needs_suffix_list

# Produce verbose output by default.
VERBOSE = 1

# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s

#Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force: NUL
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
SHELL = cmd.exe

# The CMake executable.
CMAKE_COMMAND = C:\cmake\bin\cmake.exe

# The command to remove a file.
RM = C:\cmake\bin\cmake.exe -E rm -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = C:\cmaketest

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = C:\cmaketest\build

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
	C:\cmake\bin\cmake-gui.exe -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache\fast: edit_cache
.PHONY : edit_cache\fast

# Special rule for the target rebuild_cache
rebuild_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
	C:\cmake\bin\cmake.exe --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache\fast: rebuild_cache
.PHONY : rebuild_cache\fast

# The main all target
all: cmake_check_build_system
	$(CMAKE_COMMAND) -E cmake_progress_start C:\cmaketest\build\CMakeFiles C:\cmaketest\build\\CMakeFiles\progress.marks
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 -$(MAKEFLAGS) all
	$(CMAKE_COMMAND) -E cmake_progress_start C:\cmaketest\build\CMakeFiles 0
.PHONY : all

# The main clean target
clean:
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 -$(MAKEFLAGS) clean
.PHONY : clean

# The main clean target
clean\fast: clean
.PHONY : clean\fast

# Prepare targets for installation.
preinstall: all
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 -$(MAKEFLAGS) preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall\fast:
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 -$(MAKEFLAGS) preinstall
.PHONY : preinstall\fast

# clear depends
depend:
	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 1
.PHONY : depend

#=============================================================================
# Target rules for targets named Demo

# Build rule for target.
Demo: cmake_check_build_system
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 -$(MAKEFLAGS) Demo
.PHONY : Demo

# fast build rule for target.
Demo\fast:
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Demo.dir\build.make -$(MAKEFLAGS) CMakeFiles\Demo.dir\build
.PHONY : Demo\fast

hello.obj: hello.c.obj
.PHONY : hello.obj

# target to build an object file
hello.c.obj:
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Demo.dir\build.make -$(MAKEFLAGS) CMakeFiles\Demo.dir\hello.c.obj
.PHONY : hello.c.obj

hello.i: hello.c.i
.PHONY : hello.i

# target to preprocess a source file
hello.c.i:
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Demo.dir\build.make -$(MAKEFLAGS) CMakeFiles\Demo.dir\hello.c.i
.PHONY : hello.c.i

hello.s: hello.c.s
.PHONY : hello.s

# target to generate assembly for a file
hello.c.s:
	$(MAKE) $(MAKESILENT) -f CMakeFiles\Demo.dir\build.make -$(MAKEFLAGS) CMakeFiles\Demo.dir\hello.c.s
.PHONY : hello.c.s

# Help Target
help:
	@echo The following are some of the valid targets for this Makefile:
	@echo ... all (the default if no target is provided)
	@echo ... clean
	@echo ... depend
	@echo ... edit_cache
	@echo ... rebuild_cache
	@echo ... Demo
	@echo ... hello.obj
	@echo ... hello.i
	@echo ... hello.s
.PHONY : help



#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0
.PHONY : cmake_check_build_system

0


Вы здесь » Программирование на старых и современных языках, а так-же дизайн » Си/Си++ » Создание makefile для BC++7.30 спомощью CMAKE